Skip to content

Execute interleaved decimal arrays - #10940

Merged
connortsui20 merged 6 commits into
developfrom
ct/decimal-interleave
Oct 29, 2026
Merged

connortsui20 merged 6 commits into
developfrom
ct/decimal-interleave

Conversation

@connortsui20

@connortsui20 connortsui20 commented Oct 28, 2026 •

Copy link
Copy Markdown
Member

Summary

Interleave accepts decimal values but panics when it executes them, because only the bool and primitive kernels exist. Decimal Widen (CD4) falls back to canonical decimals for interleave, so it needs a decimal kernel first.

Changes

Most of the diff is a refactor of the primitive kernel: its gather moves into a fixed_width module next to the kernels, so decimals reuse it instead of getting a second copy. Canonical decimals are fixed-width buffers just like primitives, so one set of selector bounds checks and one tuned gather loop can serve both. The gather stays in interleave and not in arrays/fixed_width because it owns the selector contract of Interleave and has no other caller.

Decimal sources stored at a non-canonical width are copied to the canonical width before the gather. That copy goes away once CD8a stores every decimal at its canonical width.

API Changes

Interleave executes decimal values and returns them at the canonical width of their dtype, where it used to panic.

@connortsui20 connortsui20 added the changelog/feature A new feature label Oct 28, 2026
@connortsui20 connortsui20 mentioned this pull request Oct 28, 2026
11 of 32 tasks
@codspeed

codspeed Bot commented Oct 28, 2026 •

Copy link
Copy Markdown

Merging this PR will regress 5 benchmarks

2 warnings

⚠️ 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

⚠️ 3 benchmarks are dominated by system calls

System calls cannot be simulated consistently and are left out of the measure. The reported value understates the real cost. Switch to the Walltime instrument to measure them.

Learn more about system calls

See affected benchmarks

⚡ 3 improved benchmarks
❌ 5 regressed benchmarks
✅ 2266 untouched benchmarks
⏩ 370 skipped benchmarks1
🗄️ 30 archived benchmarks run2

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ CPU Simulation random_i8[0.01] 99 µs 123.3 µs -19.72%
❌ CPU Simulation encode_primitives[u8, (2000, 4)] 136.2 µs 164.7 µs -17.29%
❌ CPU Simulation filter_powerlaw_by_correlated_runs[100000] 51.2 µs 61.9 µs -17.2%
❌ CPU Simulation take_filter_list_small_uncached_random_mask_random_indices[768, 10] 105.4 µs 119.4 µs -11.72%
❌ CPU Simulation max_f64 282 µs 315.2 µs -10.52%
⚡ Walltime mul_u64_nonnull_neon 38.9 µs 20.3 µs +92.09%
⚡ Walltime lt_i64_nullable_avx512 8.1 µs 7.3 µs +10.91%
⚡ Walltime deferred_bool_avx2[16384, (Columns, NullOnlyFailure)] 302 µs 273.6 µs +10.38%

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-interleave (4e054c4) with develop (40e0b1c)

Open in CodSpeed

Footnotes

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

  2. 30 benchmarks were run, but are now archived. If they were deleted in another branch, consider rebasing to remove them from the report. Instead if they were added back, click here to restore them. ↩

@connortsui20
connortsui20 force-pushed the ct/decimal-interleave branch from 2fbe1e5 to 98dea22 Compare October 28, 2026 19:27
@connortsui20
connortsui20 changed the base branch from develop to ct/decimal-valid-range October 28, 2026 19:27
@connortsui20
connortsui20 force-pushed the ct/decimal-interleave branch from 98dea22 to bd15c87 Compare October 28, 2026 20:00
Base automatically changed from ct/decimal-valid-range to develop October 28, 2026 20:42
Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
Prepare each decimal source as one typed gather input, with an early return for constants. Keep buffer normalization separate from selector dispatch. Parameterize bounds-check cases and report assertion failures at their callers.

Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
The module imports `Interleave`, so rustdoc rejects the explicit link target as
redundant. The source comment now covers both the widening and the narrowing
copy, and the tests share one module session.

Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
…dispatch

Primitive and decimal execution both repeated the dispatch over the two selector types. `gather` now owns it, and the slice kernel becomes `gather_rows`. `Source::constant` and `Source::decoded` set `row_mask` and the row count, so callers no longer write these fields by hand. The unit test now also covers the row check of a decoded source.

Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
The decimal tests repeated cases that other tests already cover. The scale and nullability dimensions do not reach decimal code, the selector bounds checks belong to the shared `gather`, and `copy_to_canonical_width` has tests for each width. The remaining tests cover each canonical width, constants stored at other widths, sources stored at other widths, empty input and a value outside the precision. The lazy-children test in `interleave/mod.rs` now covers the decimal kernel too.

With fewer tests, the kernel is a flat `decimal.rs` like `bool.rs` and `primitive.rs`.

Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
@connortsui20
connortsui20 force-pushed the ct/decimal-interleave branch from 7d99ff3 to c0eb004 Compare October 28, 2026 20:46
@connortsui20
connortsui20 marked this pull request as ready for review October 28, 2026 20:51
Comment on lines -144 to -146
let Some(source) = values.get((*branch).as_()) else {
vortex_bail!("interleave array index out of bounds");
};

@connortsui20 connortsui20 Oct 28, 2026 •

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Im pretty sure we want to panic here instead of erroring, that would be consistent with how dict take works.

I'll have a followup PR on this later (and I think that runend and chunked take should also panic on OOB instead of erroring)

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

ok nvm this is actually the correct behavior, we want dict take to error instead

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

this is mostly a refactor of the current primitive.rs in this module

Once every `DecimalArray` stores its values at the canonical width of its dtype (#10701), all sources of a decimal `Interleave` share that width and the copy branch cannot run.

Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
@connortsui20
connortsui20 enabled auto-merge (squash) October 28, 2026 21:09
@connortsui20
connortsui20 merged commit 1a09eb4 into develop Oct 29, 2026
94 of 103 checks passed
@connortsui20
connortsui20 deleted the ct/decimal-interleave branch October 29, 2026 12:05
connortsui20 added a commit that referenced this pull request Oct 29, 2026
WD1 to WD4, CD3, CD3b and the decimal Interleave kernel merged, and
CD4, CD5 and WD6 are open drafts. The plan now lists CD3b (#10939) and
the Interleave kernel (CD4p, #10940) as dependencies of CD4, and CD3b
as a dependency of CD6 and CD7. CD7 merges right after CD5 (#10905).

D26 moves to CD6, because CD4 (#10946) adds no serialization lowering:
the default writer executes a Widen, and reads of old files are the
first ordinary source of one. The CD6 and WR1 briefs now carry that
choice. D35 no longer makes WD6 wait for WD5. #10908 joins the
follow-up issues, and the plan suggests settling the mechanism of

Signed-off-by: Connor Tsui <connor.tsui20@gmail.com>
#10748 before WD5.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

changelog/feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants