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


##########
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) {

Review Comment:
   Would it make sense to put this logic inside `Primitive` class, in a new 
method (something similar to the existing `Primitive#parse`) e.g.:
   ```
   public enum Primitive {
   ...
     public Object numberValue(Number number) {
       switch (this) {
       case BYTE:
         return number.byteValue();
       case CHAR:
         return (char) number.intValue();
       case DOUBLE:
         return number.doubleValue();
       case FLOAT:
         return number.floatValue();
       case INT:
         return number.intValue();
       case LONG:
         return number.longValue();
       case SHORT:
         return number.shortValue();
       default:
         throw new AssertionError(number);
       }
     }
   ```



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