Skip to content

Write Widen arrays through an array plugin - #11002

Open
connortsui20 wants to merge 2 commits into
ct/array-plugin-read-write-idsfrom
ct/widen-serialize-canonical
Open

connortsui20 wants to merge 2 commits into
ct/array-plugin-read-write-idsfrom
ct/widen-serialize-canonical

Conversation

@connortsui20

@connortsui20 connortsui20 commented Oct 29, 2026 •

Copy link
Copy Markdown
Member

Tracking Issue: #10701

Stacked on #11057. #10946 builds on it. No release gate.

Summary

Widen has no wire form yet (#10733), but IPC and writes without a compressor still need to store it. A writer plugin makes that work through the same session API used by direct metadata callers.

Changes

An integer Widen writes its canonical primitive form. Recursive canonicalization makes lazy child validity storable, while keeping the Widen as the serialization source preserves statistics in its logical dtype. Restricted contexts need only the existing primitive wire ID. Decimal writes follow in #10946.

API Changes

Adds public vortex_array::arrays::widen::WidenPlugin to the default ArraySession. Empty array sessions can register it explicitly. The plugin registers no reader because vortex.widen has no wire form.

@connortsui20
connortsui20 added this pull request to stack #11007 October 29, 2026 21:33
@connortsui20 connortsui20 changed the title ct/widen serialize canonical Write Widen arrays as their canonical arrays Oct 29, 2026
@codspeed

codspeed Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Merging this PR will degrade performance by 7.89%

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

⚡ 7 improved benchmarks
❌ 6 regressed benchmarks
✅ 2305 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] 358.1 ns 999.1 ns -64.15%
❌ Walltime threshold_neon[64] 2.6 µs 3.8 µs -32.65%
❌ Walltime threshold_neon[80] 3.4 µs 4.4 µs -22.69%
❌ Walltime filter_neon[80] 2.5 µs 3.1 µs -20.87%
❌ Walltime filter_neon[64] 1.8 µs 2.2 µs -16.45%
❌ Walltime scalar_subtract_neon 10.5 µs 12 µs -12.01%
⚡ CPU Simulation bench_compare_varbin[(50000, 2)] 162.8 µs 132.7 µs +22.67%
⚡ CPU Simulation bench_compare_varbin[(50000, 64)] 164.7 µs 134.5 µs +22.38%
⚡ CPU Simulation encode_primitives[u8, (2000, 4)] 163.3 µs 135 µs +21.01%
⚡ CPU Simulation take_filter_primitive_small_uncached_random_mask_random_indices[4096, 10] 24.4 µs 20.9 µs +16.83%
⚡ CPU Simulation bench_compare_sliced_dict_varbinview[(1000, 10000)] 88.4 µs 77.2 µs +14.47%
⚡ CPU Simulation bench_compare_sliced_dict_varbinview[(7500, 10000)] 228 µs 199.4 µs +14.33%
⚡ CPU Simulation bench_compare_sliced_dict_varbinview[(10000, 10000)] 234.2 µs 205.5 µs +13.96%

Tip

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


Comparing ct/widen-serialize-canonical (72749e5) with ct/array-plugin-read-write-ids (9556b96)

Open in CodSpeed

@connortsui20
connortsui20 marked this pull request as ready for review October 29, 2026 21:44
@connortsui20 connortsui20 added the changelog/feature A new feature label Oct 29, 2026
Comment thread vortex-array/src/serde.rs Resolved
@connortsui20
connortsui20 force-pushed the ct/widen-serialize-canonical branch from de8a7a6 to f3d53cc Compare October 30, 2026 17:50
@connortsui20 connortsui20 changed the title Write Widen arrays as their canonical arrays Write Widen arrays through an array plugin Oct 30, 2026
@connortsui20
connortsui20 removed this pull request from stack #11007 October 30, 2026 18:02
@connortsui20
connortsui20 changed the base branch from develop to ct/array-plugin-read-write-ids October 30, 2026 18:03
@connortsui20
connortsui20 added this pull request to stack #11058 October 30, 2026 18:03
@connortsui20
connortsui20 force-pushed the ct/widen-serialize-canonical branch from f3d53cc to 72749e5 Compare October 30, 2026 19:28
Comment on lines +42 to +60
fn serialize(
&self,
array: &ArrayRef,
session: &VortexSession,
) -> VortexResult<Option<ArraySerialization>> {
// TODO(connor)[Widen]: Add `vortex.widen` to both ID lists when it gets a wire form
// (#10733), and write it only where the writer permits it. This method cannot see the
// permitted IDs today.

// The child validity can be lazy, so the writer needs recursive canonicalization to
// produce nodes that it can store.
let canonical = array
.clone()
.execute::<RecursiveCanonical>(&mut session.create_execution_ctx())?
.0
.into_array();

session.array_serialize(&canonical)
}

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.

Here is an open question: instead of doing this, do we want to have a more generalized version of this fix?

Not saying the PR should be blocked on this (as I do need to make progress on this stack), but there exist other encodings that we only have in-memory that we would want to ensure do not get serialized to disk (either because of an edition, or because we do not want them to be serialized ever).

Some examples:

  • Filter
  • Slice
  • Patched (the LLM is even telling me that this is a bug, and Patched needs a similar change as this one)
  • ScalarFn (which we serialize now but imo we might want a different name for serialized scalar functions, see Tracking Issue: Encodings vs Scalar Functions #9156)
  • Any encoding that might easily be created in memory but we disallow via editions

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/feature A new feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants