Repository navigation
Move remaining expressions out of vortex-array to vortex-expr - #10768
robert3005 wants to merge 7 commits into
Conversation
d195163 to
b691d5a
Compare
Merging this PR will degrade performance by 1.54%2 warnings
Warning Please fix the performance issues or acknowledge them on CodSpeed. Performance Changes
Tip Investigate this regression by commenting 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
|
Posted by Claude Opus 5.5 on Will's behalf. @devin-ai-integration, this PR conflicts with its base, #10762, since you merged develop into #10762. Please redo the move on the current head of #10762 rather than resolving the old conflicts one by one, and keep the PR stacked on it. The open thread about |
Codex Review Summary: ✅ CompletedThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
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`. --------- Signed-off-by: Robert Kruszewski <robert@spiraldb.com> Signed-off-by: Robert Kruszewski <github@robertk.io> Signed-off-by: Will Manning <will@spiraldb.com> Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com> Co-authored-by: Will Manning <will@spiraldb.com>
10443fb to
89f09da
Compare
💡 Codex ReviewLines 193 to 194 in 10443fb When a caller installs a custom scalar-function implementation under a standard ID and then calls AGENTS.md reference: AGENTS.md:L25-L27 When a standalone user calls only AGENTS.md reference: AGENTS.md:L24-L26 ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
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>
|
Re #10768 (comment) (both items were reviewed against the pre-rebase commit
@codex review |
Signed-off-by: Will Manning <will@spiraldb.com> Co-Authored-By: Will Manning <will@spiraldb.com>
e4854c2 to
43e56a4
Compare
|
@codex review |
|
Codex Review: Didn't find any major issues. More of your lovely PRs please. Reviewed commit: ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
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". |
43e56a4 to
9e56a26
Compare
|
Should not be merged because of https://github.com/vortex-data/vortex/pull/10768/changes#r4527014415. cc @robert3005 |
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`. The shared pieces they build on (stat references, NaN guards, literal and cast stat folding) 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>
9e56a26 to
fbfa998
Compare
after #10762 we can further split expressions into vortex-expr. We flip dependency order into vortex-array → vortex-expr → vortex-functions.we need #11817 first then this is a clean move