Skip to content

Commit

Permalink
omit clone
Browse files Browse the repository at this point in the history
  • Loading branch information
ch-sc committed Feb 25, 2025
1 parent d14747d commit d3810de
Showing 1 changed file with 12 additions and 4 deletions.
16 changes: 12 additions & 4 deletions datafusion/expr-common/src/interval_arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -960,10 +960,18 @@ pub fn apply_operator(op: &Operator, lhs: &Interval, rhs: &Interval) -> Result<I
Operator::IsDistinctFrom | Operator::IsNotDistinctFrom => {
NullableInterval::from(lhs)
.apply_operator(op, &rhs.into())
.and_then(|x| {
x.values().cloned().ok_or(DataFusionError::Internal(
"Unexpected null value interval".to_string(),
))
.and_then(|nullable_interval| match nullable_interval {
NullableInterval::Null { .. } => {
let return_type = BinaryTypeCoercer::new(
&lhs.data_type(),
op,
&rhs.data_type(),
)
.get_result_type()?;
Interval::make_unbounded(&return_type)
}
NullableInterval::MaybeNull { values }
| NullableInterval::NotNull { values } => Ok(values),
})
}
_ => internal_err!("Interval arithmetic does not support the operator {op}"),
Expand Down

0 comments on commit d3810de

Please sign in to comment.