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/11/19 08:36:08 UTC

[GitHub] [calcite] xy2953396112 commented on a change in pull request #1552: [CALCITE-3454] Support Exchange, SetOp, TableModify.. in RelMd

xy2953396112 commented on a change in pull request #1552: [CALCITE-3454] Support Exchange,SetOp,TableModify.. in RelMd
URL: https://github.com/apache/calcite/pull/1552#discussion_r347788552
 
 

 ##########
 File path: core/src/test/java/org/apache/calcite/test/RelMetadataTest.java
 ##########
 @@ -2557,6 +2592,37 @@ private void checkNodeTypeCount(String sql, Map<Class<? extends RelNode>, Intege
     checkNodeTypeCount(sql, expected);
   }
 
+  @Test public void testNodeTypeCountExchange() {
+
+    final RelNode rel = convertSql("select * from emp");
+    final RelDistribution dist = RelDistributions.hash(ImmutableList.<Integer>of());
+    final LogicalExchange exchange = LogicalExchange.create(rel, dist);
+
+    final Map<Class<? extends RelNode>, Integer> expected = new HashMap<>();
+    expected.put(TableScan.class, 1);
+    expected.put(Exchange.class, 1);
+    expected.put(Project.class, 1);
+
+    final RelMetadataQuery mq = rel.getCluster().getMetadataQuery();
+    final Multimap<Class<? extends RelNode>, RelNode> result = mq.getNodeTypes(exchange);
+    assertThat(result, notNullValue());
+    final Map<Class<? extends RelNode>, Integer> resultCount = new HashMap<>();
+    for (Entry<Class<? extends RelNode>, Collection<RelNode>> e : result.asMap().entrySet()) {
+      resultCount.put(e.getKey(), e.getValue().size());
+    }
+    assertEquals(expected, resultCount);
+  }
 
 Review comment:
   Thanks for you review.I have changed it.

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