tanclary commented on code in PR #3234:
URL: https://github.com/apache/calcite/pull/3234#discussion_r1254727128
##########
core/src/main/java/org/apache/calcite/adapter/enumerable/RexImpTable.java:
##########
@@ -2305,6 +2308,30 @@ private static class LastDayImplementor extends
MethodNameImplementor {
}
}
+ /** Implementor for the {@code SAFE_MULTIPLY} function. */
+ private static class SafeArithmeticImplementor extends MethodNameImplementor
{
+ SafeArithmeticImplementor() {
+ super("safeMultiply", NullPolicy.STRICT, false);
+ }
+
+ @Override Expression implementSafe(final RexToLixTranslator translator,
+ final RexCall call, final List<Expression> argValueList) {
+ Expression arg0 = toLong(argValueList.get(0), call.operands.get(0));
+ Expression arg1 = toLong(argValueList.get(1), call.operands.get(1));
+ return Expressions.call(SqlFunctions.class, "safeMultiply", arg0, arg1);
+ }
+
+ // Because BigQuery treats all int types as aliases for INT64 (Java's LONG)
+ // they can all be converted to LONG to minimize entries in the
SqlFunctions class.
+ private Expression toLong(Expression arg, RexNode node) {
Review Comment:
Good point. Changed to `convertType`, let me know if this works for you.
--
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]