rubenada commented on code in PR #3314:
URL: https://github.com/apache/calcite/pull/3314#discussion_r1286096496


##########
linq4j/src/main/java/org/apache/calcite/linq4j/tree/Expressions.java:
##########
@@ -570,7 +570,37 @@ public static ConstantExpression constant(@Nullable Object 
value, Type type) {
           value = new BigInteger(stringValue);
         }
         if (primitive != null) {
-          value = primitive.parse(stringValue);
+          if (value instanceof Number) {
+            Number valueNumber = (Number) value;
+            switch (primitive) {
+            case BYTE:
+              value = valueNumber.byteValue();
+              break;
+            case CHAR:
+              value = (char) valueNumber.intValue();
+              break;
+            case SHORT:
+              value = (short) valueNumber.intValue();

Review Comment:
   Why not using directly `valueNumber.shortValue()`?



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

Reply via email to