org.apache.calcite.rel.logical.LogicalExchange Java Examples
The following examples show how to use
org.apache.calcite.rel.logical.LogicalExchange.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: RelMetadataTest.java From calcite with Apache License 2.0 | 6 votes |
@Test 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()); } assertThat(expected, equalTo(resultCount)); }
Example #2
Source File: RelDistributionTraitDef.java From Bats with Apache License 2.0 | 6 votes |
public RelNode convert(RelOptPlanner planner, RelNode rel, RelDistribution toDistribution, boolean allowInfiniteCostConverters) { if (toDistribution == RelDistributions.ANY) { return rel; } // Create a logical sort, then ask the planner to convert its remaining // traits (e.g. convert it to an EnumerableSortRel if rel is enumerable // convention) final Exchange exchange = LogicalExchange.create(rel, toDistribution); RelNode newRel = planner.register(exchange, rel); final RelTraitSet newTraitSet = rel.getTraitSet().replace(toDistribution); if (!newRel.getTraitSet().equals(newTraitSet)) { newRel = planner.changeTraits(newRel, newTraitSet); } return newRel; }
Example #3
Source File: RelDistributionTraitDef.java From calcite with Apache License 2.0 | 6 votes |
public RelNode convert(RelOptPlanner planner, RelNode rel, RelDistribution toDistribution, boolean allowInfiniteCostConverters) { if (toDistribution == RelDistributions.ANY) { return rel; } // Create a logical sort, then ask the planner to convert its remaining // traits (e.g. convert it to an EnumerableSortRel if rel is enumerable // convention) final Exchange exchange = LogicalExchange.create(rel, toDistribution); RelNode newRel = planner.register(exchange, rel); final RelTraitSet newTraitSet = rel.getTraitSet().replace(toDistribution); if (!newRel.getTraitSet().equals(newTraitSet)) { newRel = planner.changeTraits(newRel, newTraitSet); } return newRel; }
Example #4
Source File: RelMetadataTest.java From calcite with Apache License 2.0 | 5 votes |
@Test void testDistributionSingleton() { final RelNode rel = convertSql("select * from emp"); final RelDistribution dist = RelDistributions.SINGLETON; final LogicalExchange exchange = LogicalExchange.create(rel, dist); final RelMetadataQuery mq = rel.getCluster().getMetadataQuery(); RelDistribution d = mq.getDistribution(exchange); assertThat(d, is(dist)); }
Example #5
Source File: RelMetadataTest.java From calcite with Apache License 2.0 | 5 votes |
@Test 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 = rel.getCluster().getMetadataQuery(); RelDistribution d = mq.getDistribution(exchange); assertThat(d, is(dist)); }
Example #6
Source File: RelMetadataTest.java From calcite with Apache License 2.0 | 5 votes |
@Test 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 = rel.getCluster().getMetadataQuery(); RelDistribution d = mq.getDistribution(exchange); assertThat(d, is(dist)); }
Example #7
Source File: CopyWithCluster.java From dremio-oss with Apache License 2.0 | 5 votes |
@Override public RelNode visit(LogicalExchange exchange) { final RelNode input = exchange.getInput().accept(this); return new LogicalExchange( cluster, copyOf(exchange.getTraitSet()), input, exchange.getDistribution() ); }
Example #8
Source File: RelMetadataTest.java From calcite with Apache License 2.0 | 5 votes |
@Test 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); }
Example #9
Source File: RelHomogeneousShuttle.java From calcite with Apache License 2.0 | 4 votes |
@Override public RelNode visit(LogicalExchange exchange) { return visit((RelNode) exchange); }
Example #10
Source File: CalciteMaterializer.java From calcite with Apache License 2.0 | 4 votes |
public RelNode visit(LogicalExchange exchange) { return exchange; }
Example #11
Source File: RelFactories.java From calcite with Apache License 2.0 | 4 votes |
@Override public RelNode createExchange( RelNode input, RelDistribution distribution) { return LogicalExchange.create(input, distribution); }
Example #12
Source File: RelShuttleImpl.java From calcite with Apache License 2.0 | 4 votes |
public RelNode visit(LogicalExchange exchange) { return visitChildren(exchange); }
Example #13
Source File: RoutingShuttle.java From dremio-oss with Apache License 2.0 | 4 votes |
@Override public RelNode visit(LogicalExchange exchange) { return visit((RelNode) exchange); }
Example #14
Source File: JoinUtils.java From Bats with Apache License 2.0 | 4 votes |
@Override public RelNode visit(LogicalExchange exchange) { return exchange; }
Example #15
Source File: RelFactories.java From Bats with Apache License 2.0 | 4 votes |
@Override public RelNode createExchange( RelNode input, RelDistribution distribution) { return LogicalExchange.create(input, distribution); }
Example #16
Source File: RelShuttleImpl.java From Bats with Apache License 2.0 | 4 votes |
public RelNode visit(LogicalExchange exchange) { return visitChildren(exchange); }
Example #17
Source File: RelHomogeneousShuttle.java From Bats with Apache License 2.0 | 4 votes |
@Override public RelNode visit(LogicalExchange exchange) { return visit((RelNode) exchange); }
Example #18
Source File: RelShuttle.java From Bats with Apache License 2.0 | votes |
RelNode visit(LogicalExchange exchange);
Example #19
Source File: RelShuttle.java From calcite with Apache License 2.0 | votes |
RelNode visit(LogicalExchange exchange);