pub(crate) trait LazyBinaryFunc {
// Required methods
fn eval<'a>(
&'a self,
datums: &[Datum<'a>],
temp_storage: &'a RowArena,
exprs: &[&'a impl Eval],
) -> Result<Datum<'a>, EvalError>;
fn output_sql_type(&self, input_types: &[SqlColumnType]) -> SqlColumnType;
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 methods
fn output_type(&self, input_types: &[ReprColumnType]) -> ReprColumnType { ... }
fn could_error(&self) -> bool { ... }
fn is_infinity_monotone(&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, exprs: &[&'a impl Eval], ) -> Result<Datum<'a>, EvalError>
Sourcefn output_sql_type(&self, input_types: &[SqlColumnType]) -> SqlColumnType
fn output_sql_type(&self, input_types: &[SqlColumnType]) -> SqlColumnType
The output SqlColumnType 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 output_type(&self, input_types: &[ReprColumnType]) -> ReprColumnType
fn output_type(&self, input_types: &[ReprColumnType]) -> ReprColumnType
A wrapper around Self::output_sql_type that works with representation types.
Sourcefn could_error(&self) -> bool
fn could_error(&self) -> bool
Whether this function might error on non-error input.
Sourcefn is_infinity_monotone(&self) -> bool
fn is_infinity_monotone(&self) -> bool
Whether Self::is_monotone’s “map ranges to ranges by sampling the
endpoints” guarantee still holds when an operand may be infinite.
False for multiplication and division: their indeterminate forms
(0 * inf, inf / inf) and magnitude collapse (finite / inf = 0)
produce results the range endpoints do not bound, so an abstract
interpreter must not narrow their output range when an operand may be
infinite.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".