Repository navigation
feat: add between kernel for DecimalByteParts - #10152
Conversation
Mirror the compare kernel: constant bounds are converted into the MSP's integer type and the check dispatches to the MSP's own between kernel when there are no lower parts. A bound that overflows the MSP type is clamped to the inclusive end of the range it lies beyond, or yields all-false when it excludes every value. Also keep the array's validity on the all-false result of the canonical decimal between kernel, which previously turned null rows into false when a bound overflowed the storage type. Signed-off-by: Joe Isaacs <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NyidRThqAtZDGEHTzvZtzC
Merging this PR will degrade performance by 13.06%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ❌ | WallTime | dict_canonicalize_gt_u8_neon[1000000] |
487.7 µs | 561 µs | -13.06% |
Tip
Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.
Comparing ji/dbp-between (aba80d0) with develop (3750d50)
Footnotes
-
503 benchmarks were skipped, so the baseline results were used instead. If they were deleted from the codebase, click here and archive them to remove them from the performance reports. ↩
Add PType::min_value and PType::max_value, and a between::all_false helper used by both the canonical decimal and byte-parts kernels. Signed-off-by: Joe Isaacs <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NyidRThqAtZDGEHTzvZtzC
Signed-off-by: Joe Isaacs <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NyidRThqAtZDGEHTzvZtzC
The value type already depends on PType, so the constructors live on PValue and ptype.rs no longer imports from the scalar module. Signed-off-by: Joe Isaacs <[email protected]> Co-Authored-By: Claude Fable 5.1 <[email protected]> Claude-Session: https://claude.ai/code/session_01NyidRThqAtZDGEHTzvZtzC
Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01NyidRThqAtZDGEHTzvZtzC Signed-off-by: Joe Isaacs <[email protected]>
Summary
DecimalBytePartshas a compare kernel that pushes a constant comparison down to the most significant part (MSP) when there are no lower parts, butbetweenfell back to canonicalizing the whole array. This adds abetweenkernel built on the same pieces, so a range predicate over an MSP-only byte-parts array runs on the narrow primitive buffer instead of the widened decimal.On 1M i32-backed decimals in release mode,
betweendrops from about 4.0 ms (canonicalize then canonical between) to about 0.19 ms, and is about 9x faster than the existingcompare + compare + ANDpushdown since it produces a single bool array in one pass. A bound that overflows the MSP type is answered in constant time.Changes
encodings/decimal-byte-parts: newcompute/between.rsimplementingBetweenKernel. It requires constant bounds and no lower parts, converts each bound into the MSP's integer type, then dispatches to the MSP's ownbetween. A bound that overflows the MSP type is clamped to the inclusive end of the range it lies beyond, or yields all-false (with the array's validity) when it excludes every value. Registered incompute/kernel.rs; the compare kernel's bound conversion helper andSignenum are madepub(super)for reuse.vortex-array: the canonicalDecimalbetween kernel returned a non-null constantfalsewhen a bound overflowed the storage type, so null rows becamefalse. It now returns an all-false bool array that keeps the array's validity.Tests cover all four strictness combinations against a canonical decimal baseline with nulls, the overflow bound cases on both sides, null preservation on an excluding bound, and the fallback when lower parts are present.