jduo commented on code in PR #3589:
URL: https://github.com/apache/calcite/pull/3589#discussion_r1528985794


##########
core/src/main/java/org/apache/calcite/rex/RexBuilder.java:
##########
@@ -699,22 +699,23 @@ boolean canRemoveCastFromLiteral(RelDataType toType, 
@Nullable Comparable value,
 
     if (SqlTypeName.INT_TYPES.contains(sqlType)) {
       final BigDecimal decimalValue = (BigDecimal) value;
-      final int s = decimalValue.scale();
-      if (s != 0) {
+      try {
+        // Will throw if the value does not fit in a long
+        long l = decimalValue.longValueExact();

Review Comment:
   Should these checks factor in unsigned types?



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