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

Aggregate with constant key can get a RowCount greater than its MaxRowCount

    XMLWordPrintableJSON

Details

    Description

      An Aggregate with constant key can get a RowCount greater than its MaxRowCount.

      The root cause is that this logic in RelMdMaxRowCount

      // Aggregate with constant GROUP BY always returns 1 row
      if (rel.getGroupType() == Aggregate.Group.SIMPLE) {
        final RelOptPredicateList predicateList =
          mq.getPulledUpPredicates(rel.getInput());
        if (!RelOptPredicateList.isEmpty(predicateList)
          && allGroupKeysAreConstant(rel, predicateList)) {
          return 1D;
        }
      }
      

      is not applied in RelMdRowCount.

      Therefore we can get an Aggregate whose MaxRowCount is 1, but its RowCount is X (> 1).

      Attachments

        Issue Links

          Activity

            People

              rubenql Ruben Q L
              rubenql Ruben Q L
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: