kosiew commented on code in PR #27433:
URL: https://github.com/apache/datafusion/pull/27433#discussion_r4784943732
##########
datafusion/expr-common/src/interval_arithmetic.rs:
##########
@@ -852,20 +901,48 @@ impl Interval {
_ => Self::new(prev_value(zero.clone()), next_value(zero.clone())),
};
+ // Integer division by zero has no result. If an integer divisor only
+ // touches zero at an endpoint, move that endpoint to the nearest
+ // defined integer before choosing the sign case. [0, 0] is left as it
+ // is. Floats are not adjusted here, because a float divisor can get
+ // arbitrarily close to zero and the quotient really can be unbounded.
+ let mut divisor_lower = rhs_ref.lower.clone();
+ let mut divisor_upper = rhs_ref.upper.clone();
+ if dt.is_integer() && !(divisor_lower == zero && divisor_upper ==
zero) {
Review Comment:
Could we add a regression test asserting [i64::MIN, 10] / [-1, 0] == [-10,
+∞) to verify that endpoint normalization preserves the existing conservative
overflow handling?
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]