pub fn satisfy_greater(
left: &Interval,
right: &Interval,
strict: bool,
) -> Result<Option<(Interval, Interval)>, DataFusionError>
Expand description
This function updates the given intervals by enforcing (i.e. propagating)
the inequality left > right
(or the left >= right
inequality, if strict
is true
).
Returns a Result
wrapping an Option
containing the tuple of resulting
intervals. If the comparison is infeasible, returns None
.
Example usage:
use datafusion_common::DataFusionError;
use datafusion_expr_common::interval_arithmetic::{satisfy_greater, Interval};
let left = Interval::make(Some(-1000.0_f32), Some(1000.0_f32))?;
let right = Interval::make(Some(500.0_f32), Some(2000.0_f32))?;
let strict = false;
assert_eq!(
satisfy_greater(&left, &right, strict)?,
Some((
Interval::make(Some(500.0_f32), Some(1000.0_f32))?,
Interval::make(Some(500.0_f32), Some(1000.0_f32))?
))
);
Ok::<(), DataFusionError>(())
NOTE: This function only works with intervals of the same data type. Attempting to compare intervals of different data types will lead to an error.