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

fix getMaxRowCount for RelSubset to return reasonable values

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Open
    • Major
    • Resolution: Unresolved
    • 1.25.0
    • None
    • core
    • None

    Description

      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" 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

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              ChunfengPei chunfeng pei
              Votes:
              0 Vote for this issue
              Watchers:
              5 Start watching this issue

              Dates

                Created:
                Updated: