Add OptionalFilterPhysicalExpr wrapper + proto support#22234
Draft
adriangb wants to merge 1 commit into
Draft
Conversation
Introduce `OptionalFilterPhysicalExpr`, a transparent `PhysicalExpr` wrapper that marks a filter as *optional* — droppable without affecting query correctness. It delegates every `PhysicalExpr` method to the inner expression, so it is behavior-neutral until a consumer explicitly checks for the marker. This is the foundation for adaptive filter scheduling: a scan can detect the wrapper and drop a performance-hint filter (e.g. a hash-join dynamic filter) when it is not cost-effective, knowing correctness is enforced elsewhere. Also adds proto serialization (`PhysicalOptionalFilterNode`) so physical plans containing the wrapper round-trip faithfully. No caller wraps anything yet — that arrives with the adaptive parquet scan later in the stack. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This was referenced May 15, 2026
|
Thank you for opening this pull request! Reviewer note: cargo-semver-checks reported the current version number is not SemVer-compatible with the changes in this pull request (compared against the base branch). Details |
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.
Which issue does this PR close?
Rationale for this change
Adaptive filter scheduling needs a way to mark a
PhysicalExpras a performance hint — a filter that may be dropped without affecting query correctness (e.g. a hash-join dynamic filter, whose predicate the join already enforces). This PR adds that marker type. It is deliberately inert: nothing reads it yet.What changes are included in this PR?
OptionalFilterPhysicalExpr: a transparentPhysicalExprwrapper that delegates every trait method to its inner expression.PhysicalOptionalFilterNodemessage so physical plans containing the wrapper round-trip throughdatafusion-proto.No caller wraps anything yet — the hash-join wrap and the parquet scheduler that consume the marker arrive later in the stack.
Are these changes tested?
Yes — unit tests for the wrapper's delegation behavior and a proto round-trip test.
Are there any user-facing changes?
New public type
OptionalFilterPhysicalExpr. Purely additive; no behavior change.Stacked PRs (review/merge in order):