Repository navigation
Move remaining expressions out of vortex-array to vortex-expr - #10768
Conversation
d195163 to
b691d5a
Compare
Merging this PR will improve performance by 16.34%1 warning
Performance Changes
Tip Curious why performance improved? Comment Comparing Footnotes
|
06bffcd to
137c718
Compare
b691d5a to
e57d7c2
Compare
137c718 to
0713434
Compare
e57d7c2 to
d8a74d2
Compare
0713434 to
e33c436
Compare
d8a74d2 to
123df13
Compare
595165d to
7644dd2
Compare
123df13 to
49d5a26
Compare
7644dd2 to
6814544
Compare
49d5a26 to
2e0ca58
Compare
6814544 to
1173f1a
Compare
2e0ca58 to
7ffa022
Compare
1173f1a to
dcaa482
Compare
ba6a3ba to
7c10fd1
Compare
dcaa482 to
9383bb2
Compare
7c10fd1 to
2d59169
Compare
5149a2f to
6ee5292
Compare
Expressions are about to move out of vortex-array into vortex-expr, which means vortex-functions (whose scalar functions construct expressions) has to sit above vortex-expr rather than below it. This commit flips the dependency without moving the expression types yet: - `select` returns to vortex-array's core builtins. The field-path analyses in vortex-expr (`referenced_field_paths`, immediate access) narrow through it alongside `get_item`, so it is part of the projection machinery those analyses are built on, like `get_item` and `pack`. - `StatFn` moves from vortex-functions into `vortex_expr::stats::stat_fn`, registered by the new `vortex_expr::initialize`. - The stats rewrite rules for `between`, `is_nan`, `like`, `list_contains`, `dynamic` and `dynamic_expression` move into `vortex_functions::pruning`, registered by `vortex_functions::initialize`, along with the `lower` stat derivation. The shared pieces they build on (stat references and NaN guards) become the public `vortex_expr::stats::rewrite::helpers` module. - `find_between` moves next to the `between` function it targets. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ps4mp7KF5c4p66aoSoXx5j Signed-off-by: Will Manning <will@spiraldb.com> Co-Authored-By: Will Manning <will@spiraldb.com> Signed-off-by: Robert Kruszewski <robert@spiraldb.com>
Unbound `Expression`, binding, traversal, lambdas, proto serialization and the expression constructors now live in `vortex-expr`; `vortex-array` keeps arrays, the scalar function machinery, the builtins it is built on, and `BoundExpression` with its reduce node and optimizer. The scalar function vtable reduces over bound expressions, so keeping them next to it lets every reduction rule stay monomorphized for expression trees as well as array trees. `vortex-expr` re-exports `BoundExpression`. The layering is `vortex-array -> vortex-expr -> vortex-functions`. - `ScalarFnVTable::simplify` is generic over `ReduceNode`, like `reduce`, but stays a separate hook that only the expression optimizer applies: a simplification may rewrite a node into one whose nullability differs, which the array optimizer cannot accept (it must keep the exact dtype and defer constant masks to the kernel rules). `ReduceNode::is_same` lets rules such as the COALESCE rewrite compare operands. - `new_expr`, `try_new_expr` and `try_new_bound_expr` move to `vortex_expr::ScalarFnExprExt`, `ArrayRef::apply`/`apply_bound` to `vortex_expr::ArrayExprExt`, and the expression half of the builtins to `vortex_expr::ExprBuiltins`. `ExprDisplay` moves to `vortex_array::scalar_fn::display`, and the tree renderer to `vortex_array::expr::display`. - `ArrayRef::take_slot_unchecked`/`put_slot_unchecked` become public, like `with_slots`, so row-count substitution in `vortex-expr` still rewrites lazy arrays in place. `vortex_array::expr` otherwise keeps only `stats`, which moves with the aggregate split. The core builtins' expression-level tests move to `vortex-expr`; the few array-level tests that used expressions now go through `ArrayBuiltins`. The `expr_*` benches move to `vortex-expr`, and their CodSpeed counts and durations move with them. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com> Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ps4mp7KF5c4p66aoSoXx5j Signed-off-by: Will Manning <will@spiraldb.com> Co-Authored-By: Will Manning <will@spiraldb.com> Signed-off-by: Robert Kruszewski <robert@spiraldb.com>
`select` and `is_null` are not needed by vortex-array's own arrays, so they move to vortex-functions with their constructors, builder methods (`ArrayFunctions::is_null`, `ExprFunctions::is_null`), tests and pruning rewrites (`vortex_functions::pruning`). `not` stays in vortex-array, because validity inversion and the `sum_v2` aggregate negate arrays lazily. - `get_item` read through `select` by naming it. It now asks its child through the new `ScalarFnVTable::forwarded_field` hook, which reports the child whose field an output field passes through unchanged. `select` implements it, so `get_item(select(x))` still reduces to `get_item(x)` for arrays and expressions. - `IsNull` and `IsNotNull` share the and/or null-check reduction through the public `reduce_null_check`; each passes its own nested check. - The field-access analyses `referenced_field_paths` and `make_bound_free_field_annotator`, which look through `select`, move from vortex-expr to `vortex_layout::analysis`, next to the scans that use them. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ps4mp7KF5c4p66aoSoXx5j Signed-off-by: Will Manning <will@spiraldb.com> Co-Authored-By: Will Manning <will@spiraldb.com> Signed-off-by: Robert Kruszewski <robert@spiraldb.com>
…ex_array::stats `Stat`, `Precision`, the stat bounds and the `StatsProvider` traits describe the statistics every array carries, not expressions, so they join the per-array statistics cache (`ArrayStats`, `StatsSet`) in `vortex_array::stats`. `vortex_array::expr` now holds only `BoundExpression` and its optimizer. Callers move from `vortex_array::expr::stats` to `vortex_array::stats`. The umbrella crate's `vortex::expr::stats` keeps re-exporting the statistics vocabulary alongside vortex-expr's stat expressions. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Ps4mp7KF5c4p66aoSoXx5j Signed-off-by: Will Manning <will@spiraldb.com> Co-Authored-By: Will Manning <will@spiraldb.com> Signed-off-by: Robert Kruszewski <robert@spiraldb.com>
Signed-off-by: Will Manning <will@spiraldb.com> Co-Authored-By: Will Manning <will@spiraldb.com>
Only fuse range comparisons into Between during scan preparation when the session has a stats rewrite registered for Between, preserving zone-map pruning on minimal sessions that have not called vortex_functions::initialize. Also restore the empty-constant-chunk is_null regression test in vortex-functions and update the vortex-functions crate doc for select. 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>
Code that #11818 added on develop still named expressions through `vortex_array::expr` and the removed `binary` builder. Point it at vortex-expr, re-export `compare`, `boolean` and `numeric` from vortex-expr, and give vortex-fastlanes' list_contains tests a vortex-expr dev-dependency. 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>
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>
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>
6ee5292 to
c4aa9dd
Compare
Polar Signals Profiling ResultsLatest Run
Powered by Polar Signals Cloud |
Benchmarks: PolarSignals Profiling 📖Commits: PR Hot runs: geomean 0.978x ➖ · 13 queries × 1 target (2↑ 0↓)Each cell is develop
Cold runs (first iteration): geomean 1.002x ➖ · 13 queries × 1 target (0↑ 0↓)
No file size changes detected. |
Benchmarks: TPC-DS SF=1 on NVME 📖Commits: PR How to read Verdict and Engines
Hot runs: geomean 1.003x ➖ · 99 queries × 4 targets (1↑ 1↓)Each cell is develop
Cold runs (first iteration): geomean 1.011x ➖ · 99 queries × 4 targets (1↑ 1↓)
No file size changes detected. |
Benchmarks: TPC-H SF=1 on S3 📖Commits: PR How to read Verdict and Engines
Hot runs: geomean 0.958x ➖ · 22 queries × 4 targets (6↑ 5↓)Each cell is develop
Cold runs (first iteration): geomean 0.967x ➖ · 22 queries × 4 targets (5↑ 6↓)
|
Benchmarks: FineWeb NVMe 📖Commits: PR How to read Verdict and Engines
Hot runs: geomean 1.002x ➖ · 9 queries × 4 targets (0↑ 0↓)Each cell is develop
Cold runs (first iteration): geomean 0.981x ➖ · 9 queries × 4 targets (0↑ 1↓)
No file size changes detected. |
Benchmarks: TPC-DS SF=10 on NVME 📖Commits: PR How to read Verdict and Engines
Hot runs: geomean 0.897x 🟢 · 99 queries × 4 targets (130↑ 1↓)Each cell is develop
Cold runs (first iteration): geomean 0.937x ➖ · 99 queries × 4 targets (85↑ 7↓)
No file size changes detected. |
Benchmarks: Clickbench on NVME 📖Commits: PR How to read Verdict and Engines
Hot runs: geomean 0.997x ➖ · 43 queries × 4 targets (0↑ 1↓)Each cell is develop
Cold runs (first iteration): geomean 0.997x ➖ · 43 queries × 4 targets (1↑ 2↓)
No file size changes detected. |
Benchmarks: TPC-H SF=10 on NVME 📖Commits: PR How to read Verdict and Engines
Hot runs: geomean 0.999x ➖ · 22 queries × 4 targets (0↑ 0↓)Each cell is develop
Cold runs (first iteration): geomean 1.003x ➖ · 22 queries × 4 targets (0↑ 2↓)
No file size changes detected. |
Benchmarks: TPC-H SF=1 on NVME 📖Commits: PR How to read Verdict and Engines
Hot runs: geomean 1.003x ➖ · 22 queries × 4 targets (1↑ 2↓)Each cell is develop
Cold runs (first iteration): geomean 1.049x ➖ · 22 queries × 4 targets (0↑ 12↓)
No file size changes detected. |
Signed-off-by: Will Manning <will@spiraldb.com> Co-Authored-By: Will Manning <will@spiraldb.com>
After vortex-data#10768 split `vortex.binary` into `vortex.compare`, `vortex.boolean` and `vortex.numeric`, a `LegacyBinary` plugin stayed behind only to load expressions serialized with the old id. This removes that reader, its registration and test, and the `BinaryOpts` proto message, leaving `binary.rs` with just the helpers the three functions share. Breaking: expressions serialized with the `vortex.binary` id no longer deserialize. Releases through 0.93.0 wrote that ID. Version 0.94.0 already writes the split IDs and its expressions continue to deserialize. Vortex files do not store these expressions. OpenAI Codex assisted with the PR update. Signed-off-by: Robert Kruszewski <robert@spiraldb.com> Signed-off-by: Robert Kruszewski <github@robertk.io> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This continues the split started in #10762 so crates that only need arrays can build without the expression construction, analysis, and serialization layer.
BoundExpressionstays invortex-arraybecause scalar function reduction operates on bound expressions. Optional scalar functions depend onvortex-exprand register their own pruning rules.Direct users of
vortex-arrayshould move imports for the relocated expression APIs tovortex-expr. Hand-built sessions needvortex_expr::initializeto registerStatFnandvortex_functions::initializefor function-specific pruning, including DataFusion dynamic join pruning. The default Vortex session calls both.