Skip to content

Move scalar functions out of vortex-array into vortex-functions - #10762

Merged
lwwmanning merged 10 commits into
developfrom
rk/split-array-06-scalar-fns
Nov 23, 2026
Merged

lwwmanning merged 10 commits into
developfrom
rk/split-array-06-scalar-fns

Conversation

@robert3005

@robert3005 robert3005 commented Oct 23, 2026 •

Copy link
Copy Markdown
Contributor

Splits non-core scalar functions out of vortex-array into a separate vortex-functions crate to reduce vortex-array's footprint and compile surface as part of breaking up vortex-array (followed up by #10768 and #10769).

vortex-array keeps the scalar function machinery (the ScalarFnVTable trait, binding, reduction, execution, the session registry and kernel registry) and the few functions its own arrays, validity and expressions are built on: literal, get_item, pack and select, is_null, is_not_null, not and the binary operators, and cast, mask and fill_null, which canonical arrays apply to their own children. That module is renamed from scalar_fn::fns to scalar_fn::builtin, matching ArrayBuiltins. Every other scalar function moves to the new vortex-functions crate:

  • byte_length, case_when, ext_storage, list_length, list_sum, list_transform, lower, lower_bound, merge, replace_time_zone, strpos, dynamic, dynamic_expression, stat, between, like, list_contains, variant_get, is_nan and zip, with their expression constructors in vortex_functions::expr (and expr::bound)
  • their kernels and parent-reduce rules for vortex-array's encodings (including Widen's and the zip-backed nested fill_null kernels for struct, list, fixed-size list, and map arrays), which vortex_functions::initialize registers with the session's kernel registry
  • the ArrayBuiltins/ExprBuiltins methods for the moved functions, which become the ArrayFunctions/ExprFunctions extension traits

ArrayHaystack, LazyBitBufferBuilder, DeduplicatedBuffers::{extend_from_iter, finish}, ListScalar::element_values, is_not_null_node, build_row_comparator, merge_typed_scalar_as_variant, FillNull::{supports_dtype, short_circuit}, and the Widen compute helpers become public for the moved kernels; ForeignExtDType is public under _test-harness for the moved tests.

Breaking change: callers that construct a VortexSession by hand (instead of using VortexSession::default()) lose the moved scalar functions, their kernels, and nested fill_null support for struct/list/fixed-size-list/map arrays unless they call vortex_functions::initialize.

@robert3005 robert3005 added the changelog/break A breaking API change label Oct 23, 2026
@robert3005
robert3005 marked this pull request as draft October 23, 2026 22:47
@robert3005
robert3005 force-pushed the rk/split-array-06-scalar-fns branch from 714ed9d to fd2bbf1 Compare October 23, 2026 22:57
@codspeed

codspeed Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

Merging this PR will regress 1 benchmark

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

⚠️ 1 benchmark is 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

⚡ 7 improved benchmarks
❌ 1 regressed benchmark
✅ 1987 untouched benchmarks
🆕 78 new benchmarks
⏩ 85 skipped benchmarks1

Warning

Please fix the performance issues or acknowledge them on CodSpeed.

Performance Changes

Mode Benchmark BASE HEAD Efficiency
❌ CPU Simulation null_count_run_end[(32000, 1024, 0.01)] 7.7 µs 9 µs -14.49%
⚡ CPU Simulation random_i128[0.01] 38.2 µs 8 µs ×4.8
⚡ CPU Simulation filter_random_by_random[10000] 36.5 µs 8.2 µs ×4.4
⚡ CPU Simulation ArrowExportVTable_to_arrow_field 44.4 µs 16.4 µs ×2.7
⚡ CPU Simulation random_i128[0.5] 126.7 µs 97.9 µs +29.38%
⚡ CPU Simulation random_i128[0.8] 153.1 µs 122.9 µs +24.57%
⚡ CPU Simulation density_sweep_random[0.001] 20.1 µs 17.2 µs +17.1%
⚡ CPU Simulation compare[1] 72 µs 62.2 µs +15.76%
🆕 CPU Simulation nonnull N/A 107.7 µs N/A
🆕 CPU Simulation nullable N/A 185.9 µs N/A
🆕 CPU Simulation case_when_all_false[1000] N/A 113.8 µs N/A
🆕 CPU Simulation case_when_all_false[10000] N/A 183.7 µs N/A
🆕 CPU Simulation case_when_all_false[40000] N/A 426.2 µs N/A
🆕 CPU Simulation case_when_all_true[1000] N/A 114 µs N/A
🆕 CPU Simulation case_when_all_true[10000] N/A 185.1 µs N/A
🆕 CPU Simulation case_when_all_true[40000] N/A 427 µs N/A
🆕 CPU Simulation case_when_decimal_product[1] N/A 232.8 µs N/A
🆕 CPU Simulation case_when_decimal_product[64] N/A 211.5 µs N/A
🆕 CPU Simulation case_when_decimal_product[8] N/A 212.3 µs N/A
🆕 CPU Simulation case_when_nary_10_conditions[1000] N/A 426.8 µs N/A
... ... ... ... ... ...

