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

Failed to materialize when the aggregate function uses group key

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Fixed
    • None
    • 1.21.0
    • None

    Description

      Repro:

      @Test public void testAggregateGroupSetsRollUp() {
          checkMaterialize(
              "select \"empid\", \"deptno\", count(*) as c, sum(\"empid\") as s from \"emps\" "
                  + "group by \"empid\", \"deptno\"",
              "select count(*) + 1 as c,  \"deptno\" from \"emps\" group by cube(\"empid\",\"deptno\")",
              HR_FKUK_MODEL,
              CalciteAssert.checkResultContains(
                  "EnumerableCalc(expr#0..2=[{inputs}], expr#3=[1], "
                      + "expr#4=[+($t2, $t3)], C=[$t4], deptno=[$t1])\n"
                      + "  EnumerableAggregate(group=[{0, 1}], groups=[[{0, 1}, {0}, {1}, {}]], agg#0=[$SUM0($2)])\n"
                      + "    EnumerableTableScan(table=[[hr, m0]])"));
        }
      

      Note that if we change sum(\"empid\") to sum("salary"), it can materialize successfully.

      Attachments

        Issue Links

          Activity

            People

              donnyzone Feng Zhu
              hyuan Haisheng Yuan
              Votes:
              0 Vote for this issue
              Watchers:
              4 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 0.5h
                  0.5h