[jira] [Updated] (HIVE-17568) HiveJoinPushTransitivePredicatesRule may exchange predicates which are not valid on the other branch

2017-09-25 Thread Ashutosh Chauhan (JIRA)

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

Ashutosh Chauhan updated HIVE-17568:

   Resolution: Fixed
Fix Version/s: 3.0.0
   Status: Resolved  (was: Patch Available)

Pushed to master.

> 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
> Fix For: 3.0.0
>
> Attachments: HIVE-17568.01.patch, HIVE-17568.02.patch, 
> HIVE-17568.03.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)


[jira] [Updated] (HIVE-17568) HiveJoinPushTransitivePredicatesRule may exchange predicates which are not valid on the other branch

2017-09-25 Thread Zoltan Haindrich (JIRA)

 [ 
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.03.patch

#3) add also {{getSqlTypeName()}} comparision

> 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, 
> HIVE-17568.03.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)


[jira] [Updated] (HIVE-17568) HiveJoinPushTransitivePredicatesRule may exchange predicates which are not valid on the other branch

2017-09-21 Thread Zoltan Haindrich (JIRA)

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


[jira] [Updated] (HIVE-17568) HiveJoinPushTransitivePredicatesRule may exchange predicates which are not valid on the other branch

2017-09-20 Thread Zoltan Haindrich (JIRA)

 [ 
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.01.patch

#1) disable optimization in case the literal can't be evaluated on the other 
branch

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


[jira] [Updated] (HIVE-17568) HiveJoinPushTransitivePredicatesRule may exchange predicates which are not valid on the other branch

2017-09-20 Thread Zoltan Haindrich (JIRA)

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

Zoltan Haindrich updated HIVE-17568:

Status: Patch Available  (was: Open)

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


[jira] [Updated] (HIVE-17568) HiveJoinPushTransitivePredicatesRule may exchange predicates which are not valid on the other branch

2017-09-20 Thread Zoltan Haindrich (JIRA)

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

Zoltan Haindrich updated HIVE-17568:

Summary: HiveJoinPushTransitivePredicatesRule may exchange predicates which 
are not valid on the other branch  (was: HiveJoinPushTransitivePredicatesRule 
may exchange predicates which are invalid on the other branch)

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