Ruben Q L created CALCITE-6474:
----------------------------------

             Summary: Aggregate with constant key can get a RowCount greater 
than its MaxRowCount
                 Key: CALCITE-6474
                 URL: https://issues.apache.org/jira/browse/CALCITE-6474
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.37.0
            Reporter: Ruben Q L
            Assignee: Ruben Q L
             Fix For: 1.38.0


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

The root cause is that this logic in RelMdMaxRowCount
{code}
// 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;
  }
}
{code}
is not applied in RelMdRowCount.

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







--
This message was sent by Atlassian Jira
(v8.20.10#820010)

Reply via email to