Skip to content

feat(array): migrate Patched and PiecewiseSequence to scalar probes - #11122

Open
jiengup wants to merge 5 commits into
vortex-data:developfrom
jiengup:jiengup/scalar-probes/indexed
Open

jiengup wants to merge 5 commits into
vortex-data:developfrom
jiengup:jiengup/scalar-probes/indexed

Conversation

@jiengup

@jiengup jiengup commented Nov 3, 2026

Copy link
Copy Markdown
Contributor

Summary

OperationsVTable::scalar_at cannot retain preparation between row reads. The probe API introduced in #9843 retains encoding state, validity, and child probes across repeated reads.

This PR migrates 2 implementations: Patched, PiecewiseSequence.

  • Patched retains the last lane's range. Primitive offsets and indices are read directly; a second visit to a non-Primitive lane can cache up to 64 decoded indices. Larger lanes continue probing without that cache.
  • PiecewiseSequence uses division for constant piece lengths. Repeated probes over variable lengths retain at most 4,096 checkpoints (about 64 KiB) and the last piece. Encoded lengths are decoded in blocks of at most 256 pieces; only the selected start and multiplier are read through child probes.
  • One-off reads retain no encoding-owned cache. Slice offsets, validity, logical dtypes, and deferred range errors keep their existing behavior.
  • Each migrated scalar_at remains a one-off probe compatibility shim.

Verification

The following checks passed locally before rebasing onto 20cc6e2aef.

  • cargo nextest run --cargo-profile ci --locked -p vortex-array --all-features --no-fail-fast — 4,712 passed, 1 skipped.
  • cargo test --profile ci --locked -p vortex-array --all-features --doc --no-fail-fast — 84 passed, 21 ignored.
  • cargo +nightly-2026-09-10 fmt -p vortex-array --check — passed.
  • cargo clippy --profile ci --locked -p vortex-array --all-targets --all-features -- -D warnings — passed.
  • Focused cargo bench runs — the benchmark target completed successfully.

Comparison to baseline

Measured on a development machine (macOS with Apple Silicon); not representative of production performance.

cargo bench -p <crate> --bench <name> -- --min-time 0.1 --sample-count 15. Values are Divan medians in microseconds per iteration, with one retained probe per iteration.

Array Fixture Reads Baseline (µs) Migrated (µs) Change
Patched Primitive patch indices, random 256 25.700 8.332 -67.6%
PiecewiseSequence variable piece lengths, random 256 707.100 29.950 -95.8%
Patched same lane 256 45.700 10.120 -77.9%
PiecewiseSequence same piece 256 639.700 21.370 -96.7%

AI Usage

GPT-6-Sol implemented the changes with Codex. The human reviewed all the code and can explain every line of it. Benchmark results and the origin/develop comparisons are done by Codex.

Extract the reusable test-only helper from c91e73493b so independent
encoding migrations can carry the same prerequisite commit.

Source-commit: c91e73493b592c0436b08fa775cb594dc8afd955
Signed-off-by: Gunther Xing <jiengup@gmail.com>
Signed-off-by: Gunther Xing <jiengup@gmail.com>
(cherry picked from commit 835220d0a0360bbf51f8b53a1b2c4d7e00b07fcc)
Signed-off-by: Gunther Xing <jiengup@gmail.com>
Signed-off-by: Gunther Xing <jiengup@gmail.com>
(cherry picked from commit 725a9190cbd837f5f4f2445bd682b2052e198eb0)
Signed-off-by: Gunther Xing <jiengup@gmail.com>
Keep only this branch's portions of the original lint, session, and
benchmark follow-ups, including the matching manifest/lockfile changes.

Source-commits: 4c49e477e2, 8b1811ff84, 4405aa8187
Signed-off-by: Gunther Xing <jiengup@gmail.com>
Signed-off-by: Gunther Xing <jiengup@gmail.com>

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant