feat(scan): add BucketSelectConverter for predicate-based bucket pruning#234
Merged
Conversation
…cpp into dev_bucket_selector
lxy-9602
reviewed
Apr 18, 2026
Collaborator
|
Great work — thanks for the high-quality submission! |
…cpp into dev_bucket_selector
lszskye
previously approved these changes
Apr 21, 2026
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.
Purpose
When reading bucketed primary key tables, if the query predicate contains equality conditions on all bucket key fields (for example, a point lookup such as
WHERE pk = 'value'), the current implementation still scans data files from all buckets.This PR introduces
BucketSelectConverter, which automatically extracts literal values for bucket keys fromEQUALpredicates and computes the target bucket ID using the configured bucket function (DEFAULT,MOD, orHIVE). This allows irrelevant buckets to be pruned during the scan phase, significantly reducing I/O and computation overhead for point lookup scenarios.Main Changes
BucketSelectConverterclass that extracts equality constraints on bucket key fields fromANDpredicates, builds aBinaryRow, and computes the target bucket using the correspondingBucketFunction.KeyValueFileStoreScan::SplitAndSetKeyValueFilter(), so that when a target bucket can be derived, a bucket filter is automatically applied.SetBucketFilterIfAbsent()inFileStoreScanto ensure that an explicitly configured bucket filter is not overridden.Tests
BucketSelectConverterTestAPI and Format
None. This change does not affect public APIs under the
includedirectory and does not introduce any storage format or protocol changes.Documentation
None.
Generative AI Tooling
Generated-by: Claude Code (Claude Opus 4.6)