Skip to content

Read stored decimal values into the canonical array or a Widen - #11005

Draft
connortsui20 wants to merge 2 commits into
ct/decimal-widen-aggregatesfrom
ct/decimal-widen-stored
Draft

connortsui20 wants to merge 2 commits into
ct/decimal-widen-aggregatesfrom
ct/decimal-widen-stored

Conversation

@connortsui20

@connortsui20 connortsui20 commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Tracking Issue: #10701

Stacked on #11004. #11006, #10905 and #10995 build on it. No release gate.

Summary

Old decimal nodes and decoded DecimalByteParts can store values at another width than their dtype's canonical width. They need one conversion rule, since a child precision that misses a value would make later comparison shortcuts incorrect.

Changes

Canonical storage reuses its buffer without a scan, including device buffers. Other storage reads on the host and becomes a Widen over the smallest valid child, or the canonical array when no child is narrower. Encoding shares the same child selection. Known ranges can avoid a scan, and exact extrema are cached on the child so later aggregates reuse that work.

API Changes

Adds WidenArray::from_stored_decimal(parts, known_range, ctx). A supplied range must contain every valid value. Exact ranges become exact child extrema, while inexact ranges remain bounds.

@codspeed

codspeed Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Merging this PR will regress 2 benchmarks

1 warning

⚠️ Walltime results may be unreliable

Some benchmarks used the Walltime instrument outside CodSpeed Macro Runners, which can make the results inconsistent.

Learn more about Macro Runners

See affected benchmarks

⚡ 13 improved benchmarks
❌ 2 regressed benchmarks
✅ 2345 untouched benchmarks

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ CPU Simulation filter_powerlaw_by_random[10000] 348.4 ns 1,626.4 ns -78.58%
❌ Walltime mul_u64_nonnull_neon 20.5 µs 39.1 µs -47.6%
⚡ Walltime threshold_neon[80] 5.7 µs 3.6 µs +61.22%
⚡ Walltime threshold_neon[64] 3.7 µs 2.6 µs +42.21%
⚡ Walltime filter_neon[64] 2.4 µs 1.8 µs +33.92%
⚡ Walltime filter_neon[80] 3.4 µs 2.6 µs +28.03%
⚡ CPU Simulation bench_compare_varbin[(50000, 2)] 162.1 µs 132 µs +22.76%
⚡ CPU Simulation bench_compare_varbin[(50000, 64)] 164.2 µs 133.8 µs +22.73%
⚡ CPU Simulation bench_compare_sliced_dict_varbinview[(1000, 10000)] 88.8 µs 77.9 µs +14.05%
⚡ CPU Simulation bench_compare_sliced_dict_varbinview[(7500, 10000)] 227.5 µs 199.6 µs +14%
⚡ CPU Simulation bench_compare_sliced_dict_varbinview[(10000, 10000)] 233.7 µs 205.8 µs +13.59%
⚡ Walltime add_constant_shapes_neon[(32768, ConstantPerRow)] 15.9 µs 14.2 µs +11.92%
⚡ Walltime add_constant_shapes_neon[(32768, PerRowNullableConstant)] 16.5 µs 14.8 µs +11.9%
⚡ Walltime add_constant_shapes_neon[(32768, PerRowConstant)] 15.9 µs 14.3 µs +10.79%
⚡ Walltime scalar_subtract_neon 11.3 µs 10.2 µs +10.55%

Tip

Investigate this regression by commenting @codspeedbot fix this regression on this PR, or directly use the CodSpeed MCP with your agent.


Comparing ct/decimal-widen-stored (b3b006c) with ct/decimal-widen-aggregates (5d992ff)

Open in CodSpeed

@connortsui20 connortsui20 added the changelog/break A breaking API change label Oct 29, 2026
@connortsui20 connortsui20 mentioned this pull request Oct 30, 2026
11 of 32 tasks
@connortsui20
connortsui20 force-pushed the ct/decimal-widen-stored branch from eb6bfc5 to b3b006c Compare October 30, 2026 17:50
@connortsui20
connortsui20 removed this pull request from stack #11007 October 30, 2026 18:02
@connortsui20
connortsui20 added this pull request to stack #11058 October 30, 2026 18:04
Readers meet decimal values at a stored width that can differ from
the canonical width of their dtype: old `vortex.decimal` nodes and
decoded DecimalByteParts. Add `WidenArray::from_stored_decimal` so
that both share one conversion. A canonical stored width passes
through without a scan, also for device buffers. Any other width
copies to the host and becomes a decimal Widen over the narrowest
child, or the canonical array when no child is narrower.

The parts are checked first, because `execute_mask` and `valid_range`
assert on a length mismatch and a read must never panic.

`encode_decimal` now shares the core that picks the child, so it
reuses the input buffer when its stored width already is the child
width, and the child records the extrema of the scan. A caller can
pass the range as a `Precision`: `Absent` scans, an `Exact` range
becomes the exact extrema of the child, and an `Inexact` range is a
bound that the child records as inexact.

Signed-off-by: Connor Tsui <[email protected]>
@connortsui20
connortsui20 force-pushed the ct/decimal-widen-stored branch from b3b006c to e50341e Compare October 30, 2026 19:28

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/break A breaking API change

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant