Read primitive values directly in branchless IN LIST filters - #24747
Read primitive values directly in branchless IN LIST filters#24747geoffreyclaude wants to merge 1 commit into
Conversation
The branchless filter only needs the array's primitive values. Read them from the value buffer instead of rebuilding ArrayData for each batch. The value buffer already accounts for array slices, so behavior is unchanged.
|
run benchmark in_list_strategy |
|
🤖 Benchmark running (GKE) | trigger CPU Details (lscpu)Comparing codex/in-list-branchless-values (c8c8c9b) to c56a7ab (merge-base) diff Run configurationrun benchmark in_list_strategyResults will be posted here when complete File an issue against this benchmark runner |
|
🤖 Benchmark completed (GKE) | trigger Instance: Comparing codex/in-list-branchless-values (c8c8c9b) to c56a7ab (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 |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #24747 +/- ##
==========================================
- Coverage 81.47% 81.47% -0.01%
==========================================
Files 1122 1122
Lines 404140 404137 -3
Branches 404140 404137 -3
==========================================
- Hits 329284 329272 -12
- Misses 55546 55551 +5
- Partials 19310 19314 +4 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Which issue does this PR close?
Rationale for this change
The branchless IN LIST filter only needs the primitive values in an array. It currently rebuilds
ArrayDatafor every batch before recovering the same value buffer, which adds fixed work to each filter evaluation.What changes are included in this PR?
Read the primitive value buffer directly. The value buffer already accounts for array slices, so behavior is unchanged.
Why is the new offset zero?
By the time DataFusion receives a
PrimitiveArray, its values buffer already starts at the first logical value. Arrow applies offsets while constructing or slicing the array:The last conversion is what
to_data()uses, and the newArrayDataBuilderdefaults to offset zero. See the upstream import, slice, export, and builder default.Thus the old
data.offset()was zero, just like the new explicit0; no offset is discarded.Are these changes tested?
Yes. Existing branchless filter tests cover slices, nulls, and all supported physical widths.
The benchmark bot independently confirms the fixed-cost reduction: plain branchless probes had 35–37% lower latency for batches of 1–64 rows and roughly 3–4% lower latency at 8,192 rows (full results).
Are there any user-facing changes?
No. Results and public APIs are unchanged.