Skip to content

Commit dae66b7

Browse files
committed
Rename RowFn batch execution types
Rename `Batch` to `RowFnExecutionArgs` and `BorrowedExecutionArgs` to `BorrowedRowFnArgs` so both names say which layer owns them. Signed-off-by: Connor Tsui <[email protected]>
1 parent 1125097 commit dae66b7

9 files changed

Lines changed: 47 additions & 47 deletions

File tree

‎vortex-array/src/scalar_fn/unstable/row/batch/args.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
//! Execution arguments paired with the metadata selected during planning.
55
//!
6-
//! [`BorrowedExecutionArgs`] can point at original or sliced arrays while retaining the dtypes,
6+
//! [`BorrowedRowFnArgs`] can point at original or sliced arrays while retaining the dtypes,
77
//! output dtype, and execution policy of the original batch plan.
88
99
use vortex_error::VortexResult;
@@ -20,7 +20,7 @@ use crate::scalar_fn::ExecutionArgs;
2020
/// batch. Keeping them together prevents an execution path from pairing an input view with
2121
/// unrelated planning metadata.
2222
#[derive(Clone, Copy)]
23-
pub(crate) struct BorrowedExecutionArgs<'a> {
23+
pub(crate) struct BorrowedRowFnArgs<'a> {
2424
/// The input arrays for this row-function invocation.
2525
arrays: &'a [ArrayRef],
2626

@@ -37,7 +37,7 @@ pub(crate) struct BorrowedExecutionArgs<'a> {
3737
policy: RowPolicy,
3838
}
3939

40-
impl<'a> BorrowedExecutionArgs<'a> {
40+
impl<'a> BorrowedRowFnArgs<'a> {
4141
/// Pair one input view with the planning metadata selected for its batch.
4242
pub(crate) fn new(
4343
arrays: &'a [ArrayRef],
@@ -71,7 +71,7 @@ impl<'a> BorrowedExecutionArgs<'a> {
7171
}
7272
}
7373

74-
impl ExecutionArgs for BorrowedExecutionArgs<'_> {
74+
impl ExecutionArgs for BorrowedRowFnArgs<'_> {
7575
fn get(&self, index: usize) -> VortexResult<ArrayRef> {
7676
self.arrays.get(index).cloned().ok_or_else(|| {
7777
vortex_err!(

‎vortex-array/src/scalar_fn/unstable/row/batch/execute/constant.rs‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,18 +4,18 @@
44
use smallvec::SmallVec;
55
use vortex_error::VortexResult;
66

7-
use super::super::Batch;
8-
use super::super::args::BorrowedExecutionArgs;
7+
use super::super::RowFnExecutionArgs;
8+
use super::super::args::BorrowedRowFnArgs;
99
use crate::ArrayRef;
1010
use crate::ExecutionCtx;
1111
use crate::IntoArray;
1212
use crate::arrays::ConstantArray;
1313

14-
impl Batch {
14+
impl RowFnExecutionArgs {
1515
/// Execute all-constant inputs by evaluating one row and broadcasting the validated result.
1616
pub(super) fn execute_all_constant(
1717
&self,
18-
kernel: impl Fn(BorrowedExecutionArgs<'_>, &mut ExecutionCtx) -> VortexResult<ArrayRef>,
18+
kernel: impl Fn(BorrowedRowFnArgs<'_>, &mut ExecutionCtx) -> VortexResult<ArrayRef>,
1919
ctx: &mut ExecutionCtx,
2020
) -> VortexResult<ArrayRef> {
2121
let one_row: SmallVec<[ArrayRef; 4]> = self

‎vortex-array/src/scalar_fn/unstable/row/batch/execute/dense.rs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,18 +3,18 @@
33

44
use vortex_error::VortexResult;
55

6-
use super::super::Batch;
7-
use super::super::args::BorrowedExecutionArgs;
6+
use super::super::RowFnExecutionArgs;
7+
use super::super::args::BorrowedRowFnArgs;
88
use crate::ArrayRef;
99
use crate::ExecutionCtx;
1010
use crate::builtins::ArrayBuiltins;
1111
use crate::validity::Validity;
1212

13-
impl Batch {
13+
impl RowFnExecutionArgs {
1414
/// Run every stored payload, then attach the input validity without materializing its mask.
1515
pub(super) fn execute_dense(
1616
&self,
17-
kernel: impl Fn(BorrowedExecutionArgs<'_>, &mut ExecutionCtx) -> VortexResult<ArrayRef>,
17+
kernel: impl Fn(BorrowedRowFnArgs<'_>, &mut ExecutionCtx) -> VortexResult<ArrayRef>,
1818
ctx: &mut ExecutionCtx,
1919
) -> VortexResult<ArrayRef> {
2020
let values = kernel(self.execution_args(&self.inputs, self.row_count), ctx)?;
@@ -25,7 +25,7 @@ impl Batch {
2525
self.finalize_output(values, self.row_count)
2626
}
2727
Validity::Array(valid) => self.finalize_output(values.mask(valid)?, self.row_count),
28-
// Handled by the guard in `Batch::execute`, before the kernel ran.
28+
// Handled by the guard in `RowFnExecutionArgs::execute`, before the kernel ran.
2929
Validity::AllInvalid => Ok(self.all_null()),
3030
}
3131
}

‎vortex-array/src/scalar_fn/unstable/row/batch/execute/mod.rs‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,15 +3,15 @@
33

44
//! Selects a batch execution strategy.
55
//!
6-
//! [`Batch::execute`] handles universal fast paths, then delegates to dense or valid-only
7-
//! execution.
6+
//! [`RowFnExecutionArgs::execute`] handles universal fast paths, then delegates to dense or
7+
//! valid-only execution.
88
99
use vortex_error::VortexResult;
1010
use vortex_mask::Mask;
1111

12-
use super::Batch;
12+
use super::RowFnExecutionArgs;
1313
use super::RowPolicy;
14-
use super::args::BorrowedExecutionArgs;
14+
use super::args::BorrowedRowFnArgs;
1515
use crate::ArrayRef;
1616
use crate::ExecutionCtx;
1717
use crate::arrays::Constant;
@@ -26,16 +26,16 @@ mod output;
2626
#[cfg(test)]
2727
pub(crate) use output::finalize_kernel_output;
2828

29-
impl Batch {
29+
impl RowFnExecutionArgs {
3030
/// Apply constant folding and null handling around `kernel`.
3131
///
3232
/// For a partially valid batch, `try_valid_rows` executes only valid rows over the original
3333
/// inputs. Every result is checked against the planned shape and dtype.
3434
pub(crate) fn execute(
3535
&self,
36-
kernel: impl Fn(BorrowedExecutionArgs<'_>, &mut ExecutionCtx) -> VortexResult<ArrayRef>,
36+
kernel: impl Fn(BorrowedRowFnArgs<'_>, &mut ExecutionCtx) -> VortexResult<ArrayRef>,
3737
try_valid_rows: impl FnOnce(
38-
BorrowedExecutionArgs<'_>,
38+
BorrowedRowFnArgs<'_>,
3939
&Mask,
4040
&mut ExecutionCtx,
4141
) -> VortexResult<Option<ArrayRef>>,

‎vortex-array/src/scalar_fn/unstable/row/batch/execute/output.rs‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ use vortex_error::VortexResult;
55
use vortex_error::vortex_ensure;
66
use vortex_error::vortex_ensure_eq;
77

8-
use super::super::Batch;
8+
use super::super::RowFnExecutionArgs;
99
use crate::ArrayRef;
1010
use crate::ExecutionCtx;
1111
use crate::IntoArray;
@@ -15,7 +15,7 @@ use crate::dtype::DType;
1515
use crate::scalar::Scalar;
1616
use crate::scalar_fn::ScalarFnId;
1717

18-
impl Batch {
18+
impl RowFnExecutionArgs {
1919
pub(super) fn all_null(&self) -> ArrayRef {
2020
ConstantArray::new(Scalar::null(self.result_dtype.clone()), self.row_count).into_array()
2121
}

‎vortex-array/src/scalar_fn/unstable/row/batch/execute/valid_only.rs‎

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ use vortex_error::VortexResult;
55
use vortex_error::vortex_panic;
66
use vortex_mask::Mask;
77

8-
use super::super::Batch;
9-
use super::super::args::BorrowedExecutionArgs;
8+
use super::super::RowFnExecutionArgs;
9+
use super::super::args::BorrowedRowFnArgs;
1010
use crate::ArrayRef;
1111
use crate::ExecutionCtx;
1212
use crate::IntoArray;
@@ -23,7 +23,7 @@ enum ResolvedValidity {
2323
PartiallyValid(Mask),
2424
}
2525

26-
impl Batch {
26+
impl RowFnExecutionArgs {
2727
/// Resolve validity, then execute valid rows over the original inputs.
2828
///
2929
/// # Panics
@@ -32,9 +32,9 @@ impl Batch {
3232
/// support null-tolerant decoding, and output sinks must initialize skipped rows.
3333
pub(super) fn execute_valid_only(
3434
&self,
35-
kernel: impl Fn(BorrowedExecutionArgs<'_>, &mut ExecutionCtx) -> VortexResult<ArrayRef>,
35+
kernel: impl Fn(BorrowedRowFnArgs<'_>, &mut ExecutionCtx) -> VortexResult<ArrayRef>,
3636
try_valid_rows: impl FnOnce(
37-
BorrowedExecutionArgs<'_>,
37+
BorrowedRowFnArgs<'_>,
3838
&Mask,
3939
&mut ExecutionCtx,
4040
) -> VortexResult<Option<ArrayRef>>,
@@ -58,14 +58,14 @@ impl Batch {
5858
/// Materialize validity and handle all-valid or all-null batches.
5959
fn resolve_validity(
6060
&self,
61-
kernel: &impl Fn(BorrowedExecutionArgs<'_>, &mut ExecutionCtx) -> VortexResult<ArrayRef>,
61+
kernel: &impl Fn(BorrowedRowFnArgs<'_>, &mut ExecutionCtx) -> VortexResult<ArrayRef>,
6262
ctx: &mut ExecutionCtx,
6363
) -> VortexResult<ResolvedValidity> {
6464
let valid = self.validity.clone().execute_mask(self.row_count, ctx)?;
6565

6666
// An array-backed validity can materialize to all valid even though the cheap checks in
67-
// `Batch::execute` could not prove that. Run the full-row kernel in that case. Check
68-
// all-true before all-false because an empty mask is both.
67+
// `RowFnExecutionArgs::execute` could not prove that. Run the full-row kernel in that
68+
// case. Check all-true before all-false because an empty mask is both.
6969
if valid.all_true() {
7070
let values = kernel(self.execution_args(&self.inputs, self.row_count), ctx)?;
7171
let values = self.validate_kernel_output(values, self.row_count, ctx)?;
@@ -85,7 +85,7 @@ impl Batch {
8585
fn try_execute_valid_rows(
8686
&self,
8787
try_valid_rows: impl FnOnce(
88-
BorrowedExecutionArgs<'_>,
88+
BorrowedRowFnArgs<'_>,
8989
&Mask,
9090
&mut ExecutionCtx,
9191
) -> VortexResult<Option<ArrayRef>>,

‎vortex-array/src/scalar_fn/unstable/row/batch/mod.rs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
//! propagating strict validity, selecting an execution strategy, and validating the finished
1010
//! output.
1111
//!
12-
//! [`BatchPlan`] carries the nullable execution strategy selected by a concrete dispatch. [`Batch`]
13-
//! applies that strategy, and [`BorrowedExecutionArgs`] pairs each kernel invocation with its
14-
//! planning metadata.
12+
//! [`BatchPlan`] carries the nullable execution strategy selected by a concrete dispatch.
13+
//! [`RowFnExecutionArgs`] applies that strategy, and [`BorrowedRowFnArgs`] pairs each kernel
14+
//! invocation with its planning metadata.
1515
1616
use smallvec::SmallVec;
1717

@@ -21,7 +21,7 @@ use crate::scalar_fn::ScalarFnId;
2121
use crate::validity::Validity;
2222

2323
mod args;
24-
pub(super) use args::BorrowedExecutionArgs;
24+
pub(super) use args::BorrowedRowFnArgs;
2525

2626
mod execute;
2727
#[cfg(test)]
@@ -33,7 +33,7 @@ pub(super) use super::visitor::BatchPlan;
3333
pub(super) use super::visitor::RowPolicy;
3434

3535
/// The same-length input columns and metadata for one row-function execution.
36-
pub(crate) struct Batch {
36+
pub(crate) struct RowFnExecutionArgs {
3737
/// The function being executed, named in the errors this raises.
3838
id: ScalarFnId,
3939

‎vortex-array/src/scalar_fn/unstable/row/batch/planning.rs‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -5,16 +5,16 @@ use smallvec::SmallVec;
55
use vortex_error::VortexResult;
66
use vortex_error::vortex_ensure_eq;
77

8-
use super::Batch;
98
use super::BatchPlan;
10-
use super::args::BorrowedExecutionArgs;
9+
use super::RowFnExecutionArgs;
10+
use super::args::BorrowedRowFnArgs;
1111
use crate::ArrayRef;
1212
use crate::dtype::DType;
1313
use crate::scalar_fn::ExecutionArgs;
1414
use crate::scalar_fn::ScalarFnId;
1515
use crate::validity::Validity;
1616

17-
impl Batch {
17+
impl RowFnExecutionArgs {
1818
/// Collect the inputs and derive their dtypes, validity, and execution policy.
1919
///
2020
/// This constructor **must not** be used for a nullary function. With no input columns, there
@@ -65,8 +65,8 @@ impl Batch {
6565
&'b self,
6666
arrays: &'b [ArrayRef],
6767
row_count: usize,
68-
) -> BorrowedExecutionArgs<'b> {
69-
BorrowedExecutionArgs::new(
68+
) -> BorrowedRowFnArgs<'b> {
69+
BorrowedRowFnArgs::new(
7070
arrays,
7171
row_count,
7272
&self.arg_dtypes,

‎vortex-array/src/scalar_fn/unstable/row/vtable.rs‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ use vortex_error::vortex_ensure_eq;
1414
use vortex_mask::Mask;
1515
use vortex_session::VortexSession;
1616

17-
use super::batch::Batch;
18-
use super::batch::BorrowedExecutionArgs;
17+
use super::batch::BorrowedRowFnArgs;
18+
use super::batch::RowFnExecutionArgs;
1919
use super::row_fn::RowFn;
2020
use super::visitor::BatchPlanner;
2121
use super::visitor::ExecuteRows;
@@ -139,7 +139,7 @@ fn ensure_arity<F: RowFn>(function: &F, actual: usize) -> VortexResult<()> {
139139
fn execute_row_kernel<F: RowFn>(
140140
function: &F,
141141
options: &F::Options,
142-
args: BorrowedExecutionArgs<'_>,
142+
args: BorrowedRowFnArgs<'_>,
143143
ctx: &mut ExecutionCtx,
144144
) -> VortexResult<ArrayRef> {
145145
function.dispatch(
@@ -159,7 +159,7 @@ fn execute_row_kernel<F: RowFn>(
159159
fn try_execute_valid_rows<F: RowFn>(
160160
function: &F,
161161
options: &F::Options,
162-
args: BorrowedExecutionArgs<'_>,
162+
args: BorrowedRowFnArgs<'_>,
163163
valid: &Mask,
164164
ctx: &mut ExecutionCtx,
165165
) -> VortexResult<Option<ArrayRef>> {
@@ -182,8 +182,8 @@ fn prepare_batch<F: RowFn>(
182182
function: &F,
183183
options: &F::Options,
184184
args: &dyn ExecutionArgs,
185-
) -> VortexResult<Batch> {
186-
Batch::new(RowFn::id(function), args, |arg_dtypes| {
185+
) -> VortexResult<RowFnExecutionArgs> {
186+
RowFnExecutionArgs::new(RowFn::id(function), args, |arg_dtypes| {
187187
function.dispatch(
188188
options,
189189
arg_dtypes,

0 commit comments

Comments
 (0)