zoudan commented on code in PR #3378:
URL: https://github.com/apache/calcite/pull/3378#discussion_r1299183880
##########
babel/src/test/resources/sql/big-query.iq:
##########
@@ -668,6 +668,77 @@ SELECT SAFE_ADD(CAST('NaN' AS DOUBLE), CAST(3 as BIGINT))
as NaN_result;
(1 row)
!ok
+
+#####################################################################
+# SAFE_DIVIDE
Review Comment:
It seems that you include both `SAFE_DIVIDE` and `SAFE_SUBTRACT` in this PR?
##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -1859,7 +1983,7 @@ private static boolean safeDouble(double d) {
// negated MIN and MAX double values, overflow has not occurred. Otherwise,
// overflow has occurred. Important to note that 'Double.MIN_VALUE' refers
to
// minimum positive value.
- if (d < Double.MAX_VALUE && d > Double.MIN_VALUE) {
+ if (d < Double.MAX_VALUE && d > Double.MIN_VALUE || d == 0) {
Review Comment:
Why we have to check `d == 0` here?
--
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]