xtern commented on code in PR #2887:
URL: https://github.com/apache/ignite-3/pull/2887#discussion_r1412003649


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/sql/fun/IgniteSqlOperatorTable.java:
##########
@@ -169,26 +169,13 @@ public boolean isDeterministic() {
 
     /** The {@code ROUND(numeric [, numeric])} function. */
     public static final SqlFunction ROUND = SqlBasicFunction.create("ROUND",
-            new SqlReturnTypeInference() {
-                @Override
-                public @Nullable RelDataType 
inferReturnType(SqlOperatorBinding opBinding) {
-                    RelDataType operandType = opBinding.getOperandType(0);
-
-                    // If there is only one argument and it supports precision 
and scale, set scale 0.
-                    if (opBinding.getOperandCount() == 1 && 
operandType.getSqlTypeName().allowsPrecScale(true, true)) {
-                        int precision = operandType.getPrecision();
-                        IgniteTypeFactory typeFactory = Commons.typeFactory();
-
-                        RelDataType returnType = 
typeFactory.createSqlType(operandType.getSqlTypeName(), precision, 0);
-                        // Preserve nullability
-                        boolean nullable = operandType.isNullable();
-
-                        return 
typeFactory.createTypeWithNullability(returnType, nullable);
-                    } else {
-                        return operandType;
-                    }
-                }
-            },
+            new SetScaleToZeroIfSingleArgument(),
+            OperandTypes.NUMERIC_OPTIONAL_INTEGER,
+            SqlFunctionCategory.NUMERIC);
+
+    /** The {@code ROUND(numeric [, numeric])} function. */

Review Comment:
   ```suggestion
       /** The {@code TRUNCATE(numeric [, numeric])} function. */
   ```



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