tkalkirill commented on code in PR #13375:
URL: https://github.com/apache/ignite/pull/13375#discussion_r3734929011


##########
modules/calcite/src/main/java/org/apache/ignite/internal/processors/query/calcite/exec/LogicalRelImplementor.java:
##########
@@ -1076,21 +1077,18 @@ private long validateAndGetFetchOffsetParams(RexNode 
node, String op) {
                 IgniteQueryErrorCode.UNEXPECTED_ELEMENT_TYPE);
         }
 
-        long paramAsLong;
-
         try {
-            paramAsLong = IgniteMath.convertToLongExact((Number)param);
+            BigDecimal paramAsDecimal = 
IgniteMath.convertToBigDecimal((Number)param);
+
+            if (paramAsDecimal.signum() < 0) {
+                throw new IllegalArgumentException("Negative value of " + op);

Review Comment:
   The user-facing error message remains unchanged - we still use 
`illegalFetchLimit(op)`. The additional exception is only attached as the cause 
and provides context about why validation failed. It also allows us to keep a 
single error-handling path, which makes the code simpler and cleaner.



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