IN LIST: add UInt8 bitmap filter#23011
Draft
geoffreyclaude wants to merge 4 commits into
Draft
Conversation
10 tasks
b865b12 to
b910c6a
Compare
This was referenced Jun 18, 2026
80597b1 to
2f19956
Compare
Replaces HashSet<u8> with a 32-byte stack-allocated bitmap. Provides O(1) membership testing via bit-shifting, significantly reducing memory overhead and improving cache locality. Triggers for UInt8 arrays.
2f19956 to
5351b95
Compare
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?
INperformance with specialized implementations #19390.Rationale for this change
IN LISTevaluates expressions likex IN (1, 3, 7). The list on the right is fixed, so DataFusion can precompute a small lookup structure once and then reuse it for every input row.For
UInt8, there are only 256 possible values: 0 through 255. That means the lookup can be a tiny checklist with one bit per possible value:3, set bit3.7, set bit7.So instead of hashing each input value or comparing it against the list, membership becomes one indexed bit test. The bitmap is only 32 bytes, because 256 bits = 32 bytes.
This PR adds the first specialized primitive path in the stack as a concrete
UInt8filter. TheUInt16version is added in #23012, and the shared bitmap abstraction is introduced only after both concrete implementations are visible in #23035.What changes are included in this PR?
UInt8BitmapFilter, a 32-byte bitmap built from the non-null constants in theINlist.UInt8constant-list filtering to that bitmap path.INandNOT IN.static_filter.rs, so specialized filters can reuse it consistently.UInt8null handling and dictionary-encoded needles.Are these changes tested?
Yes.
cargo fmt --allcargo test -p datafusion-physical-expr bitmap_filter_u8 --libcargo test -p datafusion-physical-expr in_list_int_types --libcargo clippy -p datafusion-physical-expr --all-targets --all-features -- -D warningsAre there any user-facing changes?
No. This is an internal performance optimization only.
Local benchmark snapshot
Benchmark command:
Method: compare adjacent saved baselines using raw Criterion sample minima (
min(time / iters)). Lower is better; changes within +/-5% are treated as noise. These numbers were not rerun after splitting the bitmap abstraction into #23035.Compared baselines: #21927 -> #23011
Relevant scope: UInt8 narrow-integer rows.
Summary: 5 relevant rows, 5 faster, 0 slower, 0 within +/-5%.
narrow_integer/u8/list=16/match=0%narrow_integer/u8/list=16/match=50%narrow_integer/u8/list=4/match=0%narrow_integer/u8/list=4/match=50%nulls/narrow_integer/u8/list=16/match=50%/nulls=20%