Range partition on primitives. - #24598
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #24598 +/- ##
==========================================
- Coverage 81.58% 81.57% -0.01%
==========================================
Files 1123 1124 +1
Lines 406610 407237 +627
Branches 406610 407237 +627
==========================================
+ Hits 331719 332206 +487
- Misses 55453 55552 +99
- Partials 19438 19479 +41 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
5579f93 to
a6a8368
Compare
|
Nice results! |
gene-bordegaray
left a comment
There was a problem hiding this comment.
some optimization things and linear scan path that might be interesting 👍
|
here are my samplys:
You will see the cachine |
6f4a2df to
ccaab13
Compare
gene-bordegaray
left a comment
There was a problem hiding this comment.
i think there is some strctural things that could be improved with responsiblities. I prposed a rough idea. Let me know what you think @stuhood
d87522a to
06849b5
Compare
gene-bordegaray
left a comment
There was a problem hiding this comment.
starting to get there. I think this is last major round of comments
gene-bordegaray
left a comment
There was a problem hiding this comment.
oops did not mean to approve
06849b5 to
f387d6d
Compare
f387d6d to
612381c
Compare
|
Split out the benchmarks into the bottom commit, and applied review feedback in the top commit. The initial benchmark results were a bit optimistic (they never regressed during review feedback: they were just a bit off when they were initially posted). Now updated. Thanks for the feedback! |
|
Thank you for opening this pull request! Reviewer note: cargo-semver-checks reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch). Details |
Hm... is this not allowed for commits landing on |
Which issue does this PR close?
Rationale for this change
In query plans that use range re-partitioning (such as matching the range partitioning of underlying base data, or evaluating dynamic range filters in hash joins), range re-partitioning can represent a significant fraction of total query execution time.
As detailed in the issue, the existing implementation in
RepartitionExec/BatchPartitionerandRangeExprassigns rows to partitions on a row-by-row basis usingextract_row_at_idx_to_bufand dynamicScalarValuecomparisons. This allocates per row and has dynamic dispatch overhead, making range re-partitioning 15x–30x slower than hash re-partitioning on standard integer keys.This PR adds a zero-allocation, vectorizable implementation, achieving 10x–16x speedup on primitive numeric keys and 2x–3x speedup on string and composite keys.
What changes are included in this PR?
RangeRouterwith specialized routing paths:RowConverterstoring flatRowsbuffers for strings, decimals, dictionary arrays, and composite keys.RepartitionExecto construct and share anArc<RangeRouter>across input partitions, avoiding redundant split-point encoding.BatchPartitionerandRangeExprto delegate partition routing toRangeRouter.BatchPartitioner::try_new_range_partitionerand deprecatesBatchPartitioner::new_range_partitioner.Benchmark Results (vs
mainbaseline)main)range_repartition_i64_uniformrange_repartition_i64_sequentialrange_repartition_utf8_uniformrange_repartition_composite_i64Are these changes tested?
Added unit and integration tests.
Are there any user-facing changes?
BatchPartitioner::try_new_range_partitioner(&RangePartitioning, Time) -> Result<Self>.BatchPartitioner::new_range_partitionerin favor of fallibletry_new_range_partitioner.