Skip to content

feat: add between kernel for DecimalByteParts - #10152

Merged
joseph-isaacs merged 5 commits into
developfrom
ji/dbp-between
Oct 5, 2026
Merged

joseph-isaacs merged 5 commits into
developfrom
ji/dbp-between

Conversation

@joseph-isaacs

@joseph-isaacs joseph-isaacs commented Sep 30, 2026 •

Copy link
Copy Markdown
Contributor

Summary

DecimalByteParts has a compare kernel that pushes a constant comparison down to the most significant part (MSP) when there are no lower parts, but between fell back to canonicalizing the whole array. This adds a between kernel 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, between drops from about 4.0 ms (canonicalize then canonical between) to about 0.19 ms, and is about 9x faster than the existing compare + compare + AND pushdown 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: new compute/between.rs implementing BetweenKernel. It requires constant bounds and no lower parts, converts each bound into the MSP's integer type, then dispatches to the MSP's own between. 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 in compute/kernel.rs; the compare kernel's bound conversion helper and Sign enum are made pub(super) for reuse.
  • vortex-array: the canonical Decimal between kernel returned a non-null constant false when a bound overflowed the storage type, so null rows became false. 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.

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
@codspeed

codspeed Bot commented Sep 30, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 13.06%

⚠️ Unknown Walltime execution environment detected

Using the Walltime instrument on standard Hosted Runners will lead to inconsistent data.

For the most accurate results, we recommend using CodSpeed Macro Runners: bare-metal machines fine-tuned for performance measurement consistency.

⚠️ Different runtime environments detected

Some benchmarks with significant performance changes were compared across different runtime environments,
which may affect the accuracy of the results.

Open the report in CodSpeed to investigate

❌ 1 regressed benchmark
✅ 2096 untouched benchmarks
⏩ 503 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

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)

Open in CodSpeed

Footnotes

  1. 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. ↩

joseph-isaacs and others added 3 commits September 30, 2026 10:03
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
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
@joseph-isaacs joseph-isaacs added the changelog/performance A performance improvement label Oct 2, 2026

@myrrc myrrc left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@joseph-isaacs
joseph-isaacs merged commit bf82f23 into develop Oct 5, 2026
109 of 111 checks passed
@joseph-isaacs
joseph-isaacs deleted the ji/dbp-between branch October 5, 2026 11:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/performance A performance improvement

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants