You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by GitBox <gi...@apache.org> on 2019/08/25 22:33:51 UTC

[GitHub] [calcite] hsyuan commented on a change in pull request #1410: [CALCITE-3287] Fix minor bug, getRowCount for union in RelMdRowCount.java not consider 'union all'

hsyuan commented on a change in pull request #1410: [CALCITE-3287] Fix minor bug, getRowCount for union in RelMdRowCount.java not consider 'union all'
URL: https://github.com/apache/calcite/pull/1410#discussion_r317417476
 
 

 ##########
 File path: core/src/main/java/org/apache/calcite/rel/metadata/RelMdRowCount.java
 ##########
 @@ -83,15 +83,7 @@ public Double getRowCount(RelSubset subset, RelMetadataQuery mq) {
   }
 
   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;
+    return rel.estimateRowCount(mq);
 
 Review comment:
   `Union.estimateRowCount` doesn't take into account the case that one of the inputs might return null.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services