tanclary commented on code in PR #3234:
URL: https://github.com/apache/calcite/pull/3234#discussion_r1282151606
##########
testkit/src/main/java/org/apache/calcite/test/SqlOperatorTest.java:
##########
@@ -6843,6 +6843,79 @@ private static void checkIf(SqlOperatorFixture f) {
f.checkNull("truncate(cast(null as double))");
}
+ @Test void testSafeMultiplyFunc() {
+ final SqlOperatorFixture f0 =
fixture().setFor(SqlLibraryOperators.SAFE_MULTIPLY);
+ f0.checkFails("^safe_multiply(2, 3)^",
+ "No match found for function signature "
+ + "SAFE_MULTIPLY\\(<NUMERIC>, <NUMERIC>\\)", false);
+ final SqlOperatorFixture f = f0.withLibrary(SqlLibrary.BIG_QUERY);
+ // Basic test for each of the 9 2-permutations of BIGINT, DECIMAL, and
FLOAT
+ f.checkScalar("safe_multiply(cast(20 as bigint), cast(20 as bigint))",
+ "400", "BIGINT");
Review Comment:
Done
##########
site/_docs/reference.md:
##########
@@ -2779,6 +2779,7 @@ BigQuery's type system uses confusingly different names
for types and functions:
| b o | RPAD(string, length[, pattern ]) | Returns a string or
bytes value that consists of *string* appended to *length* with *pattern*
| b o | RTRIM(string) | Returns *string* with
all blanks removed from the end
| b | SAFE_CAST(value AS type) | Converts *value* to
*type*, returning NULL if conversion fails
+| b | SAFE_MULTIPLY(numeric1, numeric2) | Returns *numeric1* *
*numeric2*, null is returned if overflow occurs
Review Comment:
Done
--
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]