You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@calcite.apache.org by "Haisheng Yuan (JIRA)" <ji...@apache.org> on 2019/04/16 23:17:00 UTC

[jira] [Created] (CALCITE-3007) Type mismatch for > ANY subquery in project

Haisheng Yuan created CALCITE-3007:
--------------------------------------

             Summary: Type mismatch for > ANY subquery in project
                 Key: CALCITE-3007
                 URL: https://issues.apache.org/jira/browse/CALCITE-3007
             Project: Calcite
          Issue Type: Bug
          Components: core
            Reporter: Haisheng Yuan


Repro:

{code:java}
@Test public void testGtAnyInProject() {
    final String sql = "select name, \n"
        + " deptno > ANY (\n"
        + " select deptno from emp) \n"
        + " from dept";
    checkSubQuery(sql).withLateDecorrelation(true).check();
  }
{code}

Exception:

{code:java}
java.lang.AssertionError: Cannot add expression of different type to set:
set type is RecordType(VARCHAR(10) NOT NULL NAME, BOOLEAN NOT NULL EXPR$1) NOT NULL
expression type is RecordType(VARCHAR(10) NOT NULL NAME, BOOLEAN EXPR$1) NOT NULL
set is rel#5:LogicalProject(input=HepRelVertex#4,NAME=$1,EXPR$1=> SOME($0, {
LogicalProject(DEPTNO=[$7])
  LogicalTableScan(table=[[CATALOG, SALES, EMP]])
}))
expression is LogicalProject(NAME=[$1], EXPR$1=[OR(AND(IS TRUE(>($0, $2)), <>($3, 0)), AND(>($3, $4), null, <>($3, 0), IS NOT TRUE(>($0, $2))), AND(>($0, $2), <>($3, 0), IS NOT TRUE(>($0, $2)), <=($3, $4)))])
  LogicalJoin(condition=[true], joinType=[inner])
    LogicalTableScan(table=[[CATALOG, SALES, DEPT]])
    LogicalAggregate(group=[{}], m=[MIN($0)], c=[COUNT()], d=[COUNT($0)])
      LogicalProject(DEPTNO=[$7])
        LogicalTableScan(table=[[CATALOG, SALES, EMP]])


	at org.apache.calcite.plan.RelOptUtil.verifyTypeEquivalence(RelOptUtil.java:382)
	at org.apache.calcite.plan.hep.HepRuleCall.transformTo(HepRuleCall.java:57)
	at org.apache.calcite.plan.RelOptRuleCall.transformTo(RelOptRuleCall.java:236)
	at org.apache.calcite.rel.rules.SubQueryRemoveRule$SubQueryProjectRemoveRule.onMatch(SubQueryRemoveRule.java:519)
{code}





--
This message was sent by Atlassian JIRA
(v7.6.3#76005)