[WIP] Revise aggregate_files behavior in read_parquet#9197
Draft
[WIP] Revise aggregate_files behavior in read_parquet#9197
Conversation
Member
|
@rjzamora bumping this - are there any blockers here or is this ready for review? |
3 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #9043
Closes #9051
Closes #8829
This PR (mostly) preserves the existing
chunksize/aggregate_filesoptions inread_parquetby adding two new arguments:sort_input_paths(defaultTrue): Whether or not Dask should re-order the files in the dataset to use "natural" ordering. Note that this new feature could be added in a separate PR, but I wanted to make sure that the new design allows for such an argument to exist.file_groups(defaultNone): A dictionary mapping paths to "file-group" indices, or a list of directory-partitioned-column names that must match for two or more files to belong to the same "file group." This PR introduces the file group concept todd.read_parquet. The meaning is simple: Two files must belong to the same file group for Dask to consider aggregating them into the same output DataFrame partition. Matching file-group membership is necessary, but not sufficient, for file aggregation. That is, there must be some other option (likeaggregate_files=int|Trueorchunksize) to specify how files should be aggregated within each group. The engines are always allowed to reorder paths by file group to improve file-aggregation behavior (even ifsort_input_paths=False). Note that I orginally added this option in order to drop support forstrarguments toaggregate_filesin favor ofintsupport (explained below). However, it is worth noting that this option is also much more flexible/powerful than the originalaggregate_files=<str>behavior.In addition to these new arguments, I also modified the existing
aggregate_filesargument to only acceptboolorinttypes. That is, theaggregate_filesoption is now the "file equivalent" ofsplit_row_groups. Specifyingaggregate_files=100means that 100 files from the same file group may be aggregated into the same output partition.The most important result of this PR is likely the support for
aggregate_files=<int>(in combination withfile_groups=). For example. Inmain, one would need to usechunksize(orsplit_row_groups) withaggregate_files="year"to read in a single large partition for each distinct year in a partitioned NYC-taxi dataset:However, with this branch, file aggregation can be much faster/simpler: