Uploaded image for project: 'Calcite'
  1. Calcite
  2. CALCITE-2105

AggregateJoinTransposeRule fails when process aggregate without group keys

    Details

    • Type: Bug
    • Status: Closed
    • Priority: Major
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 1.16.0
    • Component/s: None
    • Labels:
      None

      Description

      select sum(sal) from (select * from sales.emp where empno = 10) as e join sales.dept as d on e.job = d.name
      

      AggregateJoinTransposeRule will broken when process the above sql, thrown exception is

      java.lang.AssertionError: type mismatch:
      aggCall type:
      INTEGER
      inferred type:
      INTEGER NOT NULL
      
      	at org.apache.calcite.util.Litmus$1.fail(Litmus.java:31)
      	at org.apache.calcite.plan.RelOptUtil.eq(RelOptUtil.java:1838)
      	at org.apache.calcite.rel.core.Aggregate.typeMatchesInferred(Aggregate.java:428)
      	at org.apache.calcite.rel.core.Aggregate.<init>(Aggregate.java:161)
      	at org.apache.calcite.rel.logical.LogicalAggregate.<init>(LogicalAggregate.java:65)
      	at org.apache.calcite.rel.logical.LogicalAggregate.create_(LogicalAggregate.java:110)
      	at org.apache.calcite.rel.logical.LogicalAggregate.create(LogicalAggregate.java:100)
      	at org.apache.calcite.rel.core.RelFactories$AggregateFactoryImpl.createAggregate(RelFactories.java:213)
      	at org.apache.calcite.tools.RelBuilder.aggregate(RelBuilder.java:1267)
      	at org.apache.calcite.tools.RelBuilder.aggregate(RelBuilder.java:1825)
      	at org.apache.calcite.rel.rules.AggregateJoinTransposeRule.onMatch(AggregateJoinTransposeRule.java:260)
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                julianhyde Julian Hyde
                Reporter:
                jinyu.zj jingzhang
              • Votes:
                0 Vote for this issue
                Watchers:
                3 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: