You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@calcite.apache.org by hy...@apache.org on 2019/10/30 06:33:01 UTC

[calcite] branch master updated (1bf7222 -> d51f76c)

This is an automated email from the ASF dual-hosted git repository.

hyuan pushed a change to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git.


    omit 1bf7222  [CALCITE-3454] Support Exchange in RelMdMaxRowCount,RelMdMinRowCount,RelMdRowCount (xy2953396112)
     new d51f76c  [CALCITE-3454] Support Exchange in RelMdMaxRowCount,RelMdMinRowCount,RelMdRowCount (xy2953396112)

This update added new revisions after undoing existing revisions.
That is to say, some revisions that were in the old version of the
branch are not in the new version.  This situation occurs
when a user --force pushes a change and generates a repository
containing something like this:

 * -- * -- B -- O -- O -- O   (1bf7222)
            \
             N -- N -- N   refs/heads/master (d51f76c)

You should already have received notification emails for all of the O
revisions, and so the following emails describe only the N revisions
from the common base, B.

Any revisions marked "omit" are not gone; other references still
refer to them.  Any revisions marked "discard" are gone forever.

The 1 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 core/src/main/java/org/apache/calcite/rel/metadata/RelMdRowCount.java | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)


[calcite] 01/01: [CALCITE-3454] Support Exchange in RelMdMaxRowCount, RelMdMinRowCount, RelMdRowCount (xy2953396112)

Posted by hy...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

hyuan pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/calcite.git

commit d51f76c19b4dca8e55d04409ed4af103ac7eca25
Author: dz <95...@qq.com>
AuthorDate: Mon Oct 28 20:21:17 2019 +0800

    [CALCITE-3454] Support Exchange in RelMdMaxRowCount,RelMdMinRowCount,RelMdRowCount (xy2953396112)
    
    Close #1542
---
 .../calcite/rel/metadata/RelMdMaxRowCount.java     |  5 +++++
 .../calcite/rel/metadata/RelMdMinRowCount.java     |  5 +++++
 .../apache/calcite/rel/metadata/RelMdRowCount.java |  5 +++++
 .../org/apache/calcite/test/RelMetadataTest.java   | 22 ++++++++++++++++++++++
 4 files changed, 37 insertions(+)

diff --git a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdMaxRowCount.java b/core/src/main/java/org/apache/calcite/rel/metadata/RelMdMaxRowCount.java
index 7058a6c..a2b7645 100644
--- a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdMaxRowCount.java
+++ b/core/src/main/java/org/apache/calcite/rel/metadata/RelMdMaxRowCount.java
@@ -21,6 +21,7 @@ import org.apache.calcite.plan.RelOptPredicateList;
 import org.apache.calcite.plan.volcano.RelSubset;
 import org.apache.calcite.rel.RelNode;
 import org.apache.calcite.rel.core.Aggregate;
+import org.apache.calcite.rel.core.Exchange;
 import org.apache.calcite.rel.core.Filter;
 import org.apache.calcite.rel.core.Intersect;
 import org.apache.calcite.rel.core.Join;
@@ -92,6 +93,10 @@ public class RelMdMaxRowCount
     return mq.getMaxRowCount(rel.getInput());
   }
 
