Refactor InListExpr to use modular StaticFilter architecture#21649
Open
geoffreyclaude wants to merge 1 commit intoapache:mainfrom
Open
Refactor InListExpr to use modular StaticFilter architecture#21649geoffreyclaude wants to merge 1 commit intoapache:mainfrom
geoffreyclaude wants to merge 1 commit intoapache:mainfrom
Conversation
Introduces the StaticFilter trait to decouple membership testing from InListExpr. Migrates existing HashSet optimizations into primitive_filter.rs to maintain performance parity while enabling future specialized implementations. Triggers for all constant IN lists. (cherry picked from commit 797b7fc)
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?
IN LISToptimization series in IN LIST optims #19390.Rationale for this change
Today,
InListExprmixes several different concerns in one implementation:INlistsThat makes the code harder to follow and harder to extend when introducing new
IN LISTexecution strategies.This PR refactors the internals around a
StaticFilterabstraction for constantINlists. The goal is not to change behavior yet, but to separate the existing responsibilities so follow-up optimizations can be implemented and reviewed in smaller, more self-contained pieces.This PR is therefore primarily architectural: it preserves the current public behavior while making the internal strategy boundaries explicit.
What changes are included in this PR?
datafusion/physical-expr/src/expressions/in_list.rsto delegate filter-specific work into a dedicatedin_list/modulestatic_filter.rs, which defines the internalStaticFiltertrait used for constantINlistsprimitive_filter.rsnested_filter.rsresult.rsstrategy.rsInListExprAPI unchanged while preserving the existing constant-list fast path behaviorThe practical effect of this PR is that the current implementation becomes easier to reason about:
InListExprremains the entry point, while filter construction, filter selection, and result materialization are handled by smaller focused units.Are these changes tested?
Yes. I validated this PR with:
cargo fmt --allcargo clippy -p datafusion-physical-expr --all-targets --all-features -- -D warningscargo test -p datafusion-physical-expr in_list --libAre there any user-facing changes?
No user-facing API changes. This is an internal refactor that prepares the codebase for subsequent
IN LISTperformance improvements.