You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/11/19 02:09:21 UTC

[GitHub] [calcite] DonnyZone commented on a change in pull request #1592: [CALCITE-3512] Support type cast from Time/TimeStamp to Integer/Long

DonnyZone commented on a change in pull request #1592: [CALCITE-3512] Support type cast from Time/TimeStamp to Integer/Long
URL: https://github.com/apache/calcite/pull/1592#discussion_r347700978
 
 

 ##########
 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) {
         return Expressions.call(BuiltInMethod.DATE_TO_INT.method, operand);
-      } else {
-        return Expressions.convert_(operand, toType);
+      } else if (toType == Integer.class) {
+        return Expressions.call(BuiltInMethod.DATE_TO_INT_OPTIONAL.method, operand);
 
 Review comment:
   They can't be merged together. During codegen, Calcite will check methods through reflection to compare types.

----------------------------------------------------------------
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:
users@infra.apache.org


With regards,
Apache Git Services