Fix #3953: Dict Layout to short-circuit fetching codes for list_contains - #10100
Closed
pamod-madubashana wants to merge 4 commits into
Closed
pamod-madubashana wants to merge 4 commits into
pamod-madubashana wants to merge 4 commits into
Conversation
Contributor
|
The reason we haven't done this kind of operations is that we shouldn't select on expression id. There has to be a mechanism that makes it generic |
Replace the ListContains-specific branch with a generic rule: any boolean filter referencing the root whose whole tree is infallible is evaluated against the cached dictionary values, pruning the range when all values miss. Covers list_contains, eq, like, etc. without selecting on expression id.
Author
|
Addressed: replaced the ListContains-specific branch with a generic rule. pruning_evaluation now handles any boolean filter that references the root and whose whole tree is infallible: it evaluates the filter against the cached dictionary values and prunes the range when all values miss (nulls as false, matching filter semantics). This covers list_contains as well as eq/like/etc. without matching on expression id, and reuses the values_eval cache so a non-pruned range pays no second values read. |
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.
Fixes #3953
What changed
DictReader::pruning_evaluationinvortex-layout/src/layouts/dict/reader.rsnow handleslist_contains(root, needle)filters.When the needle side of the expression does not reference the root (typically a literal), the predicate is evaluated against just the small dictionary values array via the existing
values_evalcache. If none of the dictionary values contain the needle (nulls treated as false, matching filter semantics), pruning returns an all-false mask for the full row range. Otherwise it returns the input mask unchanged.Because pruning never touches the codes child, a fully pruned range short-circuits the scan before
filter_evaluationever fetches codes — exactly the expensive IO this avoids. Non-list_containsexpressions keep the previous behavior (no values read during pruning), andlist_containsexpressions that do reference the root on the needle side are also left alone since they cannot be evaluated on the values array alone.Why
A dict-encoded list column can answer
list_containsmembership from its dictionary alone when the answer is negative: if no dictionary entry contains the needle, no row can match. Previously pruning was a no-op for the dict layout, so everylist_containsfilter paid for a full codes read even when the dictionaries already proved the result empty.Verification
Attempted
cargo clippy -p vortex-layout --all-targets -- -D warnings, but it cannot build in this environment: thevortex-arraybuild script requires the FlatBuffers compiler (failed to run flatc: No such file or directory). No test could be run as a result; the change was verified by careful reading against the existingfilter_evaluationvalues-eval/mask logic instead.