pub trait ElementTuple: 'static + Sealed {
type Columns;
type Views<'a>: ViewLen;
type Elems<'a>;
type ConstElems<'a>;
const ARITY: usize;
const DENSE_SAFE: bool;
const DECODE_INFALLIBLE: bool;
// Required methods
fn validate(dtypes: &[DType]) -> VortexResult<()>;
fn decode(
args: &dyn ExecutionArgs,
ctx: &mut ExecutionCtx,
) -> VortexResult<Self::Columns>;
fn can_decode_null_tolerant(args: &dyn ExecutionArgs) -> VortexResult<bool>;
fn decode_null_tolerant(
args: &dyn ExecutionArgs,
ctx: &mut ExecutionCtx,
) -> VortexResult<Option<Self::Columns>>;
fn get(columns: &Self::Columns, index: usize) -> Self::Elems<'_>;
fn views_if_no_consts(columns: &Self::Columns) -> Option<Self::Views<'_>>;
fn view_lens_match(views: &Self::Views<'_>, row_count: usize) -> bool;
fn decoded_lens_match(columns: &Self::Columns, row_count: usize) -> bool;
fn get_from_views<'a>(
views: &Self::Views<'a>,
index: usize,
) -> Self::Elems<'a>;
unsafe fn get_from_views_unchecked<'a>(
views: &Self::Views<'a>,
index: usize,
) -> Self::Elems<'a>;
fn const_values(columns: &Self::Columns) -> Self::ConstElems<'_>;
}Expand description
Typed argument tuples for arities zero through twelve.
This trait is sealed. Add a new row representation by implementing InputElement and placing
it in one of the supplied tuples.
Required Associated Constants§
Sourceconst DENSE_SAFE: bool
const DENSE_SAFE: bool
Whether every argument is InputElement::DENSE_SAFE.
Sourceconst DECODE_INFALLIBLE: bool
const DECODE_INFALLIBLE: bool
Whether every argument is InputElement::DECODE_INFALLIBLE.
Required Associated Types§
Sourcetype ConstElems<'a>
type ConstElems<'a>
The batch-constant element values.
Some carries the value of a batch-constant argument. None marks an argument decoded at
full batch length. A RowVisitor passes these values to its prepare closure so constant
work can leave the row loop.
Required Methods§
Sourcefn validate(dtypes: &[DType]) -> VortexResult<()>
fn validate(dtypes: &[DType]) -> VortexResult<()>
Validate the input dtypes and exact arity.
Sourcefn decode(
args: &dyn ExecutionArgs,
ctx: &mut ExecutionCtx,
) -> VortexResult<Self::Columns>
fn decode( args: &dyn ExecutionArgs, ctx: &mut ExecutionCtx, ) -> VortexResult<Self::Columns>
Decode every input column once for one row-kernel invocation.
Sourcefn can_decode_null_tolerant(args: &dyn ExecutionArgs) -> VortexResult<bool>
fn can_decode_null_tolerant(args: &dyn ExecutionArgs) -> VortexResult<bool>
Whether every input can be decoded without assuming that all rows are valid.
The tuple checks this before decoding any column, so a decline does not discard work from earlier arguments.
Sourcefn decode_null_tolerant(
args: &dyn ExecutionArgs,
ctx: &mut ExecutionCtx,
) -> VortexResult<Option<Self::Columns>>
fn decode_null_tolerant( args: &dyn ExecutionArgs, ctx: &mut ExecutionCtx, ) -> VortexResult<Option<Self::Columns>>
Decode every input column once while tolerating null rows.
Return Ok(None) when an argument has no null-tolerant representation. Valid-row execution
calls this once per batch.
Sourcefn get(columns: &Self::Columns, index: usize) -> Self::Elems<'_>
fn get(columns: &Self::Columns, index: usize) -> Self::Elems<'_>
Read the row of elements at index. Must be O(1): it is called in the row loop.
Each argument selects either its batch-constant value or row index. Keep that selection
visible in the loop so LLVM can unswitch it before vectorizing.
Sourcefn views_if_no_consts(columns: &Self::Columns) -> Option<Self::Views<'_>>
fn views_if_no_consts(columns: &Self::Columns) -> Option<Self::Views<'_>>
Borrow the decoded columns only when no argument is batch-constant.
Returns None if any argument is batch-constant. Otherwise, omitting ArgColumn from the
returned tuple removes batch-constant checks from the row loop.
Sourcefn view_lens_match(views: &Self::Views<'_>, row_count: usize) -> bool
fn view_lens_match(views: &Self::Views<'_>, row_count: usize) -> bool
Whether every borrowed view contains exactly row_count rows.
Executors must validate each retained view before unchecked traversal. ViewLen::len on
a tuple asserts that component lengths are equal and panics on a mismatch. Rebuilding views
from Columns does not prove the lengths of the views passed to
get_from_views_unchecked.
Sourcefn decoded_lens_match(columns: &Self::Columns, row_count: usize) -> bool
fn decoded_lens_match(columns: &Self::Columns, row_count: usize) -> bool
Whether every argument decoded at full batch length contains exactly row_count rows.
Columns cannot implement ViewLen because a batch-constant ArgColumn stores one
decoded row while logically addressing the full batch. The batch-constant constructor
validates that one-row representation, so this method checks only non-constant columns.
Sourcefn get_from_views<'a>(views: &Self::Views<'a>, index: usize) -> Self::Elems<'a>
fn get_from_views<'a>(views: &Self::Views<'a>, index: usize) -> Self::Elems<'a>
Read one row from borrowed views.
Sourceunsafe fn get_from_views_unchecked<'a>(
views: &Self::Views<'a>,
index: usize,
) -> Self::Elems<'a>
unsafe fn get_from_views_unchecked<'a>( views: &Self::Views<'a>, index: usize, ) -> Self::Elems<'a>
Read one row from borrowed views without checking bounds.
§Safety
index must be in bounds for every column.
Sourcefn const_values(columns: &Self::Columns) -> Self::ConstElems<'_>
fn const_values(columns: &Self::Columns) -> Self::ConstElems<'_>
Return one optional batch-constant value per argument.
Each tuple position is Some(value) when that argument is batch-constant and None when it
was decoded at full batch length. Executors pass the tuple to the prepare closure once
before the row loop.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".