Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions datafusion/expr-common/src/interval_arithmetic.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down
2 changes: 1 addition & 1 deletion datafusion/physical-expr/src/equivalence/properties/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down