zoudan commented on code in PR #3378:
URL: https://github.com/apache/calcite/pull/3378#discussion_r1300827566
##########
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:
Get it. Then how about adjusting it like this:
```
return (d < Double.MAX_VALUE && d > Double.MIN_VALUE)
|| (d > -Double.MAX_VALUE && d < -Double.MIN_VALUE)
|| d == 0;
```
##########
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:
Two separate PRs look better to me, it would make things more clear.
--
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]