ℹ️ Only the first 20 benchmarks are displayed. Go to the app to view all benchmarks.

Tip

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


Comparing rk/split-array-06-scalar-fns (8073f00) with develop (43aadca)

Open in CodSpeed

Footnotes

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

@robert3005
robert3005 added this pull request to stack #10770 October 24, 2026 12:37
@robert3005
robert3005 force-pushed the rk/split-array-06-scalar-fns branch 4 times, most recently from 0713434 to e33c436 Compare October 26, 2026 11:25
@robert3005
robert3005 force-pushed the rk/split-array-06-scalar-fns branch 4 times, most recently from 595165d to 7644dd2 Compare November 9, 2026 03:32
@robert3005
robert3005 marked this pull request as ready for review November 9, 2026 10:30
@robert3005

Copy link
Copy Markdown
Contributor Author

The follow up to this is #10768 which flips the dependency so it's vortex-array -> vortex-expr -> vortex-functions and then #10769

@robert3005
robert3005 force-pushed the rk/split-array-06-scalar-fns branch 4 times, most recently from dcaa482 to 9383bb2 Compare November 10, 2026 12:55
@connortsui20 connortsui20 mentioned this pull request Nov 12, 2026
19 of 57 tasks
@robert3005
robert3005 force-pushed the rk/split-array-06-scalar-fns branch from 9383bb2 to 29fe7c3 Compare November 13, 2026 18:04
vortex-array keeps the scalar function machinery (the `ScalarFnVTable` trait,
binding, reduction, execution, the session registry and kernel registry) and
the few functions its own arrays, validity and expressions are built on:
literal, get_item, pack and select, is_null, is_not_null, not and the binary
operators, and cast, mask and fill_null, which canonical arrays apply to their
own children. That module is renamed from `scalar_fn::fns` to
`scalar_fn::builtin`, matching `ArrayBuiltins`. Select stays because get_item
reads through a selection. Every other scalar function moves to the new
`vortex-functions` crate:

- byte_length, case_when, ext_storage, list_length, list_sum, list_transform,
  merge, replace_time_zone, dynamic, dynamic_expression, stat, between, like,
  list_contains, variant_get, is_nan and zip, with their expression
  constructors in `vortex_functions::expr` (and `expr::bound`)
- the kernels and parent-reduce rules for vortex-array's encodings, including
  `Widen`'s between and zip kernels, which `vortex_functions::initialize`
  registers with a session's kernel registry
- the `ArrayBuiltins`/`ExprBuiltins` methods for the moved functions, which
  become the `ArrayFunctions`/`ExprFunctions` extension traits

`ArrayHaystack`, `LazyBitBufferBuilder`,
`DeduplicatedBuffers::{extend_from_iter, finish}`, `ListScalar::element_values`,
`is_not_null_node`, `build_row_comparator`, `merge_typed_scalar_as_variant` and
the `Widen` compute helpers become public for the moved kernels, and
`ForeignExtDType` is public under `_test-harness` for the moved tests.

The umbrella crate re-exports the moved constructors under `vortex::expr` and
the crate as `vortex::functions`. vortex-array's integration tests and benches
use vortex-functions as a dev-dependency.

The CodSpeed shard plan picks up the benchmarks that move to `vortex-functions`;
their recorded counts and durations move with them.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Ps4mp7KF5c4p66aoSoXx5j
Signed-off-by: Robert Kruszewski <robert@spiraldb.com>
@robert3005
robert3005 force-pushed the rk/split-array-06-scalar-fns branch from 29fe7c3 to a1acbe1 Compare November 17, 2026 18:37
@lwwmanning

