apache / apache/hudi

[SUPPORT] `PartitionedFile`'s size estimation in `FileSourceScanExec#createReadRDD` when enable `NewHoodieParquetFileFormat`

Open
#12,139 4 comments 0 reactions 0 assignees View on GitHub
area:performance engine:spark type:feature
Dominant language
Java
Stars
6.2k
Forks
2.5k
Avg merge
2d 8h
Merged PRs (30d)
111

Description

**_Tips before filing an issue_**

- Have you gone through our [FAQs](https://hudi.apache.org/learn/faq/)?

- Join the mailing list to engage in conversations and get faster support at dev-subscribe@hudi.apache.org.

- If you have triaged this as a bug, then file an [issue](https://issues.apache.org/jira/projects/HUDI/issues) directly.

**Describe the problem you faced**

I had a question when reading the source code in `NewHoodieParquetFileFormat` and `HoodieFileIndex`.

When we enable `hoodie.datasource.read.use.new.parquet.file.format` and then hudi will provide a `HadoopFsRelation` with `NewHoodieParquetFileFormat`.
image
image
And `FileSourceScanExec#createReadRDD` will query needed Partitions.
image
`relation.location.listFiles` in this case will be redirected to `HoodieFileIndex#listFiles`.
image
And I find that for each file-slice:
1. BaseFile is present, return PartitionedFile with BaseFile's status
2. LogFile nonEmpty, return PartitionedFile with any (random maybe) LogFile's status.

My question is, should we choose the file with the median log-files sorted by size as the PartitionedFile rather than a random log-file?
In Spark, it merges multiple PartitionedFile into a FilePartition based on the size of each PartitionedFile.
image

image

I think for a PartitionedFile that is actually a FileSlice, we should choose a more representative file size.

**To Reproduce**

Steps to reproduce the behavior:

1.
4.
5.
6.

**Expected behavior**

A clear and concise description of what you expected to happen.

**Environment Description**

* Hudi version :

* Spark version :

* Hive version :

* Hadoop version :

* Storage (HDFS/S3/GCS..) :

* Running on Docker? (yes/no) :

**Additional context**

Add any other context about the problem here.

**Stacktrace**

```Add the stacktrace of the error.```

Contributor guide

No contributing guide indexed for this repository

Research direction

Start by reading NewHoodieParquetFileFormat and HoodieFileIndex, then trace how FileSourceScanExec#createReadRDD uses relation.location.listFiles and how Spark groups PartitionedFile entries into FilePartition. Determine whether the selected log-file status gives a representative file-slice size; done means the intended sizing behavior is decided and covered for base-file and log-file cases.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
data-engineering
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.