korlov42 commented on code in PR #5479:
URL: https://github.com/apache/ignite-3/pull/5479#discussion_r2013605481


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/IgniteSqlValidator.java:
##########
@@ -700,34 +700,48 @@ private void checkIntegerLimit(@Nullable SqlNode n, 
String nodeName) {
         }
 
         if (n instanceof SqlLiteral) {
-            BigDecimal offFetchLimit = ((SqlLiteral) n).bigDecimalValue();
+            BigDecimal offsetFetchLimit = ((SqlLiteral) n).bigDecimalValue();
 
-            if (offFetchLimit.compareTo(DEC_INT_MAX) > 0 || 
offFetchLimit.compareTo(BigDecimal.ZERO) < 0) {
-                throw newValidationError(n, 
IgniteResource.INSTANCE.correctIntegerLimit(nodeName));
-            }
+            checkLimitOffset(offsetFetchLimit, n, nodeName);
         } else if (n instanceof SqlDynamicParam) {
             SqlDynamicParam dynamicParam = (SqlDynamicParam) n;
-            RelDataType intType = typeFactory.createSqlType(INTEGER);
+            RelDataType dynParamType = 
typeFactory.createSqlType(SqlTypeName.BIGINT);
 
             // Validate value, if present.
             if (!isUnspecified(dynamicParam)) {
                 Object param = getDynamicParamValue(dynamicParam);
 
-                if (param instanceof Integer) {
-                    if ((Integer) param < 0) {
-                        throw newValidationError(n, 
IgniteResource.INSTANCE.correctIntegerLimit(nodeName));
-                    }
+                if (param == null) {
+                    throw newValidationError(n, 
IgniteResource.INSTANCE.illegalFetchLimit(nodeName));
+                }
+
+                if (param instanceof BigDecimal) {
+                    checkLimitOffset((BigDecimal) param, n, nodeName);

Review Comment:
   there is no point in validation of particular value of dynamic parameter on 
preparation stage since validation is happening once, and then plan will be 
reused for different arguments



##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/prepare/IgniteSqlValidator.java:
##########
@@ -700,34 +700,48 @@ private void checkIntegerLimit(@Nullable SqlNode n, 
String nodeName) {
         }
 
         if (n instanceof SqlLiteral) {
-            BigDecimal offFetchLimit = ((SqlLiteral) n).bigDecimalValue();
+            BigDecimal offsetFetchLimit = ((SqlLiteral) n).bigDecimalValue();

Review Comment:
   let's also improve method's javadoc



-- 
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: notifications-unsubscr...@ignite.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to