You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Current parelllization of Parquet scan is bounded by the thread that has the most data / is the slowest to execute, which means in the case of data skew (driven by either larger partitions or less selective filters during pruning / filter pushdown..., variable object store latency), the parallelism will be significantly limited.
Doing so is faster for a lot of queries, when there is an amount of skew (such as clickbench) and we have enough row filters to spread out the work.
For clickbench_partitioned / clickbench_pushdown it seems up to ~2x as fast for some queries, on a 10 core machine.
Here are some thoughts (it is getting hard to keep track of what is going on on the PR #20481). I have been looking at #20481 in order to figure out how we can most smoothly structure the code / ideas in this PR into the existing code of DataFusion
Here is my summary of the architectural changes to #20481:
A new parallel API is added to the FileOpener API : "morselize" that takes a single PartitionedFile and breaks it into Morsels (which are smaller PartitionedFiles)
Challenges I see with this design (all can be overcome with some more code):
As there is a parallel API in FileOpener that has a parallel code path this may be hard to test
It may also be hard to apply the morsel idea to non parquet paths (even though the idea is absolutely applicable). However, it might also be ok
It uses the "extensions" field to stash the morsels, which I think will break some downstream users who use that for other things (like trace context, for example)
It is not clear to me how we will add other features like configurable IO prefetching without hard coding more into FileOpener
Ideas going forward:
Rather than add a parallel API to the FileOpener API, I think we should try and make Morsels explicit in the pipeline somehow (perhaps via a Morselizer and rename FileOpener toMorselOpener trait 🤔 )
Generalize the existing code that tries to statically split files based on byte offsets -- perhaps create morsels there as well.
Isolate the work stealing to a new structure / trait (as we will need to turn it off for some plans, e.g. those that require sortedness)
I am going to try and prototype what a more explicit "morselizer" / "FileOpener' might look like
Activity
alamb commentedon Mar 9, 2026
Here are some thoughts (it is getting hard to keep track of what is going on on the PR #20481). I have been looking at #20481 in order to figure out how we can most smoothly structure the code / ideas in this PR into the existing code of DataFusion
Here is my summary of the architectural changes to #20481:
FileStreamis updated to know about "Morsels"FileOpenerAPI : "morselize" that takes a single PartitionedFile and breaks it into Morsels (which are smallerPartitionedFiles)Challenges I see with this design (all can be overcome with some more code):
Ideas going forward:
Morselizerand renameFileOpenertoMorselOpenertrait 🤔 )I am going to try and prototype what a more explicit "morselizer" / "FileOpener' might look like
alamb commentedon Mar 11, 2026
Here is a document that @Dandandan has been working on about morsels
https://docs.google.com/document/d/1yZvEXkgkIdOEZU87T8GzanQu8udbsaRq2yqetVmVDHk/edit?tab=t.0#heading=h.nvj05uxaozsr
minor: Move PreparedAccessPlan to same module as ParquetAccessPlan (#…
matthewmturner commentedon Mar 15, 2026
@alamb Would you be able to make the document public?thank you @DandandanDandandan commentedon Mar 16, 2026
Given the interest, I am thinking of creating a formal proposal for this - would that make sense?
alamb commentedon Mar 16, 2026
Yes, I think so
I personally thought you did a good job motivating the project in your meetup slides last week in stockholm: #18429 (comment)
Such a writeup would also be a great way to get a head start on a blog 😆
Dandandan commentedon Mar 16, 2026
Ok - I'll try write something up (based on the slides and current insights)!
minor: Move PreparedAccessPlan to same module as ParquetAccessPlan (a…
feat(metric): Add output skewness metric to detect skewed plans easier (
Refactor parquet datasource into an explicit state machine (#21190)
Add `FileStreamBuilder` for creating FileStreams (#21261)
refactor: Split Parquet BloomFilter CPU and IO into separate states (#…
1 remaining item
Add `FileStreamBuilder` for creating FileStreams (apache#21261)
refactor: Split Parquet BloomFilter CPU and IO into separate states (a…
alamb commentedon Apr 6, 2026
I have made a sequence of PRs that will make morsel drivel parallelism (aka dynamic file scheduling) a reality:
ParquetOpenertoParquetMorselizer#21327Introduce Morselizer API, rewrite `ParquetOpener` to `ParquetMorseliz…
Rewrite FileStream in terms of Morsel API (#21342)
Dynamic work scheduling in FileStream (#21351)
feat(metric): Add output skewness metric to detect skewed plans easier (
Refactor parquet datasource into an explicit state machine (apache#21190
Add `FileStreamBuilder` for creating FileStreams (apache#21261)
refactor: Split Parquet BloomFilter CPU and IO into separate states (a…
Split FileStreamMetrics into its own module (apache#21340)
Introduce Morselizer API, rewrite `ParquetOpener` to `ParquetMorseliz…
Rewrite FileStream in terms of Morsel API (apache#21342)
Dynamic work scheduling in FileStream (apache#21351)