Deprecate vortex-array public APIs that use the hidden LEGACY_SESSION#8269
Deprecate vortex-array public APIs that use the hidden LEGACY_SESSION#8269joseph-isaacs wants to merge 6 commits into
Conversation
These public methods construct an execution context from the hidden global `LEGACY_SESSION` static instead of taking an explicit `ExecutionCtx`. Mark them `#[deprecated]` so callers migrate to the context-threading APIs: - `BoolTyped::true_count` - `PrimitiveTyped::value` - `PrimitiveTyped::value_unchecked` - `from_arrow_array_with_len` Internal callers within `vortex-array` are annotated with `#[allow(deprecated)]` (mirroring the existing `IntoArrowArray` deprecation) so the crate continues to build cleanly while the deprecation surfaces at downstream call sites. Signed-off-by: Claude <noreply@anthropic.com>
The new `#[deprecated]` on `BoolTyped::true_count` made the workspace lint job (`check`, `clippy-all`, `clippy-default`) fail under `-D warnings` because `datetime-parts` and `onpair` tests still call it. Annotate those test modules with `#[allow(deprecated)]` so CI stays green; migrating them to `sum(array, ctx)` is left for the broader follow-up that removes the hidden static. Signed-off-by: Claude <noreply@anthropic.com>
Merging this PR will improve performance by 25.34%
|
| Mode | Benchmark | BASE |
HEAD |
Efficiency | |
|---|---|---|---|---|---|
| ⚡ | Simulation | chunked_bool_canonical_into[(1000, 10)] |
46.6 µs | 31.9 µs | +46.42% |
| ⚡ | Simulation | bitwise_not_vortex_buffer_mut[128] |
275.3 ns | 216.9 ns | +26.89% |
| ⚡ | Simulation | chunked_varbinview_canonical_into[(1000, 10)] |
198.2 µs | 162 µs | +22.38% |
| ⚡ | Simulation | bitwise_not_vortex_buffer_mut[1024] |
336.9 ns | 278.6 ns | +20.94% |
| ⚡ | Simulation | chunked_varbinview_into_canonical[(1000, 10)] |
213.7 µs | 177.4 µs | +20.5% |
| ⚡ | Simulation | bitwise_not_vortex_buffer_mut[2048] |
400.6 ns | 342.2 ns | +17.05% |
Tip
Curious why this is faster? Comment @codspeedbot explain why this is faster on this PR, or directly use the CodSpeed MCP with your agent.
Comparing claude/sweet-sagan-GoHjV (94eae41) with develop (5e3aedb)
Instead of silencing the `BoolTyped::true_count` deprecation with `#[allow(deprecated)]`, drop the deprecated call entirely in the `datetime-parts` and `onpair` tests. Each now counts true values via `sum(array, ctx)` with an explicit `ExecutionCtx`: - `datetime-parts` compare/rules tests gain a small `true_count` helper that builds the context from `LEGACY_SESSION` (matching the surrounding tests). - The `onpair` smoke test reuses its existing empty-`SESSION` context. This removes the last downstream uses of the deprecated API. Verified with `RUSTFLAGS="-D deprecated" cargo build --all-targets` and by running both crates' tests. Signed-off-by: Claude <noreply@anthropic.com>
connortsui20
left a comment
There was a problem hiding this comment.
use expect deprecated and maybe add a reason for each?
| /// Count the true values in a boolean array using an explicit execution context. | ||
| fn true_count(array: &ArrayRef) -> usize { |
There was a problem hiding this comment.
this is a test-only function, but it doesn't do what the comment says it does
There was a problem hiding this comment.
I don't see the problem with this test the ctx is explicit to this test module not hidden in the true count
There was a problem hiding this comment.
Agreed — done in f8e0ae8. true_count now takes ctx: &mut ExecutionCtx, and each test constructs the context explicitly (LEGACY_SESSION.create_execution_ctx()) before calling it, so the ctx is visible in the test rather than hidden in the helper. Also updated the doc comment to say "the provided execution context".
Generated by Claude Code
| } | ||
|
|
||
| /// Count the true values in a boolean array using an explicit execution context. | ||
| fn true_count(array: &ArrayRef) -> usize { |
| /// The provided array must have length | ||
| #[deprecated( | ||
| note = "Relies on the hidden global `LEGACY_SESSION`; thread an explicit `ExecutionCtx` through `execute_scalar` instead" | ||
| )] |
There was a problem hiding this comment.
I think the note is wrong here?
There was a problem hiding this comment.
Good catch — updated in 94eae41 to point at the actual replacement: note = "Relies on the hidden global LEGACY_SESSION; use from_arrow_columnar with an explicit ExecutionCtx instead".
Generated by Claude Code
Address review feedback: don't create the execution context inside the `true_count` test helper. The helper now takes `ctx: &mut ExecutionCtx`, and each test constructs the context explicitly (via `LEGACY_SESSION`) before calling it, matching the explicit-context pattern used by `from_arrow_columnar`. Signed-off-by: Claude <noreply@anthropic.com>
The replacement is the new `from_arrow_columnar` (which takes an explicit `ExecutionCtx`), so name it in the deprecation note instead of the vaguer "thread an ExecutionCtx through execute_scalar". Signed-off-by: Claude <noreply@anthropic.com>
Summary
Several public
vortex-arraymethods construct anExecutionCtxfrom the hidden globalLEGACY_SESSIONstatic instead of accepting an explicitExecutionCtx. This PR marks them#[deprecated]so downstream callers migrate to the context-threading APIs (matching the existingIntoArrowArraydeprecation pattern).Deprecated public APIs
BoolTyped::true_countvortex-array/src/variants.rssum(array, ctx)with an explicitExecutionCtxPrimitiveTyped::valuevortex-array/src/variants.rsis_valid/execute_scalarwith an explicitExecutionCtxPrimitiveTyped::value_uncheckedvortex-array/src/variants.rsexecute_scalarwith an explicitExecutionCtxfrom_arrow_array_with_lenvortex-array/src/arrow/datum.rsExecutionCtxthroughexecute_scalarEach carries a
#[deprecated(note = …)]explaining why and what to use instead.