mihaibudiu commented on code in PR #3589: URL: https://github.com/apache/calcite/pull/3589#discussion_r1528991914
########## 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: There are no unsigned types in SQL. -- 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: commits-unsubscr...@calcite.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org