danny0405 commented on a change in pull request #1592: [CALCITE-3512] Query 
fails when comparing Time/TimeStamp types
URL: https://github.com/apache/calcite/pull/1592#discussion_r348940631
 
 

 ##########
 File path: 
core/src/main/java/org/apache/calcite/adapter/enumerable/RexToLixTranslator.java
 ##########
 @@ -1061,10 +1061,22 @@ public static Expression convert(Expression operand, 
Type fromType,
           Expressions.convert_(operand, toBox.primitiveClass),
           toBox);
     } else if (fromType == java.sql.Date.class) {
-      if (toBox == Primitive.INT) {
+      if (toType == int.class) {
 
 Review comment:
   There is already similar logic in EnumUtils.java [1], why couldn't we use 
that ? And there is already method:
   ```java
    // SqlFunctions.java
     public static Integer toIntOptional(java.util.Date v) {
       return v == null ? null : toInt(v);
     }
   ```
   
   
   [1] 
https://github.com/apache/calcite/blob/620ca17d4e283d58b3ab4c573b911702fd4127c7/core/src/main/java/org/apache/calcite/adapter/enumerable/EnumUtils.java#L243

----------------------------------------------------------------
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:
[email protected]


With regards,
Apache Git Services

Reply via email to