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


##########
modules/sql-engine/src/main/java/org/apache/ignite/internal/sql/engine/util/Commons.java:
##########
@@ -861,4 +864,46 @@ public static SqlQueryType getQueryType(SqlNode sqlNode) {
                 return null;
         }
     }
+
+    /** Returns the minimum unscaled value of a numeric type.
+     *
+     * @param type a numeric type
+     */
+    public static long getMinValue(RelDataType type) {
+        SqlTypeName typeName = type.getSqlTypeName();
+        switch (typeName) {
+            case TINYINT:
+                return Byte.MIN_VALUE;
+            case SMALLINT:
+                return Short.MIN_VALUE;
+            case INTEGER:
+                return Integer.MIN_VALUE;
+            case BIGINT:

Review Comment:
   `type.getPrecision()` is 19 for BIGINT
   `NumberUtil.getMinUnscaled(type.getPrecision())` creates 
`BigInteger.valueOf(Long.MIN_VALUE)` for param value of 19, then converts to 
long.
   
   Seems, it is safe to return Long.MIN_VALUE here.
   Same is true for max_value.



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