-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Partitioning-Aware Aggregation and Partitioning-Aware Infrastructure #14329
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
Merged
Conversation
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
…ions, and use that to plan alternative execution paths
@Mytherin The behavior for hive-partitions for aggregationsis not explained in documentation so far. Would it also work for a JOIN operation where both datasets use same partitions? |
This is only implemented for aggregations currently |
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.
This PR adds support for partitioning-aware aggregation. The
PhysicalPartitionedAggregate
class is added, that is used when we are grouping over columns that are partitioned. Internally, the class effectively runs an ungrouped aggregate for every partition, and then merges the aggregates for each partition together. This avoids the need for a hash table - which greatly speeds up aggregation.Currently, partitition information is only emitted for hive-partitioned datasets, but this should be extended in the future.
Partition-Aware Infrastructure
This main contribution of this PR is the addition of partitioning-aware infrastructure - the aggregate is mostly a "proof-of-concept" that this works. The partitioning-aware infrastructure is mostly an extension of the batch index infrastructure. As such, most of the batch index methods are replaced with more generic partitioning methods (e.g.
get_batch_index
is turned intoget_partition_data
). The most interesting callbacks from a table function perspective are the following:The
get_info
callback is used to determine if a dataset is partitioned over a set of columns, and how it is partitioned (eitherNOT_PARTITIONED
,SINGLE_VALUE_PARTITIONS
,OVERLAPPING_PARTITIONS
orDISJOINT_PARTITIONS
). Theget_partition_data
is used at runtime (similar to howget_batch_index
was used previously) to obtain partition data for the current data chunk that we are processing.Benchmark
Below is an example of the partitioned-aware aggregation, running TPC-H Q1 over
lineitem
partitioned overl_returnflag
andl_linestatus
on TPC-H SF10:We can see that the total time is around ~20% faster. The aggregation itself is sped up significantly more (around 4X faster). The rest of the cost is dominated by reading the Parquet files. Note that the timing reported for the aggregate is the CPU runtime spent by all threads (i.e. 10 threads working for 0.22s have a total CPU run-time of 2.2s).