pub trait RowFn:
'static
+ Sized
+ Clone
+ Send
+ Sync {
type Options: 'static + Send + Sync + Clone + Debug + Display + PartialEq + Eq + Hash;
const ARG_NAMES: &'static [&'static str];
const INFALLIBLE: bool;
// Required methods
fn id(&self) -> ScalarFnId;
fn dispatch<V: RowVisitor<Self::Options>>(
&self,
options: &Self::Options,
args: &[DType],
visitor: V,
) -> VortexResult<V::VisitResult>;
// Provided methods
fn serialize(
&self,
options: &Self::Options,
) -> VortexResult<Option<Vec<u8>>> { ... }
fn deserialize(
&self,
_metadata: &[u8],
_session: &VortexSession,
) -> VortexResult<Self::Options> { ... }
}Expand description
A strict scalar function whose row kernel cannot produce null from valid inputs.
This is stronger than
ScalarFnVTable::is_strict, which requires null
propagation but permits valid inputs to produce null. The framework derives output validity
only from input validity.
A dispatched OutputElement or OutputSink describes the non-nullable values produced for
valid rows. The framework widens that dtype when an input dtype is nullable, attaches the
input-derived validity, and casts the finished array to the widened dtype. Implementations do
not construct nullable placeholders for invalid rows.
Declare argument names and use dispatch to select element and output types.
Every implementation receives the standard ScalarFnVTable. A public type that needs custom
vtable hooks can delegate its row kernel through row_fn_return_dtype and execute_rows.
Required Associated Constants§
Sourceconst ARG_NAMES: &'static [&'static str]
const ARG_NAMES: &'static [&'static str]
The arguments in display order. Its length is the function’s exact arity.
Sourceconst INFALLIBLE: bool
const INFALLIBLE: bool
Whether every dispatch is infallible.
See ScalarFnVTable::is_infallible for
a more detailed explanation of semantic errors.
The framework checks dispatched element and result types. A conservative false is allowed.
Required Associated Types§
Required Methods§
Sourcefn id(&self) -> ScalarFnId
fn id(&self) -> ScalarFnId
Returns the ID of the scalar function.
Sourcefn dispatch<V: RowVisitor<Self::Options>>(
&self,
options: &Self::Options,
args: &[DType],
visitor: V,
) -> VortexResult<V::VisitResult>
fn dispatch<V: RowVisitor<Self::Options>>( &self, options: &Self::Options, args: &[DType], visitor: V, ) -> VortexResult<V::VisitResult>
Choose element types for these input dtypes and visit the framework with them.
Planning and execution both call this method, so its result must depend only on
options and args. Cross-argument dtype validation belongs here.
Provided Methods§
Sourcefn serialize(&self, options: &Self::Options) -> VortexResult<Option<Vec<u8>>>
fn serialize(&self, options: &Self::Options) -> VortexResult<Option<Vec<u8>>>
Serialize this function’s options, or return None when the function is not serializable.
Sourcefn deserialize(
&self,
_metadata: &[u8],
_session: &VortexSession,
) -> VortexResult<Self::Options>
fn deserialize( &self, _metadata: &[u8], _session: &VortexSession, ) -> VortexResult<Self::Options>
Restore options written by serialize.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".