perf: Improve ConstantVector performance in OptimizedHashPartitionFunction#2014
Open
yingsu00 wants to merge 3 commits into
Open
perf: Improve ConstantVector performance in OptimizedHashPartitionFunction#2014yingsu00 wants to merge 3 commits into
yingsu00 wants to merge 3 commits into
Conversation
xin-zhang2
reviewed
May 14, 2026
| if (!decoded_.isConstantMapping()) { | ||
| return std::nullopt; | ||
| } | ||
|
|
Member
There was a problem hiding this comment.
I think we also need an early return when decoded_.size() == 0
xin-zhang2
reviewed
May 14, 2026
Member
xin-zhang2
left a comment
There was a problem hiding this comment.
Looks good. The unit tests for ConstantVector are still using the hash function. Can you also update them?
06dfd48 to
00f3559
Compare
Introduce OptimizedHashPartitionFunction as a faster drop-in replacement for HashPartitionFunction, gated behind a new query config flag optimized_hash_partition_function_enabled (default false). partition() is improved from 50% to over 200x. Add HashPartitionFunctionBase as a common base exposing numPartitions(), and createHashPartitionFunction() factories that select the implementation based on the flag. Thread QueryConfig* through PartitionFunctionSpec::create() and update callsites (LocalPartition, PartitionedOutput, MarkDistinct, RowNumber, Window, SubPartitionedSortWindowBuild, HiveConnector) to construct partition functions via the factory. Register CMake targets for the new test and benchmark binaries.
00f3559 to
4ba78f8
Compare
4ba78f8 to
740ba4d
Compare
…ction Before ---------------------------------------------------------------------------- partition_bool_remote_p16_constant_all_null 7.15us 139.87K optimized_partition_bool_remote_p16_constant_al 349.51% 2.05us 488.84K ---------------------------------------------------------------------------- partition_bool_remote_p100_constant_no_null 7.14us 139.97K optimized_partition_bool_remote_p100_constant_n 190.04% 3.76us 265.99K ---------------------------------------------------------------------------- After ---------------------------------------------------------------------------- partition_bool_remote_p16_constant_all_null 7.15us 139.82K optimized_partition_bool_remote_p16_constant_al 15456.% 46.28ns 21.61M ---------------------------------------------------------------------------- partition_bool_remote_p100_constant_no_null 7.14us 140.12K optimized_partition_bool_remote_p100_constant_n 14819.% 48.16ns 20.76M ---------------------------------------------------------------------------- Other data types show the same pattern.
Collaborator
Author
The |
740ba4d to
d2e4084
Compare
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.
Before
Depends on #2016