-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Speed up hash partitioning #6822
New issue
Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? # to your account
Comments
I recommend we look into implementing Selection Vectors / bitmaks -- then repartitioning could become a calculation of such filters/ bitmasks |
hi @Dandandan @alamb, I tried some experiments by running tpch benchmarks.
|
Thanks for checking this out @zebsme I don't really have any other ideas |
I wrote some ideas of supporting selection vectors inside hash join and aggregate (I believe we didn't have those issues?) This seems to be likely to give more substantial gains than trying to optimize only the partitioning code only as, even optimized, we still need to copy the inputs (and run CoalesceBatchesExec). I think (at least for join, aggregate I am less certain) it might not be too hard to implement. |
I believe the plans also effectively hash the group keys three times for aggregate plans:
Passing along the pre-computed hashes, especially for strings, might be significiantly faster |
Is your feature request related to a problem or challenge?
Also see request in arrow apache/arrow-rs#4476
In DataFusion, a common operation is to repartition a RecordBatch by hashing one or more columns and dividing them into partition record batches using the "formula" hash % num_partitions.
The current approach is to create the indices that match and use them to take the individual arrays (see BatchPartitioner in datafusion).
This is relatively expensive however, as we visit the arrays num_partitions times in different places of the array, leading to cache inefficient operators (especially when the number of partitions is high).
Describe the solution you'd like
Faster hash-partitioning implementation
Describe alternatives you've considered
No response
Additional context
No response
The text was updated successfully, but these errors were encountered: