pub struct NumericKernels;Expand description
Centralizes the numeric kernels applied to scalar expressions so they can be tuned without touching the surrounding table scan logic.
Implementations§
Source§impl NumericKernels
impl NumericKernels
Sourcepub fn collect_fields(expr: &ScalarExpr<FieldId>, acc: &mut FxHashSet<FieldId>)
pub fn collect_fields(expr: &ScalarExpr<FieldId>, acc: &mut FxHashSet<FieldId>)
Collect every field referenced by the scalar expression into acc.
Sourcepub fn prepare_numeric_arrays(
lfids: &[LogicalFieldId],
arrays: &[ArrayRef],
needed_fields: &FxHashSet<FieldId>,
) -> LlkvResult<NumericArrayMap>
pub fn prepare_numeric_arrays( lfids: &[LogicalFieldId], arrays: &[ArrayRef], needed_fields: &FxHashSet<FieldId>, ) -> LlkvResult<NumericArrayMap>
Ensure each referenced column is materialized as a NumericArray, casting as needed.
Sourcepub fn evaluate_value(
expr: &ScalarExpr<FieldId>,
idx: usize,
arrays: &NumericArrayMap,
) -> LlkvResult<Option<NumericValue>>
pub fn evaluate_value( expr: &ScalarExpr<FieldId>, idx: usize, arrays: &NumericArrayMap, ) -> LlkvResult<Option<NumericValue>>
Evaluate a scalar expression for the row at idx using the provided numeric arrays.
Sourcepub fn evaluate_batch(
expr: &ScalarExpr<FieldId>,
len: usize,
arrays: &NumericArrayMap,
) -> LlkvResult<ArrayRef>
pub fn evaluate_batch( expr: &ScalarExpr<FieldId>, len: usize, arrays: &NumericArrayMap, ) -> LlkvResult<ArrayRef>
Evaluate a scalar expression for every row in the batch.
Sourcepub fn evaluate_batch_simplified(
expr: &ScalarExpr<FieldId>,
len: usize,
arrays: &NumericArrayMap,
) -> LlkvResult<ArrayRef>
pub fn evaluate_batch_simplified( expr: &ScalarExpr<FieldId>, len: usize, arrays: &NumericArrayMap, ) -> LlkvResult<ArrayRef>
Evaluate a scalar expression that has already been simplified.
Sourcepub fn passthrough_column(expr: &ScalarExpr<FieldId>) -> Option<FieldId>
pub fn passthrough_column(expr: &ScalarExpr<FieldId>) -> Option<FieldId>
Returns the column referenced by an expression when it’s a direct or additive identity passthrough.
Sourcepub fn simplify(expr: &ScalarExpr<FieldId>) -> ScalarExpr<FieldId>
pub fn simplify(expr: &ScalarExpr<FieldId>) -> ScalarExpr<FieldId>
Recursively simplify the expression by folding literals and eliminating identity operations.
Sourcepub fn extract_affine(expr: &ScalarExpr<FieldId>) -> Option<AffineExpr>
pub fn extract_affine(expr: &ScalarExpr<FieldId>) -> Option<AffineExpr>
Attempts to represent the expression as scale * column + offset.
Returns None when the expression depends on multiple columns or is non-linear.
Sourcepub fn extract_affine_simplified(
expr: &ScalarExpr<FieldId>,
) -> Option<AffineExpr>
pub fn extract_affine_simplified( expr: &ScalarExpr<FieldId>, ) -> Option<AffineExpr>
Variant of [extract_affine] that assumes expr is already simplified.
Sourcepub fn apply_binary(
op: BinaryOp,
lhs: Option<NumericValue>,
rhs: Option<NumericValue>,
) -> Option<NumericValue>
pub fn apply_binary( op: BinaryOp, lhs: Option<NumericValue>, rhs: Option<NumericValue>, ) -> Option<NumericValue>
Apply an arithmetic kernel. Returns None when the computation results in a null (e.g. divide by zero).
Sourcepub fn infer_result_kind_from_types<F>(
expr: &ScalarExpr<FieldId>,
resolve_kind: &mut F,
) -> Option<NumericKind>
pub fn infer_result_kind_from_types<F>( expr: &ScalarExpr<FieldId>, resolve_kind: &mut F, ) -> Option<NumericKind>
Infer the numeric kind of an expression using only the kinds of its referenced columns.
Sourcepub fn kind_for_data_type(dtype: &DataType) -> Option<NumericKind>
pub fn kind_for_data_type(dtype: &DataType) -> Option<NumericKind>
Map an Arrow DataType to the corresponding numeric kind when supported.
Auto Trait Implementations§
impl Freeze for NumericKernels
impl RefUnwindSafe for NumericKernels
impl Send for NumericKernels
impl Sync for NumericKernels
impl Unpin for NumericKernels
impl UnwindSafe for NumericKernels
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more