rubenada commented on code in PR #3672:
URL: https://github.com/apache/calcite/pull/3672#discussion_r1481305092


##########
core/src/main/java/org/apache/calcite/sql/fun/SqlStdOperatorTable.java:
##########
@@ -1802,11 +1802,11 @@ public class SqlStdOperatorTable extends 
ReflectiveSqlOperatorTable {
           OperandTypes.NUMERIC,
           SqlFunctionCategory.NUMERIC);
 
-  /** The {@code TRUNCATE(numeric [, numeric])} function. */
+  /** The {@code TRUNCATE(numeric [, integer])} function. */
   public static final SqlBasicFunction TRUNCATE =
       SqlBasicFunction.create("TRUNCATE",
           ReturnTypes.ARG0_NULLABLE,
-          OperandTypes.NUMERIC_OPTIONAL_INTEGER,
+          
OperandTypes.NUMERIC.or(OperandTypes.NUMERIC_INT32.apply("TRUNCATE")),

Review Comment:
   I understand that TRUNCATE suffers from the same issue as ROUND. Perhaps we 
should enlarge the Jira title (and therefore the commit message) to reflect 
this, e.g.  `[CALCITE-6238] Exception while evaluating ROUND and TRUNCATE 
functions when the second parameter is not an integer`.
   Also we should add a new unit test with TRUNCATE, analogous to the new 
`round(42, CAST(2 as BIGINT))` test in `SqlOperatorTest.java`.
   Wdyt?



-- 
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]

Reply via email to