alamb commented on code in PR #7758:
URL: https://github.com/apache/arrow-datafusion/pull/7758#discussion_r1350776297
##########
datafusion/common/src/scalar.rs:
##########
@@ -833,15 +833,15 @@ impl ScalarValue {
DataType::Interval(IntervalUnit::MonthDayNano) => {
ScalarValue::IntervalMonthDayNano(Some(0))
}
- DataType::Duration(TimeUnit::Second) =>
ScalarValue::DurationSecond(None),
Review Comment:
👌
##########
datafusion/physical-expr/src/intervals/cp_solver.rs:
##########
@@ -1414,4 +1415,130 @@ mod tests {
Ok(())
}
+
+ #[test]
+ fn test_propagate_comparison() {
+ let left = Interval::new(
+ IntervalBound::make_unbounded(DataType::Int64).unwrap(),
+ IntervalBound::make_unbounded(DataType::Int64).unwrap(),
+ );
+ let right = Interval::new(
+ IntervalBound::new(ScalarValue::Int64(Some(1000)), false),
+ IntervalBound::new(ScalarValue::Int64(Some(1000)), false),
+ );
+ assert_eq!(
Review Comment:
It took me some time to work this out, so I figured it might be helpful to
leave some comments explaining what is expected.
```suggestion
// left is unbounded, right is known to be [1000,1000]
// so left < right results in knowing that left is now < 1000
assert_eq!(
```
##########
datafusion/physical-expr/src/intervals/cp_solver.rs:
##########
@@ -1414,4 +1415,130 @@ mod tests {
Ok(())
}
+
+ #[test]
+ fn test_propagate_comparison() {
+ let left = Interval::new(
Review Comment:
It took me some time to work this out, so I figured it might be helpful to
leave some comments explaining what is expected.
```suggestion
// In the examples below:
// `left` is unbounded: [?, ?],
// `right` is known to be [1000,1000]
// so `left` < `right` results in no new knowledge of `right` but
knowing that `left` is now < 1000:` [?, 1000)
let left = Interval::new(
```
##########
datafusion/common/src/scalar.rs:
##########
@@ -833,15 +833,15 @@ impl ScalarValue {
DataType::Interval(IntervalUnit::MonthDayNano) => {
ScalarValue::IntervalMonthDayNano(Some(0))
}
- DataType::Duration(TimeUnit::Second) =>
ScalarValue::DurationSecond(None),
Review Comment:
👌
##########
datafusion/physical-expr/src/intervals/cp_solver.rs:
##########
@@ -1414,4 +1415,130 @@ mod tests {
Ok(())
}
+
+ #[test]
+ fn test_propagate_comparison() {
+ let left = Interval::new(
+ IntervalBound::make_unbounded(DataType::Int64).unwrap(),
+ IntervalBound::make_unbounded(DataType::Int64).unwrap(),
+ );
+ let right = Interval::new(
+ IntervalBound::new(ScalarValue::Int64(Some(1000)), false),
+ IntervalBound::new(ScalarValue::Int64(Some(1000)), false),
+ );
+ assert_eq!(
Review Comment:
It took me some time to work this out, so I figured it might be helpful to
leave some comments explaining what is expected.
```suggestion
// left is unbounded, right is known to be [1000,1000]
// so left < right results in knowing that left is now < 1000
assert_eq!(
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]