DonnyZone commented on a change in pull request #1609: [CALCITE-3520] Type cast 
from primitive to box is not correct
URL: https://github.com/apache/calcite/pull/1609#discussion_r355245385
 
 

 ##########
 File path: 
core/src/main/java/org/apache/calcite/adapter/enumerable/EnumUtils.java
 ##########
 @@ -400,8 +400,11 @@ public static Expression convert(Expression operand, Type 
fromType,
       if (operand instanceof UnaryExpression) {
         UnaryExpression una = (UnaryExpression) operand;
         if (una.nodeType == ExpressionType.Convert
-            || Primitive.of(una.getType()) == toBox) {
-          return Expressions.box(una.expression, toBox);
+            && Primitive.of(una.getType()) == toBox) {
+          Primitive origin = Primitive.of(una.expression.type);
 
 Review comment:
   According to the comment, "Eliminate primitive casts like 
Long.valueOf((long) x), Generate Long.valueOf(x)", we should satiesfy all these 
conditions.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to