lowka commented on code in PR #2786:
URL: https://github.com/apache/ignite-3/pull/2786#discussion_r1381271249


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/IgniteSqlValidator.java:
##########
@@ -479,6 +487,61 @@ private void checkTypesInteroperability(SqlValidatorScope 
scope, SqlNode expr) {
                     throw 
SqlUtil.newContextException(expr.getParserPosition(), ex);
                 }
             }
+
+            literalCanFitType(expr, returnType);
+        }
+    }
+
+    /** Check literal can fit to declared exact numeric type, work only for 
single literal. */
+    private static void literalCanFitType(SqlNode expr, RelDataType toType) {
+        if (INT_TYPES.contains(toType.getSqlTypeName())) {
+            LiteralExtractor litExtractor = new LiteralExtractor();

Review Comment:
   There is no need to create a new instance for every expression, because 
`SqlValidator` is stateful and `LiteralExtractor` can be stored in a field.



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