[jira] [Commented] (CALCITE-2947) Type mismatch assertion error when converting NOT IN subquery
[ https://issues.apache.org/jira/browse/CALCITE-2947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16800083#comment-16800083 ] Stamatis Zampetakis commented on CALCITE-2947: -- Is this related to CALCITE-2901? What do you think [~mgelbana]? > Type mismatch assertion error when converting NOT IN subquery > - > > Key: CALCITE-2947 > URL: https://issues.apache.org/jira/browse/CALCITE-2947 > Project: Calcite > Issue Type: Bug > Components: core >Reporter: Haisheng Yuan >Priority: Major > > Repro: > Add the following test to SqlToRelConverterTest.java. > {code:java} > @Test public void testSubQueryNotIN() { > final String sql = "select deptno\n" > + "from EMP e\n" > + "where deptno not in (select deptno\n" > + "from EMP where empno=e.empno)"; > sql(sql).ok(); > } > {code} > Error: > {code:java} > java.lang.AssertionError: type mismatch: > ref: > INTEGER NOT NULL > input: > INTEGER > at org.apache.calcite.util.Litmus$1.fail(Litmus.java:31) > at org.apache.calcite.plan.RelOptUtil.eq(RelOptUtil.java:1832) > at org.apache.calcite.rex.RexChecker.visitInputRef(RexChecker.java:125) > at org.apache.calcite.rex.RexChecker.visitInputRef(RexChecker.java:57) > at org.apache.calcite.rex.RexInputRef.accept(RexInputRef.java:112) > at org.apache.calcite.rex.RexChecker.visitCall(RexChecker.java:140) > at org.apache.calcite.rex.RexChecker.visitCall(RexChecker.java:57) > at org.apache.calcite.rex.RexCall.accept(RexCall.java:191) > at org.apache.calcite.rel.core.Filter.isValid(Filter.java:120) > at > org.apache.calcite.rel.logical.LogicalFilter.(LogicalFilter.java:70) > at > org.apache.calcite.rel.logical.LogicalFilter.create(LogicalFilter.java:114) > at > org.apache.calcite.rel.logical.LogicalFilter.create(LogicalFilter.java:101) > at > org.apache.calcite.rel.core.RelFactories$FilterFactoryImpl.createFilter(RelFactories.java:300) > at > org.apache.calcite.sql2rel.SqlToRelConverter.createJoin(SqlToRelConverter.java:2433) > {code} > If we change not in subquery to in subquery, it can run without error. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2947) Type mismatch assertion error when converting NOT IN subquery
[ https://issues.apache.org/jira/browse/CALCITE-2947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16800105#comment-16800105 ] Muhammad Gelbana commented on CALCITE-2947: --- Yes it looks like it. I don't have a stacktrace for the other test case though. > Type mismatch assertion error when converting NOT IN subquery > - > > Key: CALCITE-2947 > URL: https://issues.apache.org/jira/browse/CALCITE-2947 > Project: Calcite > Issue Type: Bug > Components: core >Reporter: Haisheng Yuan >Priority: Major > > Repro: > Add the following test to SqlToRelConverterTest.java. > {code:java} > @Test public void testSubQueryNotIN() { > final String sql = "select deptno\n" > + "from EMP e\n" > + "where deptno not in (select deptno\n" > + "from EMP where empno=e.empno)"; > sql(sql).ok(); > } > {code} > Error: > {code:java} > java.lang.AssertionError: type mismatch: > ref: > INTEGER NOT NULL > input: > INTEGER > at org.apache.calcite.util.Litmus$1.fail(Litmus.java:31) > at org.apache.calcite.plan.RelOptUtil.eq(RelOptUtil.java:1832) > at org.apache.calcite.rex.RexChecker.visitInputRef(RexChecker.java:125) > at org.apache.calcite.rex.RexChecker.visitInputRef(RexChecker.java:57) > at org.apache.calcite.rex.RexInputRef.accept(RexInputRef.java:112) > at org.apache.calcite.rex.RexChecker.visitCall(RexChecker.java:140) > at org.apache.calcite.rex.RexChecker.visitCall(RexChecker.java:57) > at org.apache.calcite.rex.RexCall.accept(RexCall.java:191) > at org.apache.calcite.rel.core.Filter.isValid(Filter.java:120) > at > org.apache.calcite.rel.logical.LogicalFilter.(LogicalFilter.java:70) > at > org.apache.calcite.rel.logical.LogicalFilter.create(LogicalFilter.java:114) > at > org.apache.calcite.rel.logical.LogicalFilter.create(LogicalFilter.java:101) > at > org.apache.calcite.rel.core.RelFactories$FilterFactoryImpl.createFilter(RelFactories.java:300) > at > org.apache.calcite.sql2rel.SqlToRelConverter.createJoin(SqlToRelConverter.java:2433) > {code} > If we change not in subquery to in subquery, it can run without error. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2947) Type mismatch assertion error when converting NOT IN subquery
[ https://issues.apache.org/jira/browse/CALCITE-2947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16800154#comment-16800154 ] Haisheng Yuan commented on CALCITE-2947: Perhaps not the same issue. At least with your proposed changes, the exception still happens. Needs more scrutiny. > Type mismatch assertion error when converting NOT IN subquery > - > > Key: CALCITE-2947 > URL: https://issues.apache.org/jira/browse/CALCITE-2947 > Project: Calcite > Issue Type: Bug > Components: core >Reporter: Haisheng Yuan >Priority: Major > > Repro: > Add the following test to SqlToRelConverterTest.java. > {code:java} > @Test public void testSubQueryNotIN() { > final String sql = "select deptno\n" > + "from EMP e\n" > + "where deptno not in (select deptno\n" > + "from EMP where empno=e.empno)"; > sql(sql).ok(); > } > {code} > Error: > {code:java} > java.lang.AssertionError: type mismatch: > ref: > INTEGER NOT NULL > input: > INTEGER > at org.apache.calcite.util.Litmus$1.fail(Litmus.java:31) > at org.apache.calcite.plan.RelOptUtil.eq(RelOptUtil.java:1832) > at org.apache.calcite.rex.RexChecker.visitInputRef(RexChecker.java:125) > at org.apache.calcite.rex.RexChecker.visitInputRef(RexChecker.java:57) > at org.apache.calcite.rex.RexInputRef.accept(RexInputRef.java:112) > at org.apache.calcite.rex.RexChecker.visitCall(RexChecker.java:140) > at org.apache.calcite.rex.RexChecker.visitCall(RexChecker.java:57) > at org.apache.calcite.rex.RexCall.accept(RexCall.java:191) > at org.apache.calcite.rel.core.Filter.isValid(Filter.java:120) > at > org.apache.calcite.rel.logical.LogicalFilter.(LogicalFilter.java:70) > at > org.apache.calcite.rel.logical.LogicalFilter.create(LogicalFilter.java:114) > at > org.apache.calcite.rel.logical.LogicalFilter.create(LogicalFilter.java:101) > at > org.apache.calcite.rel.core.RelFactories$FilterFactoryImpl.createFilter(RelFactories.java:300) > at > org.apache.calcite.sql2rel.SqlToRelConverter.createJoin(SqlToRelConverter.java:2433) > {code} > If we change not in subquery to in subquery, it can run without error. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2947) Type mismatch assertion error when converting NOT IN subquery
[ https://issues.apache.org/jira/browse/CALCITE-2947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16800466#comment-16800466 ] Stamatis Zampetakis commented on CALCITE-2947: -- Yes, I am not saying it is the same issue but there may be common parts that need to be fixed. Thanks for looking into this! > Type mismatch assertion error when converting NOT IN subquery > - > > Key: CALCITE-2947 > URL: https://issues.apache.org/jira/browse/CALCITE-2947 > Project: Calcite > Issue Type: Bug > Components: core >Reporter: Haisheng Yuan >Priority: Major > > Repro: > Add the following test to SqlToRelConverterTest.java. > {code:java} > @Test public void testSubQueryNotIN() { > final String sql = "select deptno\n" > + "from EMP e\n" > + "where deptno not in (select deptno\n" > + "from EMP where empno=e.empno)"; > sql(sql).ok(); > } > {code} > Error: > {code:java} > java.lang.AssertionError: type mismatch: > ref: > INTEGER NOT NULL > input: > INTEGER > at org.apache.calcite.util.Litmus$1.fail(Litmus.java:31) > at org.apache.calcite.plan.RelOptUtil.eq(RelOptUtil.java:1832) > at org.apache.calcite.rex.RexChecker.visitInputRef(RexChecker.java:125) > at org.apache.calcite.rex.RexChecker.visitInputRef(RexChecker.java:57) > at org.apache.calcite.rex.RexInputRef.accept(RexInputRef.java:112) > at org.apache.calcite.rex.RexChecker.visitCall(RexChecker.java:140) > at org.apache.calcite.rex.RexChecker.visitCall(RexChecker.java:57) > at org.apache.calcite.rex.RexCall.accept(RexCall.java:191) > at org.apache.calcite.rel.core.Filter.isValid(Filter.java:120) > at > org.apache.calcite.rel.logical.LogicalFilter.(LogicalFilter.java:70) > at > org.apache.calcite.rel.logical.LogicalFilter.create(LogicalFilter.java:114) > at > org.apache.calcite.rel.logical.LogicalFilter.create(LogicalFilter.java:101) > at > org.apache.calcite.rel.core.RelFactories$FilterFactoryImpl.createFilter(RelFactories.java:300) > at > org.apache.calcite.sql2rel.SqlToRelConverter.createJoin(SqlToRelConverter.java:2433) > {code} > If we change not in subquery to in subquery, it can run without error. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2947) Type mismatch assertion error when converting NOT IN subquery
[ https://issues.apache.org/jira/browse/CALCITE-2947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16801381#comment-16801381 ] Haisheng Yuan commented on CALCITE-2947: Found it, it is related with [CALCITE-2004|https://issues.apache.org/jira/browse/CALCITE-2004]. This issue can be fixed with that PR. Can someone help review PR in issue [CALCITE-2004|https://issues.apache.org/jira/browse/CALCITE-2004]? > Type mismatch assertion error when converting NOT IN subquery > - > > Key: CALCITE-2947 > URL: https://issues.apache.org/jira/browse/CALCITE-2947 > Project: Calcite > Issue Type: Bug > Components: core >Reporter: Haisheng Yuan >Priority: Major > > Repro: > Add the following test to SqlToRelConverterTest.java. > {code:java} > @Test public void testSubQueryNotIN() { > final String sql = "select deptno\n" > + "from EMP e\n" > + "where deptno not in (select deptno\n" > + "from EMP where empno=e.empno)"; > sql(sql).ok(); > } > {code} > Error: > {code:java} > java.lang.AssertionError: type mismatch: > ref: > INTEGER NOT NULL > input: > INTEGER > at org.apache.calcite.util.Litmus$1.fail(Litmus.java:31) > at org.apache.calcite.plan.RelOptUtil.eq(RelOptUtil.java:1832) > at org.apache.calcite.rex.RexChecker.visitInputRef(RexChecker.java:125) > at org.apache.calcite.rex.RexChecker.visitInputRef(RexChecker.java:57) > at org.apache.calcite.rex.RexInputRef.accept(RexInputRef.java:112) > at org.apache.calcite.rex.RexChecker.visitCall(RexChecker.java:140) > at org.apache.calcite.rex.RexChecker.visitCall(RexChecker.java:57) > at org.apache.calcite.rex.RexCall.accept(RexCall.java:191) > at org.apache.calcite.rel.core.Filter.isValid(Filter.java:120) > at > org.apache.calcite.rel.logical.LogicalFilter.(LogicalFilter.java:70) > at > org.apache.calcite.rel.logical.LogicalFilter.create(LogicalFilter.java:114) > at > org.apache.calcite.rel.logical.LogicalFilter.create(LogicalFilter.java:101) > at > org.apache.calcite.rel.core.RelFactories$FilterFactoryImpl.createFilter(RelFactories.java:300) > at > org.apache.calcite.sql2rel.SqlToRelConverter.createJoin(SqlToRelConverter.java:2433) > {code} > If we change not in subquery to in subquery, it can run without error. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2947) Type mismatch assertion error when converting NOT IN subquery
[ https://issues.apache.org/jira/browse/CALCITE-2947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16801384#comment-16801384 ] Haisheng Yuan commented on CALCITE-2947: It is duplicate with https://issues.apache.org/jira/browse/CALCITE-2893 > Type mismatch assertion error when converting NOT IN subquery > - > > Key: CALCITE-2947 > URL: https://issues.apache.org/jira/browse/CALCITE-2947 > Project: Calcite > Issue Type: Bug > Components: core >Reporter: Haisheng Yuan >Priority: Major > > Repro: > Add the following test to SqlToRelConverterTest.java. > {code:java} > @Test public void testSubQueryNotIN() { > final String sql = "select deptno\n" > + "from EMP e\n" > + "where deptno not in (select deptno\n" > + "from EMP where empno=e.empno)"; > sql(sql).ok(); > } > {code} > Error: > {code:java} > java.lang.AssertionError: type mismatch: > ref: > INTEGER NOT NULL > input: > INTEGER > at org.apache.calcite.util.Litmus$1.fail(Litmus.java:31) > at org.apache.calcite.plan.RelOptUtil.eq(RelOptUtil.java:1832) > at org.apache.calcite.rex.RexChecker.visitInputRef(RexChecker.java:125) > at org.apache.calcite.rex.RexChecker.visitInputRef(RexChecker.java:57) > at org.apache.calcite.rex.RexInputRef.accept(RexInputRef.java:112) > at org.apache.calcite.rex.RexChecker.visitCall(RexChecker.java:140) > at org.apache.calcite.rex.RexChecker.visitCall(RexChecker.java:57) > at org.apache.calcite.rex.RexCall.accept(RexCall.java:191) > at org.apache.calcite.rel.core.Filter.isValid(Filter.java:120) > at > org.apache.calcite.rel.logical.LogicalFilter.(LogicalFilter.java:70) > at > org.apache.calcite.rel.logical.LogicalFilter.create(LogicalFilter.java:114) > at > org.apache.calcite.rel.logical.LogicalFilter.create(LogicalFilter.java:101) > at > org.apache.calcite.rel.core.RelFactories$FilterFactoryImpl.createFilter(RelFactories.java:300) > at > org.apache.calcite.sql2rel.SqlToRelConverter.createJoin(SqlToRelConverter.java:2433) > {code} > If we change not in subquery to in subquery, it can run without error. -- This message was sent by Atlassian JIRA (v7.6.3#76005)
[jira] [Commented] (CALCITE-2947) Type mismatch assertion error when converting NOT IN subquery
[ https://issues.apache.org/jira/browse/CALCITE-2947?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16801427#comment-16801427 ] Xiening Dai commented on CALCITE-2947: -- This is different than CALCITE-2901. In Haisheng's test, the exception is thrown while building below logic plan - LogicalFilter(condition=[=($9, $10)]) LogicalCorrelate(correlation=[$cor0], joinType=[left], requiredColumns=[{0}]) LogicalProject(EMPNO=[$0], ENAME=[$1], JOB=[$2], MGR=[$3], HIREDATE=[$4], SAL=[$5], COMM=[$6], DEPTNO=[$7], SLACKER=[$8], DEPTNO0=[$7]) LogicalTableScan(table=[[CATALOG, SALES, EMP]]) LogicalAggregate(group=[{0}], agg#0=[MIN($1)]) LogicalProject(DEPTNO=[$7], $f1=[true]) LogicalFilter(condition=[=($0, $cor0.EMPNO)]) LogicalTableScan(table=[[CATALOG, SALES, EMP]]) When creating LogicalCorrelate, since the correlate has left join type, its row type is derived from join row type which would add nullability to the original INTEGER type (see SqlValidatorUtil.deriveJoinRowType), and cause the validation of filter node to fail. In my view, this issue cannot be fixed without generating a different plan. The fix of Calcite-2004, which pushes down the filter, might fix this as well. > Type mismatch assertion error when converting NOT IN subquery > - > > Key: CALCITE-2947 > URL: https://issues.apache.org/jira/browse/CALCITE-2947 > Project: Calcite > Issue Type: Bug > Components: core >Reporter: Haisheng Yuan >Priority: Major > > Repro: > Add the following test to SqlToRelConverterTest.java. > {code:java} > @Test public void testSubQueryNotIN() { > final String sql = "select deptno\n" > + "from EMP e\n" > + "where deptno not in (select deptno\n" > + "from EMP where empno=e.empno)"; > sql(sql).ok(); > } > {code} > Error: > {code:java} > java.lang.AssertionError: type mismatch: > ref: > INTEGER NOT NULL > input: > INTEGER > at org.apache.calcite.util.Litmus$1.fail(Litmus.java:31) > at org.apache.calcite.plan.RelOptUtil.eq(RelOptUtil.java:1832) > at org.apache.calcite.rex.RexChecker.visitInputRef(RexChecker.java:125) > at org.apache.calcite.rex.RexChecker.visitInputRef(RexChecker.java:57) > at org.apache.calcite.rex.RexInputRef.accept(RexInputRef.java:112) > at org.apache.calcite.rex.RexChecker.visitCall(RexChecker.java:140) > at org.apache.calcite.rex.RexChecker.visitCall(RexChecker.java:57) > at org.apache.calcite.rex.RexCall.accept(RexCall.java:191) > at org.apache.calcite.rel.core.Filter.isValid(Filter.java:120) > at > org.apache.calcite.rel.logical.LogicalFilter.(LogicalFilter.java:70) > at > org.apache.calcite.rel.logical.LogicalFilter.create(LogicalFilter.java:114) > at > org.apache.calcite.rel.logical.LogicalFilter.create(LogicalFilter.java:101) > at > org.apache.calcite.rel.core.RelFactories$FilterFactoryImpl.createFilter(RelFactories.java:300) > at > org.apache.calcite.sql2rel.SqlToRelConverter.createJoin(SqlToRelConverter.java:2433) > {code} > If we change not in subquery to in subquery, it can run without error. -- This message was sent by Atlassian JIRA (v7.6.3#76005)