Skip to content

[Data] build row-group sub-fragments lazily so footer reads run in the scan threads - #67469

Merged
owenowenisme merged 2 commits into
masterfrom
data/parquet-footer-fetch-parallel
Oct 29, 2026
Merged

owenowenisme merged 2 commits into
masterfrom
data/parquet-footer-fetch-parallel

Conversation

@owenowenisme

Copy link
Copy Markdown
Member

Description

We previously used fragment.subset to construct Parquet sub-fragments. However, it eagerly fetches footers during construction, which causes performance issues when many small files are packed into a single task. Because sub-fragment construction runs sequentially, this eagerly fetched metadata becomes a major bottleneck.

This PR switches to fragment.format.make_fragment, deferring the footer fetching to the scanning stage. Since scanning runs across multiple threads, the footer retrieval is now fully parallelized.

Mirco benchmark

Reading sf1000 supplier table on my laptop

baseline this PR
read tasks 2 2
largest task wall 392.45 s 44.25 s
e2e wall 413.1 s 64.8 s
rows 10,000,000 10,000,000

Related issues

Link related issues: "Fixes #1234", "Closes #1234", or "Related to #1234".

Additional information

Optional: Add implementation details, API changes, usage examples, screenshots, etc.

Signed-off-by: You-Cheng Lin <mses010108@gmail.com>
@owenowenisme
owenowenisme requested a review from a team as a code owner October 27, 2026 11:16
@owenowenisme owenowenisme added data Ray Data-related issues go add ONLY when ready to merge, run all tests labels Oct 27, 2026

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the Parquet file chunking utilities in Ray Data. Specifically, in parquet_file_chunking_utils.py, when per_row_group_offsets is not present, it now lazily creates a fragment using fragment.format.make_fragment instead of recursively calling _subset. There are no review comments, and we have no feedback to provide.

@Yin-1022

Copy link
Copy Markdown
Contributor

I've verified the behavior locally with a Parquet file containing multiple row groups.

  • A fragment rebuilt with make_fragment(..., row_groups=[0, 2]) preserved the selected non-contiguous row groups, partition expression, and produced the same table as fragment.subset(row_group_ids=[0, 2]).

  • After deleting the underlying file, fragment.subset(...) failed immediately during fragment construction, while make_fragment(...) still constructed successfully and only failed when the fragment was scanned. This confirms that the footer/file access is deferred as intended.

The change looks correct to me. LGTM.

@owenowenisme
owenowenisme merged commit 910e164 into master Oct 29, 2026
6 checks passed
@owenowenisme
owenowenisme deleted the data/parquet-footer-fetch-parallel branch October 29, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data Ray Data-related issues go add ONLY when ready to merge, run all tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Ray fails to serialize self-reference objects

4 participants