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_r347891809
##########
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:
I find the 'assertEquals' in many places.Maybe be we could fix it in
another PR.and use 'assertThat' in Calcite.
----------------------------------------------------------------
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:
[email protected]
With regards,
Apache Git Services