Apache DataFusion SQL Query Engine
Minor: Interval singleton (#15859)
Jay Zhan96a20860f3e8
diff --git a/datafusion/expr-common/src/interval_arithmetic.rs b/datafusion/expr-common/src/interval_arithmetic.rsindex 6af4322df2..8dbc701b7f 100644--- a/datafusion/expr-common/src/interval_arithmetic.rs+++ b/datafusion/expr-common/src/interval_arithmetic.rs@@ -949,6 +949,18 @@ impl Display for Interval {}}+impl From<ScalarValue> for Interval {+ fn from(value: ScalarValue) -> Self {+ Self::new(value.clone(), value)+ }+}++impl From<&ScalarValue> for Interval {+ fn from(value: &ScalarValue) -> Self {+ Self::new(value.to_owned(), value.to_owned())+ }+}+/// Applies the given binary operator the `lhs` and `rhs` arguments.pub fn apply_operator(op: &Operator, lhs: &Interval, rhs: &Interval) -> Result<Interval> {match *op {diff --git a/datafusion/physical-expr/src/equivalence/properties/mod.rs b/datafusion/physical-expr/src/equivalence/properties/mod.rsindex 5b34a02a91..f508c79145 100644--- a/datafusion/physical-expr/src/equivalence/properties/mod.rs+++ b/datafusion/physical-expr/src/equivalence/properties/mod.rs@@ -1600,7 +1600,7 @@ fn get_expr_properties(} else if let Some(literal) = expr.as_any().downcast_ref::<Literal>() {Ok(ExprProperties {sort_properties: SortProperties::Singleton,- range: Interval::try_new(literal.value().clone(), literal.value().clone())?,+ range: literal.value().into(),preserves_lex_ordering: true,})} else {