IN LIST: optimize Utf8View and BinaryView filters with standard hash sets - #24088
IN LIST: optimize Utf8View and BinaryView filters with standard hash sets#24088geoffreyclaude 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.91% +0.01%
==========================================
Files 1102 1103 +1
Lines 376111 377144 +1033
Branches 376111 377144 +1033
==========================================
+ Hits 304251 305160 +909
- Misses 53753 53785 +32
- Partials 18107 18199 +92 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
ec9cb2e to
65b67ba
Compare
|
run benchmark in_list |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing codex/in-list-byte-view-hashset (65b67ba) to db0c31b (merge-base) diff Run configurationrun benchmark in_listResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing codex/in-list-byte-view-hashset (65b67ba) to db0c31b (merge-base) diff Run configurationrun benchmark in_listCPU Details (lscpu)Details
Resource Usagein_list — base (merge-base)
in_list — branch
File an issue against this benchmark runner |
Which issue does this PR close?
main.INperformance with specialized implementations #19390.Rationale for this change
Arrow
Utf8ViewandBinaryViewarrays encode values up to 12 bytes completely in a 128-bit view. For anINlist containing only these values, each view is an exact membership key: small lists can compare views directly, while larger lists can use a standardHashSet<u128>without hashing or comparing the underlying bytes.What changes are included in this PR?
Utf8ViewandBinaryViewlists whose non-null values are at most 12 bytes.HashSet<u128>for larger lists.Utf8View,BinaryView, nulls, physical-type routing, and the 12/13-byte inline boundary.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 after other compilation completed, using identical benchmark source and filtering to the relevant byte-view rows:
Filters used:
utf8view/short_8b(also matchingnulls/utf8view/short_8b) andutf8view/len_12b.Method: Criterion defaults (3-second warm-up, 5-second measurement, 100 samples), comparing 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 and nullable inline views.BinaryViewuses the same physical view representation and filter implementation.Summary: 15 relevant rows, 15 faster, 0 slower, 0 within +/-5%.
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%nulls/utf8view/short_8b/list=16/match=50%/nulls=20%/NOT_INutf8view/len_12b/list=16/match=50%Full relevant table (15 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%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%