Consolidate filter classification into physical planner #20092
+782
−920
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.
Which issue does this PR close?
Related to:
TableScan.filters#19894 - UnifiedTableScan.filtersrepresentationUPDATE ...FROMbug #19950 -UPDATE ...FROMbug (filter extraction improvements)Rationale
Currently, the optimizer calls
supports_filters_pushdown()to classify filters during logical optimization. This results in a split representation where:TableScan.filtersFilternodes above the scanThis creates several problems (as described in #19894):
What changes are included in this PR?
This PR moves ALL filter expressions to
TableScan.filtersduring logical optimization, deferring classification (Exact/Inexact/Unsupported) to the physical planner.Changes to
push_down_filter.rs:TableScan.filtersChanges to
physical_planner.rs:supports_filters_pushdown()FilterExecfor Unsupported/Inexact/Volatile filterscompute_scan_projection_with_filters()helpercreate_filter_exec()helper with async UDF supportextract_dml_filters()to also extract fromTableScan.filtersBehavior Changes:
TableScan.filtersinstead of as separateFilternodesFilterExecnodes for Unsupported/Inexact/Volatile filtersProjectionExecto trim extra columnsAre these changes tested?
Yes - updated existing tests to match new plan representations:
Are there any user-facing changes?
Plan output changes: Users will see filters in
TableScanwithpartial_filters=orunsupported_filters=annotations in logical plans, rather than separateFilter:nodes. Physical plans remain functionally equivalent withFilterExecnodes where needed.🤖 Generated with Claude Code