IN LIST: reuse primitive filters for FixedSizeBinary - #24102
IN LIST: reuse primitive filters for FixedSizeBinary#24102geoffreyclaude wants to merge 7 commits into
Conversation
9915d25 to
6f820d7
Compare
|
run benchmark in_list |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing codex/in-list-fixed-size-binary-hashset (6f820d7) to b6cccfe diff Run configurationrun benchmark in_list
baseline:
ref: "b6cccfeef1a78ab424ffec87afb40958c33fb897"Results will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing codex/in-list-fixed-size-binary-hashset (6f820d7) to b6cccfe diff Run configurationrun benchmark in_list
baseline:
ref: "b6cccfeef1a78ab424ffec87afb40958c33fb897"CPU Details (lscpu)Details
Resource Usagein_list — base (merge-base)
in_list — branch
File an issue against this benchmark runner |
|
run benchmark in_list_strategy |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing codex/in-list-fixed-size-binary-hashset (6f820d7) to 426b351 (merge-base) diff Run configurationrun benchmark in_list_strategyResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing codex/in-list-fixed-size-binary-hashset (6f820d7) to b6cccfe diff Run configurationrun benchmark in_list_strategy
baseline:
ref: "b6cccfeef1a78ab424ffec87afb40958c33fb897"Results will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing codex/in-list-fixed-size-binary-hashset (6f820d7) to 426b351 (merge-base) diff Run configurationrun benchmark in_list_strategyCPU Details (lscpu)Details
Resource Usagein_list_strategy — base (merge-base)
in_list_strategy — branch
File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing codex/in-list-fixed-size-binary-hashset (6f820d7) to b6cccfe diff Run configurationrun benchmark in_list_strategy
baseline:
ref: "b6cccfeef1a78ab424ffec87afb40958c33fb897"CPU Details (lscpu)Details
Resource Usagein_list_strategy — base (merge-base)
in_list_strategy — branch
File an issue against this benchmark runner |
Codecov Report❌ Patch coverage is Additional details and impacted files@@ Coverage Diff @@
## main #24102 +/- ##
==========================================
+ Coverage 80.91% 81.15% +0.23%
==========================================
Files 1102 1113 +11
Lines 377102 387186 +10084
Branches 377102 387186 +10084
==========================================
+ Hits 305143 314204 +9061
- Misses 53769 54449 +680
- Partials 18190 18533 +343 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
0ae4133 to
89d1595
Compare
59667db to
0a20207
Compare
12224fb to
2117edf
Compare
2117edf to
b2e4ecc
Compare
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing b2e4ecc (b2e4ecc) to 3f95830 diff Run configurationrun benchmark in_list_strategy
baseline:
ref: "3f958303e4e4ea4610ce91434f0c38ab75c99658"
changed:
ref: "b2e4eccd68ce8d694b987cc6667dabcbe53f1582"Results will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing b2e4ecc (b2e4ecc) to 3f95830 diff Run configurationrun benchmark in_list_strategy
baseline:
ref: "3f958303e4e4ea4610ce91434f0c38ab75c99658"
changed:
ref: "b2e4eccd68ce8d694b987cc6667dabcbe53f1582"CPU Details (lscpu)Details
Resource Usagein_list_strategy — base (merge-base)
in_list_strategy — branch
File an issue against this benchmark runner |
b2e4ecc to
df7980b
Compare
65e9121 to
9b316c1
Compare
Use PrimitiveHashSetFilter<T, K> for integer and floating-point arrays. Integer filters keep their native key type by default; Float32 and Float64 use their existing bitwise wrapper keys, preserving signed-zero and NaN-payload behavior. The key type and conversion are selected statically, with no function pointer or dynamic dispatch in the lookup loop. Filter selection, dictionary handling, null handling, IN, and NOT IN behavior remain unchanged. Decimal128 routing remains in the following commit.
Route Decimal128 lists above the branchless cutoff through PrimitiveHashSetFilter, replacing the ArrayStaticFilter fallback.
9b316c1 to
7ff49f9
Compare
Which issue does this PR close?
Note
Until #24283 merges, GitHub's Files changed tab also includes that PR. The direct diff from #24283 to this PR shows only the
FixedSizeBinarychanges.Rationale for this change
A
FixedSizeBinary(N)value is exactlyNbytes long. For widths 1, 2, 4, 8, and 16, DataFusion already has fastIN LISTfilters for primitive values of the same size. This PR letsFixedSizeBinaryreuse them.For example, a 4-byte value can be used as a
UInt32lookup key. This does not turn the value into a number or perform arithmetic. The list and input use the same mapping, so two keys match exactly when the original bytes match. Machine byte order does not change that equality.The filter depends on the width and the number of non-null values in the list:
UInt8UInt16UInt32UInt64Decimal128(i128storage)#24283 provides this choice, so this PR only needs to map each supported width to the matching primitive key. Other widths keep using the general filter.
Arrow buffers are normally aligned for these key types and can be read without copying. If a buffer is unaligned, the list is copied once when the filter is built, while an unaligned input is copied before each evaluation. The benchmark below measures the input-copy cost. After unwrapping any dictionary, the input must have the same
FixedSizeBinary(N)type as the list.What changes are included in this PR?
FixedSizeBinarywidths 1, 2, 4, 8, and 16.IN, andNOT IN.Are these changes tested?
Tests cover every supported width around its direct-comparison limit; bitmap and hash-set hits and misses; slices and dictionaries; input and list nulls;
INandNOT IN; wrong widths and Arrow types; unsupported widths; and aligned and unaligned buffers.Are there any user-facing changes?
No. SQL results and public APIs are unchanged.
Local benchmark snapshot
Both code states were built in separate target directories and run with identical benchmark source:
Criterion defaults were used. The tables report median point estimates. The filter is built before the timed loop, so the results measure repeated evaluation, not filter construction or a complete query. Lower is better; changes within +/-5% are treated as noise.
Compared code states: #24283 -> #24102
These measurements predate the stack split: they compared #23014 with the then-combined branch. Restacking kept the
FixedSizeBinaryadapter, its filter choices, and the timed membership loops unchanged.All 12 aligned cases improved. The geometric-mean time reduction was 71.5%. Grouped by filter, the reductions were 83.5% for direct comparison, 91.2% for bitmap lookup, and 39.4% for hash-set lookup.
Aligned FixedSizeBinary results (12 rows)
fixed_size_binary/fsb1/list=16/match=0%fixed_size_binary/fsb1/list=16/match=50%fixed_size_binary/fsb2/list=64/match=0%fixed_size_binary/fsb2/list=64/match=50%fixed_size_binary/fsb16/list=4/match=0%fixed_size_binary/fsb16/list=4/match=50%fixed_size_binary/fsb16/list=64/match=0%fixed_size_binary/fsb16/list=64/match=50%fixed_size_binary/fsb16/list=256/match=0%fixed_size_binary/fsb16/list=256/match=50%fixed_size_binary/fsb16/list=10000/match=0%fixed_size_binary/fsb16/list=10000/match=50%Unaligned input
A separate automated run used an 8,192-row input of 16-byte values and a 64-value list. Each evaluation copied 128 KiB into aligned storage.
fixed_size_binary/fsb16/list=64/match=0%/input=unalignedfixed_size_binary/fsb16/list=64/match=50%/input=unalignedIn that run, the aligned versions took 14.9 us and 25.8 us after this PR. Copying added 2.8 us in both cases, or 18.8% and 10.9%, respectively.