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

Union's getRowCount in RelMdRowCount has not consider 'union all'

    XMLWordPrintableJSON

    Details

      Description

      when I read the RelMdRowCount.java, I found that union's getRowCount has not consider 'union all', while in Union.estimateRowCount has. I am not sure whether this is a bug, if it is, I can help fix it.

      RelMdRowCount.java
      public Double getRowCount(Union rel, RelMetadataQuery mq) {
          double rowCount = 0.0;
          for (RelNode input : rel.getInputs()) {
            Double partialRowCount = mq.getRowCount(input);
            if (partialRowCount == null) {
              return null;
            }
            rowCount += partialRowCount;
          }
          return rowCount;
        }
      
      Union.java
        @Override public double estimateRowCount(RelMetadataQuery mq) {
          double dRows = RelMdUtil.getUnionAllRowCount(mq, this);
          if (!all) {
            dRows *= 0.5;
          }
          return dRows;
        }
      

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                shenhong Hong Shen
              • 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 - 1h
                  1h