xiedeyantu commented on code in PR #4653:
URL: https://github.com/apache/calcite/pull/4653#discussion_r2573018410
##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -2823,6 +2823,147 @@ public static long divide(long b0, BigDecimal b1) {
:
ULong.valueOf(UnsignedType.toBigInteger(b0).divide(UnsignedType.toBigInteger(b1)));
}
+ // nullable divide
+
Review Comment:
We can remove this empty line.
##########
core/src/test/resources/sql/misc.iq:
##########
@@ -18,6 +18,16 @@
!use post
!set outputformat mysql
+select CAST(5 AS DOUBLE) / 0 as a;
Review Comment:
Mysql result is [here](https://onecompiler.com/mysql/4464cd9y3). Was this
done intentionally here?
```
+------+
| a |
+------+
| NULL |
+------+
```
##########
core/src/test/resources/sql/misc.iq:
##########
@@ -2467,10 +2477,62 @@ FROM "hr"."emps";
!ok
-# [CALCITE-6566] JDBC adapter should generate PI function with parentheses in
most dialects
-
!use scott-mysql
+# [CALCITE-7270] Add support for a DIVIDE_0_NULL operator
+select 5 / 0 as a;
++---+
+| A |
++---+
+| |
++---+
+(1 row)
+
+!ok
+
+# No NULL result produced for double division
+select CAST(5 AS DOUBLE) / 0 as a;
++----------+
+| A |
++----------+
+| Infinity |
++----------+
+(1 row)
+
+!ok
+
+select 5 / 1 as a;
++---+
+| A |
++---+
+| 5 |
++---+
+(1 row)
+
+!ok
+
+# [CALCITE-7270] Add support for a DIVIDE_0_NULL operator
+select 5 % 0 as a;
Review Comment:
Mysql also returns NULL
##########
core/src/test/resources/sql/misc.iq:
##########
@@ -2467,10 +2477,62 @@ FROM "hr"."emps";
!ok
-# [CALCITE-6566] JDBC adapter should generate PI function with parentheses in
most dialects
-
!use scott-mysql
+# [CALCITE-7270] Add support for a DIVIDE_0_NULL operator
+select 5 / 0 as a;
Review Comment:
This is not same as mysql [result](https://onecompiler.com/mysql/4464cmddj).
--
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]