IN LIST: optimize Utf8View and BinaryView filters with standard hash sets - #24088
Draft
geoffreyclaude wants to merge 1 commit into
Draft
IN LIST: optimize Utf8View and BinaryView filters with standard hash sets#24088geoffreyclaude wants to merge 1 commit into
geoffreyclaude wants to merge 1 commit into
Conversation
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #24088 +/- ##
========================================
Coverage 80.89% 80.89%
========================================
Files 1102 1103 +1
Lines 376111 376604 +493
Branches 376111 376604 +493
========================================
+ Hits 304251 304657 +406
- Misses 53753 53791 +38
- Partials 18107 18156 +49 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
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?
main.INperformance with specialized implementations #19390.Rationale for this change
Arrow
Utf8ViewandBinaryViewarrays store each value in a 128-bit view. Values up to 12 bytes are fully inline. Longer values keep their length and four-byte prefix in the view and store the remaining bytes separately.That representation allows cheap rejection without hashing or comparing complete strings. Inline values can be matched exactly from the view itself; long candidates are always confirmed against their full bytes before reporting a match.
What changes are included in this PR?
HashSet<u128>for larger inline lists.HashSet<u128>of view keys for rejection and a nativeHashTablefor exact long-value confirmation.INandNOT INsemantics.Utf8View,BinaryView, nulls, physical-type routing, and long-prefix collisions.Are these changes tested?
Yes.
cargo fmt --allcargo test -p datafusion-physical-expr --lib expressions::in_listcargo clippy --all-targets --all-features -- -D warnings./dev/rust_lint.shRUST_BACKTRACE=1 cargo test --profile ci --exclude datafusion-examples --exclude datafusion-benchmarks --exclude datafusion-cli --workspace --lib --tests --bins --features avro,json,backtrace,extended_tests,recursive_protection,parquet_encryptionAre there any user-facing changes?
No. This is an internal performance optimization only.
Local benchmark snapshot
Built and run in separate target directories, using identical benchmark source and filtering to the relevant byte-view rows:
Filters used:
utf8view/short_8b(also matchingnulls/utf8view/short_8b),utf8view/len_12b, andutf8view/mixed_len.Method: directly compared Criterion median point estimates. Filter construction remains outside the timed loop. Lower is better; changes within +/-5% are treated as noise.
Compared baselines:
mainatdb0c31bfe1-> this PRRelevant scope: all-inline
Utf8Viewrows, mixed inline/long shapes, the inline-dominant fallback, and nullable inline views.BinaryViewuses the same physical view representation and filter implementation.Summary: 23 relevant rows, 20 faster, 0 slower, 3 within +/-5%.
The inline-dominant mixed rows remain within noise, supporting the conservative fallback for that shape.
Largest relevant deltas:
utf8view/short_8b/list=4/match=50%nulls/utf8view/short_8b/list=16/match=50%/nulls=50%nulls/utf8view/short_8b/list=16/match=50%/nulls=20%/NOT_INnulls/utf8view/short_8b/list=16/match=50%/nulls=20%utf8view/short_8b/list=4/match=0%utf8view/mixed_len/list=16/match=0%utf8view/len_12b/list=64/match=50%utf8view/mixed_len/list=64/match=0%utf8view/mixed_len/inline=2%/list=64/match=0%utf8view/short_8b/list=64/match=50%Full relevant table (23 rows)
utf8view/short_8b/list=4/match=0%utf8view/short_8b/list=4/match=50%utf8view/short_8b/list=16/match=0%utf8view/short_8b/list=16/match=50%utf8view/short_8b/list=64/match=0%utf8view/short_8b/list=64/match=50%utf8view/short_8b/list=256/match=0%utf8view/short_8b/list=256/match=50%utf8view/len_12b/list=16/match=0%utf8view/len_12b/list=16/match=50%utf8view/len_12b/list=64/match=0%utf8view/len_12b/list=64/match=50%utf8view/mixed_len/list=16/match=0%utf8view/mixed_len/list=16/match=50%utf8view/mixed_len/list=64/match=0%utf8view/mixed_len/list=64/match=50%utf8view/mixed_len/inline=2%/list=64/match=0%utf8view/mixed_len/inline=2%/list=64/match=50%utf8view/mixed_len/inline=98%/list=64/match=0%utf8view/mixed_len/inline=98%/list=64/match=50%nulls/utf8view/short_8b/list=16/match=50%/nulls=20%nulls/utf8view/short_8b/list=16/match=50%/nulls=20%/NOT_INnulls/utf8view/short_8b/list=16/match=50%/nulls=50%