-
Notifications
You must be signed in to change notification settings - Fork 2k
perf: Skip RowFilter when all predicate columns are in the projection #20417
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
darmie
wants to merge
5
commits into
apache:main
Choose a base branch
from
darmie:fix-parquet-filter-pushdown
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+279
−24
Open
Changes from all commits
Commits
Show all changes
5 commits
Select commit
Hold shift + click to select a range
b42ef35
Skip RowFilter pushdown when filter columns are already projected
darmie ee954ad
Add test for batch filter path and simplify stream wrapping
darmie d7ff890
Merge branch 'main' into fix-parquet-filter-pushdown
darmie 77f6315
Refine batch filter guard: count only static conjuncts
darmie ee47492
Tighten batch filter guard to exact column match
darmie File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
Oops, something went wrong.
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is correct - we shouldn't skip all the row filters altogether, we should only skip a individual row filter once it can not filter out more columns.
E.g.
select a, b from t where a = 1 and b=2We still benefit from one of them (.e.g
a=1), but not from both (b=2)This change seems to remove them both?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm, I believe that example is handled correctly.
For
select a, b from t where a = 1 and b = 2:predicate_col_indices = {a, b},projection_col_indices = {a, b}exact matchstatic_conjunct_count = 2, the<= 1check fails, RowFilter path is usedThe batch filter path only triggers when these conditions hold:
==, not subset)I agree that the ideal approach is per-conjunct: evaluate each filter individually and only promote to RowFilter the ones that provide column-skip savings. That's closer to what adriangb is exploring in #20363 with adaptive selectivity tracking. This PR is a narrower fix for the simplest degenerate case.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But this shouldn't require the adaptive selectivity tracking per se, right? Instead of either removing all predicates we can do the calculation on individual RowFilter level as how they are created so we can filter out the rowfilters not being able to save on decoding columns that follow.
Looking from my local benchmarks, the result still seems a bit mixed, I think likely because some RowFilters do still benefit from page filtering even if they are not benefiting from skipping IO on following columns. WDYT?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point.
can_use_indexin FilterCandidate already tracks page index eligibility. I can move this logic intobuild_row_filter()to work per-conjunct: keep candidates that save on column decoding or can use page index, demote the rest to batch filter. Will update.