Mihai Budiu created CALCITE-7957:
------------------------------------

             Summary: The plan that HepPlanner returns depends on whether the 
JVM runs with assertions enabled
                 Key: CALCITE-7957
                 URL: https://issues.apache.org/jira/browse/CALCITE-7957
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.42.0
            Reporter: Mihai Budiu


The existing test {{RelOptRulesTest.testPullAggregateThroughUnionWithAlias}} 
fails when assertions are disabled:
{code}
./gradlew :core:test --tests 
"org.apache.calcite.test.RelOptRulesTest.testPullAggregateThroughUnionWithAlias"
 -PtestExtraJvmArgs="-da"
{code}

The test applies {{AGGREGATE_PROJECT_MERGE}} and {{AGGREGATE_UNION_AGGREGATE}} 
in a HepPlanner to this query:
{code:sql}
select job, c from
  (select job, deptno c from emp as e1 group by job, deptno
   union all
   select job, deptno from emp as e2 group by job, deptno)
group by job, c
{code}

Plan with assertions enabled (this is the reference plan of the test):
{code}
LogicalAggregate(group=[{0, 1}])
  LogicalProject(JOB=[$0], C=[$1])
    LogicalUnion(all=[true])
      LogicalAggregate(group=[{2, 7}])
        LogicalTableScan(table=[[CATALOG, SALES, EMP]])
      LogicalProject(JOB=[$2], DEPTNO=[$7])
        LogicalTableScan(table=[[CATALOG, SALES, EMP]])
{code}

Plan with assertions disabled:
{code}
LogicalAggregate(group=[{0, 1}])
  LogicalUnion(all=[true])
    LogicalProject(JOB=[$2], DEPTNO=[$7])
      LogicalTableScan(table=[[CATALOG, SALES, EMP]])
    LogicalProject(JOB=[$2], DEPTNO=[$7])
      LogicalTableScan(table=[[CATALOG, SALES, EMP]])
{code}



--
This message was sent by Atlassian Jira
(v10.3.26#10030026)

Reply via email to