[ 
https://issues.apache.org/jira/browse/CALCITE-3287?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Hong Shen updated CALCITE-3287:
-------------------------------
    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 is this a bug, if it is, I can help fix it.
{code:java}
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;
  }
{code}

  was:
when I read the RelMdRowCount.java, I found that union's getRowCount has not 
consider 'union all', while in Union.estimateRowCount has. can any body tell me 
why?

{code}
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;
  }
{code}



> Union's getRowCount in RelMdRowCount has not consider 'union all'
> -----------------------------------------------------------------
>
>                 Key: CALCITE-3287
>                 URL: https://issues.apache.org/jira/browse/CALCITE-3287
>             Project: Calcite
>          Issue Type: Bug
>          Components: core
>            Reporter: Hong Shen
>            Priority: Minor
>
> 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 is this a bug, if it is, I can help fix it.
> {code:java}
> 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;
>   }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to