Vortex Compute¶
Encoding vtables can define optional implementations of compute functions where it’s possible to optimize the implementation beyond the default behavior of canonicalizing the array and then performing the operation.
For example, DictArray defines an implementation of compare where given a constant right-hand side argument,
the operation is performed only over the dictionary values and the result is wrapped up with the original dictionary
codes.
Compute Functions¶
binary_boolean(lhs: Array, rhs: Array, BinaryOperator) -> ArrayCompute
And,AndKleene,Or,OrKleeneoperations over two boolean arrays.
binary_numeric(lhs: Array, rhs: Array, BinaryOperator) -> ArrayCompute
Add,Sub,RSub,Mul,Div,RDivoperations over two numeric arrays.
compare(lhs: Array, rhs: Array, CompareOperator) -> ArrayCompute
Eq,NotEq,Gt,Gte,Lt,Lteoperations over two arrays.
try_cast(Array, DType) -> ArrayTry to cast the array to the specified data type.
fill_forward(Array) -> ArrayFill forward null values with the most recent non-null value.
fill_null(Array, Scalar) -> ArrayFill null values with the specified scalar value.
invert_fn(Array) -> ArrayInvert the boolean values of the array.
like(Array, pattern: Array) -> ArrayPerform a
LIKEoperation over two arrays.
scalar_at(Array, index) -> ScalarGet the scalar value at the specified index.
search_sorted(Array, Scalar) -> SearchResultSearch for the specified scalar value in the sorted array.
slice(Array, start, end) -> ArraySlice the array from the start to the end index.
take(Array, indices: Array) -> ArrayTake the specified nullable indices from the array.
filter(Array, mask: Mask) -> ArrayFilter the array based on the given mask.
Type Coercion¶
To maximise compatibility with compute engines, Vortex does not perform any implicit type coercion in its compute
functions or expressions. The exception to this is upcasting the nullability of input data types. For example,
it is valid to compare a u32 and u32? array, resulting in a bool? array.