Search in sources :

Example 1 with LogicalExchange

use of org.apache.calcite.rel.logical.LogicalExchange in project calcite by apache.

the class RelMetadataTest method testDistributionHashEmpty.

@Test
public void testDistributionHashEmpty() {
    final RelNode rel = convertSql("select * from emp");
    final RelDistribution dist = RelDistributions.hash(ImmutableList.<Integer>of());
    final LogicalExchange exchange = LogicalExchange.create(rel, dist);
    final RelMetadataQuery mq = RelMetadataQuery.instance();
    RelDistribution d = mq.getDistribution(exchange);
    assertThat(d, is(dist));
}
Also used : RelMetadataQuery(org.apache.calcite.rel.metadata.RelMetadataQuery) RelNode(org.apache.calcite.rel.RelNode) LogicalExchange(org.apache.calcite.rel.logical.LogicalExchange) RelDistribution(org.apache.calcite.rel.RelDistribution) Test(org.junit.Test)

Example 2 with LogicalExchange

use of org.apache.calcite.rel.logical.LogicalExchange in project calcite by apache.

the class RelMetadataTest method testDistributionHash.

@Test
public void testDistributionHash() {
    final RelNode rel = convertSql("select * from emp");
    final RelDistribution dist = RelDistributions.hash(ImmutableList.of(1));
    final LogicalExchange exchange = LogicalExchange.create(rel, dist);
    final RelMetadataQuery mq = RelMetadataQuery.instance();
    RelDistribution d = mq.getDistribution(exchange);
    assertThat(d, is(dist));
}
Also used : RelMetadataQuery(org.apache.calcite.rel.metadata.RelMetadataQuery) RelNode(org.apache.calcite.rel.RelNode) LogicalExchange(org.apache.calcite.rel.logical.LogicalExchange) RelDistribution(org.apache.calcite.rel.RelDistribution) Test(org.junit.Test)

Example 3 with LogicalExchange

use of org.apache.calcite.rel.logical.LogicalExchange in project calcite by apache.

the class RelMetadataTest method testDistributionSingleton.

@Test
public void testDistributionSingleton() {
    final RelNode rel = convertSql("select * from emp");
    final RelDistribution dist = RelDistributions.SINGLETON;
    final LogicalExchange exchange = LogicalExchange.create(rel, dist);
    final RelMetadataQuery mq = RelMetadataQuery.instance();
    RelDistribution d = mq.getDistribution(exchange);
    assertThat(d, is(dist));
}
Also used : RelMetadataQuery(org.apache.calcite.rel.metadata.RelMetadataQuery) RelNode(org.apache.calcite.rel.RelNode) LogicalExchange(org.apache.calcite.rel.logical.LogicalExchange) RelDistribution(org.apache.calcite.rel.RelDistribution) Test(org.junit.Test)

Aggregations

RelDistribution (org.apache.calcite.rel.RelDistribution)3 RelNode (org.apache.calcite.rel.RelNode)3 LogicalExchange (org.apache.calcite.rel.logical.LogicalExchange)3 RelMetadataQuery (org.apache.calcite.rel.metadata.RelMetadataQuery)3 Test (org.junit.Test)3