-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[WIP] Revise aggregate_files behavior in read_parquet #9197
Draft
rjzamora
wants to merge
12
commits into
dask:main
Choose a base branch
from
rjzamora:revise-chunksize-aggregate_files
base: main
Could not load branches
Branch not found: {{ refName }}
Could not load tags
Nothing to show
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains 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_files
options inread_parquet
by 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|True
orchunksize
) 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 forstr
arguments toaggregate_files
in favor ofint
support (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_files
argument to only acceptbool
orint
types. That is, theaggregate_files
option is now the "file equivalent" ofsplit_row_groups
. Specifyingaggregate_files=100
means 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: