alamb commented on code in PR #7885:
URL: https://github.com/apache/arrow-datafusion/pull/7885#discussion_r1367792837
##########
datafusion/physical-expr/src/intervals/interval_aritmetic.rs:
##########
@@ -1079,6 +1094,117 @@ mod tests {
Interval::make(lower, upper, (false, false))
}
+ #[test]
+ fn boolean_interval_test() -> Result<()> {
+ // Demonstrate / document how boolean Intervals work
+ #[derive(Debug)]
+ struct TestCase {
+ lower: bool,
+ upper: bool,
+ /// expected bounds when lower is open, upper is open
+ expected_open_open: (bool, bool),
+ /// expected bounds when lower is open, upper is closed
+ expected_open_closed: (bool, bool),
+ /// expected bounds when lower is closes, upper is open
+ expected_closed_open: (bool, bool),
+ // Not: closed/closed is the same as lower/upper
+ }
+
+ let cases = vec![
+ TestCase {
+ lower: false,
+ upper: false,
+ expected_open_open: (true, false), // whole range
+ expected_open_closed: (true, false),
+ expected_closed_open: (false, false),
+ },
+ TestCase {
+ lower: false,
+ upper: true,
+ expected_open_open: (true, false), // whole range
+ expected_open_closed: (true, true),
+ expected_closed_open: (false, false),
+ },
+ TestCase {
+ lower: true,
+ upper: false,
+ expected_open_open: (true, false), // whole range
+ expected_open_closed: (true, false),
+ expected_closed_open: (true, false),
+ },
+ TestCase {
+ lower: true,
+ upper: true,
+ expected_open_open: (true, false), // whole range
Review Comment:
Thank you @berkaysynnada -- this was my understanding as well. So given
that this test passes with the current implementation, that suggestes to me it
is a bugwhat do you suggest we do?
1. I wait for your refactoring PR
2. Fix the code to not create invalid intervals?
3. Something else?
--
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]