[opt](scan) dict-filter value-derived string predicates on ORC/Parquet - #66184
Open
Baymine wants to merge 1 commit into
Open
[opt](scan) dict-filter value-derived string predicates on ORC/Parquet#66184Baymine wants to merge 1 commit into
Baymine wants to merge 1 commit into
Conversation
What problem does this PR solve? Issue Number: close apache#66183 Problem Summary: Today ORC/Parquet dictionary filtering only applies when a filter conjunct is a bare column reference compared to constants. A predicate whose value side is a deterministic single-slot string expression -- e.g. split_by_string(col, sep)[n] = 'x', element_at(...), substring_index(...) -- is evaluated once per row even though it depends only on the column value. This lets such predicates be evaluated once per distinct dictionary value instead of once per row. The FE (Nereids) is the authoritative admission check: it stamps a conjunct root with can_dict_filter when the predicate is an equality/IN over a single slot, is deterministic, and preserves NULL semantics (null-in implies null-out -- the dictionary carries no NULL entry, so a NULL source must map to a NULL result to match per-row semantics). The verdict is carried to BE via TExprNode.can_dict_filter; when unset (older FE) BE falls back to a conservative allowlist. A new session variable enable_dict_filter_for_expr (default true, forwarded as the enable_dict_filter_for_expr query option) gates the expression case. Release note: Introduce dictionary-based evaluation of deterministic single-slot string expression predicates (e.g. split_by_string(col,sep)[n]='x') on ORC/Parquet scans, controlled by the new session variable enable_dict_filter_for_expr (default true). Speeds up scans that filter on a heavy string expression of a low-cardinality dictionary-encoded column. Check List (For author) - [x] Test <!-- At least one of them must be included. --> - [ ] Regression test - [x] Unit Test - [ ] Manual test (add detailed scripts or steps below) - [ ] No need for documentation
Baymine
requested review from
924060929,
englefly,
morrySnow and
starocean999
as code owners
July 28, 2026 12:13
Contributor
Author
|
run buildall |
Contributor
|
Thank you for your contribution to Apache Doris. Please clearly describe your PR:
|
Contributor
FE UT Coverage ReportIncrement line coverage |
Contributor
BE UT Coverage ReportIncrement line coverage Increment coverage report
|
Contributor
TPC-H: Total hot run time: 29878 ms |
Contributor
TPC-DS: Total hot run time: 177734 ms |
Contributor
ClickBench: Total hot run time: 25 s |
Contributor
BE Regression && UT Coverage ReportIncrement line coverage Increment coverage report
|
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.
What problem does this PR solve?
Issue Number: close #66183
Related PR: N/A
Problem Summary:
Today ORC/Parquet dictionary filtering only applies when a filter conjunct is a bare column reference compared to constants. A predicate whose value side is a deterministic single-slot string expression — e.g.
split_by_string(col, sep)[n] = 'x',element_at(...),substring_index(...)— is evaluated once per row even though it depends only on the column value.This lets such predicates be evaluated once per distinct dictionary value instead of once per row. The FE (Nereids) is the authoritative admission check: it stamps a conjunct root with
can_dict_filterwhen the predicate is an equality/IN over a single slot, is deterministic, and preserves NULL semantics (null-in implies null-out — the dictionary carries no NULL entry, so a NULL source must map to a NULL result to match per-row semantics). The verdict is carried to BE viaTExprNode.can_dict_filter; when unset (older FE) BE falls back to a conservative allowlist. A new session variableenable_dict_filter_for_expr(default true, forwarded as theenable_dict_filter_for_exprquery option) gates the expression case.Release note
Introduce dictionary-based evaluation of deterministic single-slot string expression predicates (e.g. split_by_string(col,sep)[n]='x') on ORC/Parquet scans, controlled by the new session variable enable_dict_filter_for_expr (default true). Speeds up scans that filter on a heavy string expression of a low-cardinality dictionary-encoded column.
Check List (For Author)
Test
Behavior changed:
Does this need documentation?
Check List (For Reviewer who merge this PR)