mhilton opened a new issue, #7756:
URL: https://github.com/apache/arrow-datafusion/issues/7756
### Describe the bug
When applying `propagate_comparison` to `Interval`s with the type
`Timestamp(..)` produces unexpected results. In the test below the upper value
coming from a less-than operation fails to propagate.
This seems to be a result of time arithmetic being special.
### To Reproduce
Run the following test:
```
#[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!(
(
Some(Interval::new(
IntervalBound::make_unbounded(DataType::Int64).unwrap(),
IntervalBound::new(ScalarValue::Int64(Some(1000)), true)
)),
Some(Interval::new(
IntervalBound::new(ScalarValue::Int64(Some(1000)),
false),
IntervalBound::new(ScalarValue::Int64(Some(1000)), false)
)),
),
propagate_comparison(&Operator::Lt, &left, &right).unwrap()
);
let left = Interval::new(
IntervalBound::make_unbounded(DataType::Timestamp(
TimeUnit::Nanosecond,
None,
))
.unwrap(),
IntervalBound::make_unbounded(DataType::Timestamp(
TimeUnit::Nanosecond,
None,
))
.unwrap(),
);
let right = Interval::new(
IntervalBound::new(ScalarValue::TimestampNanosecond(Some(1000),
None), false),
IntervalBound::new(ScalarValue::TimestampNanosecond(Some(1000),
None), false),
);
assert_eq!(
(
Some(Interval::new(
IntervalBound::make_unbounded(DataType::Timestamp(
TimeUnit::Nanosecond,
None
))
.unwrap(),
IntervalBound::new(
ScalarValue::TimestampNanosecond(Some(1000), None),
true
)
)),
Some(Interval::new(
IntervalBound::new(
ScalarValue::TimestampNanosecond(Some(1000), None),
false
),
IntervalBound::new(
ScalarValue::TimestampNanosecond(Some(1000), None),
false
)
)),
),
propagate_comparison(&Operator::Lt, &left, &right).unwrap()
);
}
```
### Expected behavior
The test should pass, more preciesly the behaviour of a `Timestamp(..)` type
should be similar to that of `Int64`.
### Additional context
_No response_
--
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]