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/16 04:16:17 UTC

[GitHub] [calcite] danny0405 commented on a change in pull request #1478: [CALCITE-3378] AssertionError for checking RexNode implify

danny0405 commented on a change in pull request #1478: [CALCITE-3378] AssertionError for checking RexNode implify
URL: https://github.com/apache/calcite/pull/1478#discussion_r335271473
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/rex/RexUtil.java
 ##########
 @@ -302,7 +303,16 @@ public static RexNode removeCast(RexNode e) {
     for (;;) {
       switch (e.getKind()) {
       case CAST:
+        RelDataType destType = e.getType();
         e = ((RexCall) e).operands.get(0);
+        if (!SqlTypeUtil.canCastFrom(destType, e.getType(), true)) {
+          throw new UnsupportedOperationException(
 
 Review comment:
   AFAIK, the `removeCast` doesn't say that it would only remove the redundant casts, it just remove `any` casts, so i don't think we should add a `SqlTypeUtil.canCastFrom` check here and throws exception. It is the invoker that should apply these rules.

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