tanclary commented on code in PR #3234:
URL: https://github.com/apache/calcite/pull/3234#discussion_r1212344188
##########
core/src/main/java/org/apache/calcite/runtime/SqlFunctions.java:
##########
@@ -1524,6 +1524,19 @@ public static int multiply(int b0, int b1) {
throw notArithmetic("*", b0, b1);
}
+ /** Helper method for safe arithmetic functions that checks if overflow has
occurred. */
+ private static boolean isOverflow(BigDecimal b0) {
+ return b0.compareTo(BigDecimal.valueOf(Long.MIN_VALUE)) < 0
+ || b0.compareTo(BigDecimal.valueOf(Long.MAX_VALUE)) > 0;
+ }
+
+ /** SQL {@code SAFE_MULTIPLY(<value0>, <value1>)} function. */
+ public static @Nullable Double safeMultiply(@PolyNull BigDecimal b0,
Review Comment:
@zoudan I think I am going to mirror my commit from [LOG
function](https://github.com/apache/calcite/commit/74bc025fbb5af4f43762926e0bec75acf6ac3025).
This function has the same operand type // return type relationship so should
be okay. [BigQuery
docs](https://cloud.google.com/bigquery/docs/reference/standard-sql/mathematical_functions#log)
--
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]