thomasrebele commented on code in PR #4505:
URL: https://github.com/apache/calcite/pull/4505#discussion_r2485946569
##########
core/src/main/java/org/apache/calcite/rex/RexSimplify.java:
##########
@@ -1028,9 +1037,25 @@ private RexNode simplifyIs(RexCall call, RexUnknownAs
unknownAs) {
switch (a.getKind()) {
case LITERAL:
return rexBuilder.makeLiteral(!((RexLiteral) a).isNull());
+ case DIVIDE: {
Review Comment:
As far as I understand the SQL standard, floating point division by 0 should
throw an exception as well. This is also what Calcite does. Here a test case
for InterpreterTest that passes for 67e5bfcdc0151aa1926fa369382d12fc672ca5bf
(shortly after the release of Calcite 1.41.0):
```
@Test void testDivideFloatByZero() {
sql("select 10.0/4.0").returnsRows("[2.5]");
try {
sql("select 1.0/0.0").returnsRows("[NaN]");
fail("expected an ArithmeticException");
}
catch (ArithmeticException ex) {
assertEquals("Division by zero", ex.getMessage());
}
}
```
--
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]