caicancai commented on code in PR #4044:
URL: https://github.com/apache/calcite/pull/4044#discussion_r1846510287
##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -2459,6 +2493,40 @@ public static int minus(int b0, int b1) {
throw notArithmetic("-", b0, b1);
}
+ // checked -
+
+ public static byte checkedMinus(byte b0, byte b1) {
+ return intToByte(b0 - b1);
+ }
+
+ public static short checkedMinus(short b0, short b1) {
+ return intToShort(b0 - b1);
+ }
+
+ public static int checkedMinus(int b0, int b1) {
+ return Math.subtractExact(b0, b1);
+ }
+
+ public static long checkedMinus(long b0, long b1) {
+ return Math.subtractExact(b0, b1);
+ }
+
+ public static byte checkedUnaryMinus(byte b) {
+ return intToByte(-b);
+ }
+
+ public static short checkedUnaryMinus(short b) {
+ return intToShort(b);
Review Comment:
I guess the calcite function only has int type, but sql has short type, so
it needs to be converted
--
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]