ozankabak commented on code in PR #6007:
URL: https://github.com/apache/arrow-datafusion/pull/6007#discussion_r1167204148
##########
datafusion/physical-expr/src/intervals/interval_aritmetic.rs:
##########
@@ -324,25 +507,24 @@ mod tests {
Some(999),
Some(1000),
),
- (None, Some(1000), Some(1000), None, Some(1000), Some(1000)), //
singleton
(None, None, None, None, None, None),
];
for case in possible_cases {
assert_eq!(
- Interval {
- lower: ScalarValue::Int64(case.0),
- upper: ScalarValue::Int64(case.1)
- }
- .intersect(&Interval {
- lower: ScalarValue::Int64(case.2),
- upper: ScalarValue::Int64(case.3)
- })?
+ Interval::new(
+ IntervalBound::new(ScalarValue::Int64(case.0), true),
+ IntervalBound::new(ScalarValue::Int64(case.1), true),
+ )
+ .intersect(&Interval::new(
+ IntervalBound::new(ScalarValue::Int64(case.2), true),
+ IntervalBound::new(ScalarValue::Int64(case.3), true)
+ ))?
.unwrap(),
- Interval {
- lower: ScalarValue::Int64(case.4),
- upper: ScalarValue::Int64(case.5)
- }
+ Interval::new(
+ IntervalBound::new(ScalarValue::Int64(case.4), true),
+ IntervalBound::new(ScalarValue::Int64(case.5), true),
+ )
Review Comment:
```rust
assert_eq!(
Interval::both_open(case.0, case.1)
.intersect(&Interval::both_open(case.2, case.3)))?
Interval::both_open(case.4, case.5 ),
)
```
I like this idea, let's add convenience functions `open_open`,
`open_closed`, `closed_open` and `closed_closed` and use when appropriate (e.g.
in tests).
--
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]