[ 
https://issues.apache.org/jira/browse/CALCITE-949?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=14990175#comment-14990175
 ] 

Julian Hyde commented on CALCITE-949:
-------------------------------------

[~jcamachorodriguez] Do you know why the 'if' is failing in Hive? If {{refType2 
== rightType}} evaluates to false, would {{refType2.equals(rightType)}} have 
evaluated to true? If so that would indicate that some code is using the wrong 
type factory.

> Assertion error in FixNullabilityShuttle in RexUtil
> ---------------------------------------------------
>
>                 Key: CALCITE-949
>                 URL: https://issues.apache.org/jira/browse/CALCITE-949
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>    Affects Versions: 1.5.0
>            Reporter: Jesus Camacho Rodriguez
>            Assignee: Jesus Camacho Rodriguez
>             Fix For: 1.5.0
>
>
> In RexUtil.java, we can find the following class that is used to fix an 
> expression to match changes in nullability of input fields, which is 
> specially useful for inner/outer joins:
> {code}
>   public static class FixNullabilityShuttle extends RexShuttle {
>     private final List<RelDataType> typeList;
>     private final RexBuilder rexBuilder;
>     public FixNullabilityShuttle(RexBuilder rexBuilder,
>         List<RelDataType> typeList) {
>       this.typeList = typeList;
>       this.rexBuilder = rexBuilder;
>     }
>     @Override public RexNode visitInputRef(RexInputRef ref) {
>       final RelDataType rightType = typeList.get(ref.getIndex());
>       final RelDataType refType = ref.getType();
>       if (refType == rightType) {
>         return ref;
>       }
>       final RelDataType refType2 =
>           rexBuilder.getTypeFactory().createTypeWithNullability(refType,
>               rightType.isNullable());
>       if (refType2 == rightType) {
>         return new RexInputRef(ref.getIndex(), refType2);
>       }
>       throw new AssertionError("mismatched type " + ref + " " + rightType);
>     }
>   }
> {code}
> We are hitting the last assertion error in Hive. The reason seems to be that 
> after adjusting the nullability, {{refType2 != rightType}} (which I think 
> makes sense). In particular, it seems that the last {{if}} clause should be 
> removed.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to