[ 
https://issues.apache.org/jira/browse/HIVE-17568?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Zoltan Haindrich updated HIVE-17568:
------------------------------------
    Attachment: HIVE-17568.02.patch

#2) add missing getType() to compare the basetype instead of the ref

> HiveJoinPushTransitivePredicatesRule may exchange predicates which are not 
> valid on the other branch
> ----------------------------------------------------------------------------------------------------
>
>                 Key: HIVE-17568
>                 URL: https://issues.apache.org/jira/browse/HIVE-17568
>             Project: Hive
>          Issue Type: Bug
>          Components: Logical Optimizer
>            Reporter: Zoltan Haindrich
>            Assignee: Zoltan Haindrich
>         Attachments: HIVE-17568.01.patch, HIVE-17568.02.patch
>
>
> Joining 2 tables on at least 1 column which is not the same type ; 
> (integer/double for example).
> The calcite expressions require double/integer inputs which will became 
> invalid if {{HiveJoinPushTransitivePredicatesRule}} pushes them to the other 
> branch.
> query:
> {code}
> create table t1 (v string, k int);
> insert into t1 values ('people', 10), ('strangers', 20), ('parents', 30);
> create table t2 (v string, k double);
> insert into t2 values ('people', 10), ('strangers', 20), ('parents', 30);
> select * from t1 where t1.k in (select t2.k from t2 where t2.v='people') and 
> t1.k<15;
> {code}
> results in:
> {code}
> java.lang.AssertionError: type mismatch:
> type1:
> DOUBLE
> type2:
> INTEGER
>       at org.apache.calcite.util.Litmus$1.fail(Litmus.java:31)
>       at org.apache.calcite.plan.RelOptUtil.eq(RelOptUtil.java:1841)
>       at 
> org.apache.calcite.rex.RexProgramBuilder$RegisterInputShuttle.visitInputRef(RexProgramBuilder.java:941)
>       at 
> org.apache.calcite.rex.RexProgramBuilder$RegisterInputShuttle.visitInputRef(RexProgramBuilder.java:919)
>       at org.apache.calcite.rex.RexInputRef.accept(RexInputRef.java:112)
>       at org.apache.calcite.rex.RexShuttle.visitList(RexShuttle.java:153)
>       at org.apache.calcite.rex.RexShuttle.visitCall(RexShuttle.java:102)
>       at 
> org.apache.calcite.rex.RexProgramBuilder$RegisterShuttle.visitCall(RexProgramBuilder.java:884)
>       at 
> org.apache.calcite.rex.RexProgramBuilder$RegisterShuttle.visitCall(RexProgramBuilder.java:882)
>       at org.apache.calcite.rex.RexCall.accept(RexCall.java:104)
>       at 
> org.apache.calcite.rex.RexProgramBuilder.registerInput(RexProgramBuilder.java:296)
>       at 
> org.apache.calcite.rex.RexProgramBuilder.addCondition(RexProgramBuilder.java:271)
>       at 
> org.apache.calcite.rel.rules.FilterMergeRule.createProgram(FilterMergeRule.java:98)
>       at 
> org.apache.calcite.rel.rules.FilterMergeRule.onMatch(FilterMergeRule.java:67)
> [...]
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to