Copy link
Copy Markdown
Contributor

Posted by Claude Opus 5.5 on Will's behalf. This is from a review of the open PR backlog.

This is mostly mechanical, so the main cost is the rebase. It conflicts with develop in many files, and it is easiest to redo in one sitting. Also:

  • The description should say why the functions move, and call out that a session built by hand loses many scalar functions unless it calls vortex_functions::initialize. That is the breaking part for callers.
  • CodSpeed reported prepare[100] at -13.6%. Please check whether that is real or noise after the rebase.

robert3005 and others added 3 commits November 22, 2026 20:45
Move the list_contains rules for Dict and RunEnd needles from develop into
vortex-functions, and update paths in code that develop added to use the
moved functions.

Signed-off-by: Robert Kruszewski <github@robertk.io>
Signed-off-by: Will Manning <will@spiraldb.com>
Co-Authored-By: Will Manning <will@spiraldb.com>
Signed-off-by: Will Manning <will@spiraldb.com>
Co-Authored-By: Will Manning <will@spiraldb.com>

@devin-ai-integration devin-ai-integration Bot 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.

Note

Newer findings are available below. Devin Review posted a newer report on this PR, in addition to the findings presented here.

🔍 Devin Review: 3 flags

Not posted on this PR by your GitHub settings — view them in Devin Review. (Configure)

Devin Review

@lwwmanning

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 22, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-23T00:06:02.270142Z 8073f00 Manual request
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

Signed-off-by: Will Manning <will@spiraldb.com>
Co-Authored-By: Will Manning <will@spiraldb.com>
Signed-off-by: Will Manning <will@spiraldb.com>
Co-Authored-By: Will Manning <will@spiraldb.com>
chatgpt-codex-connector[bot]

This comment was marked as resolved.

Signed-off-by: Will Manning <will@spiraldb.com>
Co-Authored-By: Will Manning <will@spiraldb.com>
Signed-off-by: Will Manning <will@spiraldb.com>
Co-Authored-By: Will Manning <will@spiraldb.com>
devin-ai-integration[bot]

This comment was marked as resolved.

…cycle

Signed-off-by: Will Manning <will@spiraldb.com>
Co-Authored-By: Will Manning <will@spiraldb.com>
Signed-off-by: Will Manning <will@spiraldb.com>
Co-Authored-By: Will Manning <will@spiraldb.com>
@lwwmanning

Copy link
Copy Markdown
Contributor

@codex review

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Nice work!

Reviewed commit: 8073f00451

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@lwwmanning
lwwmanning merged commit 003da62 into develop Nov 23, 2026
109 of 112 checks passed
@lwwmanning
lwwmanning deleted the rk/split-array-06-scalar-fns branch November 23, 2026 00:11
devin-ai-integration Bot pushed a commit that referenced this pull request Nov 23, 2026
Signed-off-by: Will Manning <will@spiraldb.com>
Co-Authored-By: Will Manning <will@spiraldb.com>
devin-ai-integration Bot pushed a commit that referenced this pull request Nov 23, 2026
Signed-off-by: Will Manning <will@spiraldb.com>
Co-Authored-By: Will Manning <will@spiraldb.com>
devin-ai-integration Bot pushed a commit that referenced this pull request Nov 23, 2026
Signed-off-by: Will Manning <will@spiraldb.com>
Co-Authored-By: Will Manning <will@spiraldb.com>
robert3005 pushed a commit that referenced this pull request Nov 23, 2026
Signed-off-by: Will Manning <will@spiraldb.com>
Co-Authored-By: Will Manning <will@spiraldb.com>
lwwmanning added a commit that referenced this pull request Nov 23, 2026
Develop moved the scalar functions out of vortex-array into
vortex-functions (#10762). The Variant layout was written before that
move, so this ports it: `variant_shred` and its strict and union forms
are registered by vortex-functions, the `variant_shred` expression is in
`vortex_functions::expr`, and `decode_for_repeated_extraction` moves next
to `variant_get`, because vortex-array cannot name `VariantGet`.

It also drops a second copy of `element_metadata` in the Parquet Variant
array, which the rebase onto #11505 left behind.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Signed-off-by: Will Manning <will@spiraldb.com>
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.

2 participants