+  public Double getMaxRowCount(Exchange rel, RelMetadataQuery mq) {
+    return mq.getMaxRowCount(rel.getInput());
+  }
+
   public Double getMaxRowCount(Sort rel, RelMetadataQuery mq) {
     Double rowCount = mq.getMaxRowCount(rel.getInput());
     if (rowCount == null) {
diff --git a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdMinRowCount.java b/core/src/main/java/org/apache/calcite/rel/metadata/RelMdMinRowCount.java
index e34bedc..11067ad 100644
--- a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdMinRowCount.java
+++ b/core/src/main/java/org/apache/calcite/rel/metadata/RelMdMinRowCount.java
@@ -20,6 +20,7 @@ import org.apache.calcite.adapter.enumerable.EnumerableLimit;
 import org.apache.calcite.plan.volcano.RelSubset;
 import org.apache.calcite.rel.RelNode;
 import org.apache.calcite.rel.core.Aggregate;
+import org.apache.calcite.rel.core.Exchange;
 import org.apache.calcite.rel.core.Filter;
 import org.apache.calcite.rel.core.Intersect;
 import org.apache.calcite.rel.core.Join;
@@ -77,6 +78,10 @@ public class RelMdMinRowCount
     return mq.getMinRowCount(rel.getInput());
   }
 
+  public Double getMinRowCount(Exchange rel, RelMetadataQuery mq) {
+    return mq.getMinRowCount(rel.getInput());
+  }
+
   public Double getMinRowCount(Sort rel, RelMetadataQuery mq) {
     Double rowCount = mq.getMinRowCount(rel.getInput());
     if (rowCount == null) {
diff --git a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdRowCount.java b/core/src/main/java/org/apache/calcite/rel/metadata/RelMdRowCount.java
index 53784f7..4c2d311 100644
--- a/core/src/main/java/org/apache/calcite/rel/metadata/RelMdRowCount.java
+++ b/core/src/main/java/org/apache/calcite/rel/metadata/RelMdRowCount.java
@@ -22,6 +22,7 @@ import org.apache.calcite.rel.RelNode;
 import org.apache.calcite.rel.SingleRel;
 import org.apache.calcite.rel.core.Aggregate;
 import org.apache.calcite.rel.core.Calc;
+import org.apache.calcite.rel.core.Exchange;
 import org.apache.calcite.rel.core.Filter;
 import org.apache.calcite.rel.core.Intersect;
 import org.apache.calcite.rel.core.Join;
@@ -212,6 +213,10 @@ public class RelMdRowCount
   public Double getRowCount(Values rel, RelMetadataQuery mq) {
     return rel.estimateRowCount(mq);
   }
+
+  public Double getRowCount(Exchange rel, RelMetadataQuery mq) {
+    return mq.getRowCount(rel.getInput());
+  }
 }
 
 // End RelMdRowCount.java
diff --git a/core/src/test/java/org/apache/calcite/test/RelMetadataTest.java b/core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
index 96d2de0..8197543 100644
--- a/core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
+++ b/core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
@@ -498,6 +498,20 @@ public class RelMetadataTest extends SqlToRelTestBase {
     assertThat(min, is(expectedMin));
   }
 
+  private void checkExchangeRowCount(RelNode rel, double expected, double expectedMin,
+      double expectedMax) {
+    final RelMetadataQuery mq = rel.getCluster().getMetadataQuery();
+    final Double result = mq.getRowCount(rel);
+    assertThat(result, notNullValue());
+    assertEquals(expected, result, 0d);
+    final Double max = mq.getMaxRowCount(rel);
+    assertThat(max, notNullValue());
+    assertEquals(expectedMax, max, 0d);
+    final Double min = mq.getMinRowCount(rel);
+    assertThat(max, notNullValue());
+    assertEquals(expectedMin, min, 0d);
+  }
+
   @Test public void testRowCountEmp() {
     final String sql = "select * from emp";
     checkRowCount(sql, EMP_SIZE, 0D, Double.POSITIVE_INFINITY);
@@ -623,6 +637,14 @@ public class RelMetadataTest extends SqlToRelTestBase {
     checkRowCount(sql, EMP_SIZE, 0D, Double.POSITIVE_INFINITY);
   }
 
+  @Test public void testRowCountExchange() {
+    final String sql = "select * from emp order by ename limit 123456";
+    RelNode rel = convertSql(sql);
+    final RelDistribution dist = RelDistributions.hash(ImmutableList.<Integer>of());
+    final LogicalExchange exchange = LogicalExchange.create(rel, dist);
+    checkExchangeRowCount(exchange, EMP_SIZE, 0D, 123456D);
+  }
+
   @Test public void testRowCountSortHighLimit() {
     final String sql = "select * from emp order by ename limit 123456";
     checkRowCount(sql, EMP_SIZE, 0D, 123456D);