You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@calcite.apache.org by "chunfeng pei (Jira)" <ji...@apache.org> on 2020/09/26 00:00:00 UTC

[jira] [Created] (CALCITE-4281) fix getMaxRowCount for RelSubset to return reasonable values

chunfeng pei created CALCITE-4281:
-------------------------------------

             Summary: fix getMaxRowCount for RelSubset to return reasonable values 
                 Key: CALCITE-4281
                 URL: https://issues.apache.org/jira/browse/CALCITE-4281
             Project: Calcite
          Issue Type: Bug
          Components: core
    Affects Versions: 1.25.0
            Reporter: chunfeng pei
             Fix For: next


currently getMaxRowCount(RelSubset rel, RelMetadataQuery mq) only have a short term fix for CALCITE-1018.  https://issues.apache.org/jira/browse/CALCITE-1018

we need a complete solution for this, as suggested in https://issues.apache.org/jira/browse/CALCITE-1048

quotes: Clearly RelMdMaxRowCount of a RelSubset should be the lowest max-row-count of any relational expression in that subset. Each kind of metadata should have a way of deriving a subset's value from the constituent rel values; in the case of RelMdMaxRowCount the roll-up function is "min".

also a sample solution provided by [~weijie] : 
 public Double getMaxRowCount(RelSubset rel, RelMetadataQuery mq) {    Double lowest = Double.POSITIVE_INFINITY;    for (RelNode node : rel.getRels()) {      Double maxRowCount = mq.getMaxRowCount(node);      if (maxRowCount == null) {        continue;
      }      if (lowest.compareTo(maxRowCount) > 0) \{
        lowest = maxRowCount;
      }
    }    return lowest;
  }
then comments from [~jhyde] :

quote: I was thinking of doing the same thing in a more abstract way, namely providing a "[fold|https://en.wikipedia.org/wiki/Fold_(higher-order_function)]" function.

this ticket is opened to address this issue. this is also related to the following ticket:

https://issues.apache.org/jira/browse/CALCITE-3963



--
This message was sent by Atlassian Jira
(v8.3.4#803005)