pub(crate) trait LazyBinaryFunc {
// Required methods
fn eval<'a>(
&'a self,
datums: &[Datum<'a>],
temp_storage: &'a RowArena,
a: &'a MirScalarExpr,
b: &'a MirScalarExpr,
) -> Result<Datum<'a>, EvalError>;
fn output_type(
&self,
input_type_a: ColumnType,
input_type_b: ColumnType,
) -> ColumnType;
fn propagates_nulls(&self) -> bool;
fn introduces_nulls(&self) -> bool;
fn negate(&self) -> Option<BinaryFunc>;
fn is_monotone(&self) -> (bool, bool);
fn is_infix_op(&self) -> bool;
// Provided method
fn could_error(&self) -> bool { ... }
}
Expand description
A description of an SQL binary function that has the ability to lazy evaluate its arguments
Required Methods§
fn eval<'a>( &'a self, datums: &[Datum<'a>], temp_storage: &'a RowArena, a: &'a MirScalarExpr, b: &'a MirScalarExpr, ) -> Result<Datum<'a>, EvalError>
Sourcefn output_type(
&self,
input_type_a: ColumnType,
input_type_b: ColumnType,
) -> ColumnType
fn output_type( &self, input_type_a: ColumnType, input_type_b: ColumnType, ) -> ColumnType
The output ColumnType of this function.
Sourcefn propagates_nulls(&self) -> bool
fn propagates_nulls(&self) -> bool
Whether this function will produce NULL on NULL input.
Sourcefn introduces_nulls(&self) -> bool
fn introduces_nulls(&self) -> bool
Whether this function will produce NULL on non-NULL input.
Sourcefn negate(&self) -> Option<BinaryFunc>
fn negate(&self) -> Option<BinaryFunc>
Returns the negation of the function, if one exists.
Sourcefn is_monotone(&self) -> (bool, bool)
fn is_monotone(&self) -> (bool, bool)
Returns true if the function is monotone. (Non-strict; either increasing or decreasing.) Monotone functions map ranges to ranges: ie. given a range of possible inputs, we can determine the range of possible outputs just by mapping the endpoints.
This describes the pointwise behaviour of the function:
ie. the behaviour of any specific argument as the others are held constant. (For example, a - b
is
monotone in the first argument because for any particular value of b
, increasing a
will
always cause the result to increase… and in the second argument because for any specific a
,
increasing b
will always cause the result to decrease.)
This property describes the behaviour of the function over ranges where the function is defined: ie. the arguments and the result are non-error datums.
Sourcefn is_infix_op(&self) -> bool
fn is_infix_op(&self) -> bool
Yep, I guess this returns true for infix operators.
Provided Methods§
Sourcefn could_error(&self) -> bool
fn could_error(&self) -> bool
Whether this function might error on non-error input.