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/10/21 09:47:51 UTC

[GitHub] [calcite] DonnyZone commented on a change in pull request #1507: [CALCITE-3414] In calcite-core, use RexToLixTranslator.convert for type conversion code generation uniformly

DonnyZone commented on a change in pull request #1507: [CALCITE-3414] In calcite-core, use RexToLixTranslator.convert for type conversion code generation uniformly
URL: https://github.com/apache/calcite/pull/1507#discussion_r336926768
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/adapter/enumerable/RexToLixTranslator.java
 ##########
 @@ -966,6 +967,13 @@ public static Expression convert(Expression operand, Type fromType,
     if (fromType.equals(toType)) {
       return operand;
     }
+    if (toType instanceof Types.RecordType) {
+      // We can't extract Class from RecordType since mapping Java Class might not generated yet.
+      return operand;
+    }
+    if (Types.isAssignableFrom(toType, fromType)) {
+      return operand;
+    }
     // E.g. from "Short" to "int".
     // Generate "x.intValue()".
 
 Review comment:
   Good idea, I will put them into `Types` for reuse.

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