use of io.prestosql.spi.plan.TableScanNode in project hetu-core by openlookeng.
the class TestCostCalculator method testProject.
@Test
public void testProject() {
TableScanNode tableScan = tableScan("ts", "orderkey");
PlanNode project = project("project", tableScan, "string", new Cast(new SymbolReference("orderkey"), "STRING"));
Map<String, PlanCostEstimate> costs = ImmutableMap.of("ts", cpuCost(1000));
Map<String, PlanNodeStatsEstimate> stats = ImmutableMap.of("project", statsEstimate(project, 4000), "ts", statsEstimate(tableScan, 1000));
Map<String, Type> types = ImmutableMap.of("orderkey", BIGINT, "string", VARCHAR);
assertCost(project, costs, stats, types).cpu(1000 + 4000 * OFFSET_AND_IS_NULL_OVERHEAD).memory(0).network(0);
assertCostEstimatedExchanges(project, costs, stats, types).cpu(1000 + 4000 * OFFSET_AND_IS_NULL_OVERHEAD).memory(0).network(0);
assertCostFragmentedPlan(project, costs, stats, types).cpu(1000 + 4000 * OFFSET_AND_IS_NULL_OVERHEAD).memory(0).network(0);
assertCostHasUnknownComponentsForUnknownStats(project, types);
}
use of io.prestosql.spi.plan.TableScanNode in project hetu-core by openlookeng.
the class TestCostCalculator method testReplicatedJoinWithExchange.
@Test
public void testReplicatedJoinWithExchange() {
TableScanNode ts1 = tableScan("ts1", "orderkey");
TableScanNode ts2 = tableScan("ts2", "orderkey_0");
ExchangeNode remoteExchange2 = replicatedExchange(new PlanNodeId("re2"), REMOTE, ts2);
ExchangeNode localExchange = partitionedExchange(new PlanNodeId("le"), LOCAL, remoteExchange2, ImmutableList.of(new Symbol("orderkey_0")), Optional.empty());
JoinNode join = join("join", ts1, localExchange, JoinNode.DistributionType.REPLICATED, "orderkey", "orderkey_0");
Map<String, PlanNodeStatsEstimate> stats = ImmutableMap.<String, PlanNodeStatsEstimate>builder().put("join", statsEstimate(join, 12000)).put("re2", statsEstimate(remoteExchange2, 10000)).put("le", statsEstimate(localExchange, 6000)).put("ts1", statsEstimate(ts1, 6000)).put("ts2", statsEstimate(ts2, 1000)).build();
Map<String, Type> types = ImmutableMap.of("orderkey", BIGINT, "orderkey_0", BIGINT);
assertFragmentedEqualsUnfragmented(join, stats, types);
}
use of io.prestosql.spi.plan.TableScanNode in project hetu-core by openlookeng.
the class TestCostCalculator method testLimit.
@Test
public void testLimit() {
TableScanNode ts1 = tableScan("ts1", "orderkey");
LimitNode limit = new LimitNode(new PlanNodeId("limit"), ts1, 5, false);
Map<String, PlanNodeStatsEstimate> stats = ImmutableMap.of("ts1", statsEstimate(ts1, 4000), "limit", // 5 * average row size
statsEstimate(ts1, 40));
Map<String, PlanCostEstimate> costs = ImmutableMap.of("ts1", cpuCost(1000));
Map<String, Type> types = ImmutableMap.of("orderkey", BIGINT);
// Do not estimate cost other than CPU for limit node.
assertCost(limit, costs, stats, types).cpu(// 1000 + (is null boolean array) + 40
1045).memory(0).network(0);
assertCostEstimatedExchanges(limit, costs, stats, types).cpu(1045).memory(0).network(0);
}
use of io.prestosql.spi.plan.TableScanNode in project hetu-core by openlookeng.
the class TestCostCalculator method tableScan.
private TableScanNode tableScan(String id, String... symbols) {
List<Symbol> symbolsList = Arrays.stream(symbols).map(Symbol::new).collect(toImmutableList());
ImmutableMap.Builder<Symbol, ColumnHandle> assignments = ImmutableMap.builder();
for (Symbol symbol : symbolsList) {
assignments.put(symbol, new TpchColumnHandle("orderkey", BIGINT));
}
TpchTableHandle tableHandle = new TpchTableHandle("orders", 1.0);
return new TableScanNode(new PlanNodeId(id), new TableHandle(new CatalogName("tpch"), tableHandle, INSTANCE, Optional.of(new TpchTableLayoutHandle(tableHandle, TupleDomain.all()))), symbolsList, assignments.build(), TupleDomain.all(), Optional.empty(), ReuseExchangeOperator.STRATEGY.REUSE_STRATEGY_DEFAULT, new UUID(0, 0), 0, false);
}
use of io.prestosql.spi.plan.TableScanNode in project hetu-core by openlookeng.
the class TestCostCalculator method testTableScan.
@Test
public void testTableScan() {
TableScanNode tableScan = tableScan("ts", "orderkey");
Map<String, Type> types = ImmutableMap.of("orderkey", BIGINT);
assertCost(tableScan, ImmutableMap.of(), ImmutableMap.of("ts", statsEstimate(tableScan, 1000)), types).cpu(1000 * IS_NULL_OVERHEAD).memory(0).network(0);
assertCostEstimatedExchanges(tableScan, ImmutableMap.of(), ImmutableMap.of("ts", statsEstimate(tableScan, 1000)), types).cpu(1000 * IS_NULL_OVERHEAD).memory(0).network(0);
assertCostFragmentedPlan(tableScan, ImmutableMap.of(), ImmutableMap.of("ts", statsEstimate(tableScan, 1000)), types).cpu(1000 * IS_NULL_OVERHEAD).memory(0).network(0);
assertCostHasUnknownComponentsForUnknownStats(tableScan, types);
}
Aggregations