use of io.trino.sql.planner.plan.RemoteSourceNode in project trino by trinodb.
the class PlanUtils method createAggregationFragment.
static PlanFragment createAggregationFragment(String name, PlanFragment sourceFragment) {
RemoteSourceNode source = new RemoteSourceNode(new PlanNodeId("source_id"), sourceFragment.getId(), ImmutableList.of(), Optional.empty(), REPARTITION, RetryPolicy.NONE);
PlanNode planNode = new AggregationNode(new PlanNodeId(name + "_id"), source, ImmutableMap.of(), singleGroupingSet(ImmutableList.of()), ImmutableList.of(), FINAL, Optional.empty(), Optional.empty());
return createFragment(planNode);
}
use of io.trino.sql.planner.plan.RemoteSourceNode in project trino by trinodb.
the class PlanUtils method createBroadcastAndPartitionedJoinPlanFragment.
static PlanFragment createBroadcastAndPartitionedJoinPlanFragment(String name, PlanFragment broadcastBuildFragment, PlanFragment partitionedBuildFragment, PlanFragment probeFragment) {
RemoteSourceNode probe = new RemoteSourceNode(new PlanNodeId("probe_id"), probeFragment.getId(), ImmutableList.of(), Optional.empty(), REPARTITION, RetryPolicy.NONE);
RemoteSourceNode broadcastBuild = new RemoteSourceNode(new PlanNodeId("broadcast_build_id"), broadcastBuildFragment.getId(), ImmutableList.of(), Optional.empty(), REPLICATE, RetryPolicy.NONE);
RemoteSourceNode partitionedBuild = new RemoteSourceNode(new PlanNodeId("partitioned_build_id"), partitionedBuildFragment.getId(), ImmutableList.of(), Optional.empty(), REPARTITION, RetryPolicy.NONE);
PlanNode broadcastPlanNode = new JoinNode(new PlanNodeId(name + "_broadcast_id"), INNER, probe, broadcastBuild, ImmutableList.of(), probe.getOutputSymbols(), broadcastBuild.getOutputSymbols(), false, Optional.empty(), Optional.empty(), Optional.empty(), Optional.of(REPLICATED), Optional.empty(), ImmutableMap.of(), Optional.empty());
PlanNode partitionedPlanNode = new JoinNode(new PlanNodeId(name + "_partitioned_id"), INNER, broadcastPlanNode, partitionedBuild, ImmutableList.of(), broadcastPlanNode.getOutputSymbols(), partitionedBuild.getOutputSymbols(), false, Optional.empty(), Optional.empty(), Optional.empty(), Optional.of(PARTITIONED), Optional.empty(), ImmutableMap.of(), Optional.empty());
return createFragment(partitionedPlanNode);
}
use of io.trino.sql.planner.plan.RemoteSourceNode in project trino by trinodb.
the class TestFaultTolerantStageScheduler method createPlanFragment.
private PlanFragment createPlanFragment() {
Symbol probeColumnSymbol = new Symbol("probe_column");
Symbol buildColumnSymbol = new Symbol("build_column");
TableScanNode tableScan = new TableScanNode(TABLE_SCAN_NODE_ID, TEST_TABLE_HANDLE, ImmutableList.of(probeColumnSymbol), ImmutableMap.of(probeColumnSymbol, new TestingColumnHandle("column")), TupleDomain.none(), Optional.empty(), false, Optional.empty());
RemoteSourceNode remoteSource = new RemoteSourceNode(new PlanNodeId("remote_source_id"), ImmutableList.of(SOURCE_FRAGMENT_ID_1, SOURCE_FRAGMENT_ID_2), ImmutableList.of(buildColumnSymbol), Optional.empty(), REPLICATE, TASK);
return new PlanFragment(FRAGMENT_ID, new JoinNode(new PlanNodeId("join_id"), INNER, tableScan, remoteSource, ImmutableList.of(), tableScan.getOutputSymbols(), remoteSource.getOutputSymbols(), false, Optional.empty(), Optional.empty(), Optional.empty(), Optional.of(REPLICATED), Optional.empty(), ImmutableMap.of(), Optional.empty()), ImmutableMap.of(probeColumnSymbol, VARCHAR, buildColumnSymbol, VARCHAR), SOURCE_DISTRIBUTION, ImmutableList.of(TABLE_SCAN_NODE_ID), new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), ImmutableList.of(probeColumnSymbol, buildColumnSymbol)), ungroupedExecution(), StatsAndCosts.empty(), Optional.empty());
}
use of io.trino.sql.planner.plan.RemoteSourceNode in project trino by trinodb.
the class TestingTaskSourceFactory method getHandlesForRemoteSources.
private static ListMultimap<PlanNodeId, ExchangeSourceHandle> getHandlesForRemoteSources(List<RemoteSourceNode> remoteSources, Multimap<PlanFragmentId, ExchangeSourceHandle> exchangeSourceHandles) {
ImmutableListMultimap.Builder<PlanNodeId, ExchangeSourceHandle> result = ImmutableListMultimap.builder();
for (RemoteSourceNode remoteSource : remoteSources) {
checkArgument(remoteSource.getExchangeType() == REPLICATE, "expected exchange type to be REPLICATE, got: %s", remoteSource.getExchangeType());
for (PlanFragmentId fragmentId : remoteSource.getSourceFragmentIds()) {
Collection<ExchangeSourceHandle> handles = requireNonNull(exchangeSourceHandles.get(fragmentId), () -> "exchange source handle is missing for fragment: " + fragmentId);
checkArgument(handles.size() == 1, "single exchange source handle is expected, got: %s", handles);
result.putAll(remoteSource.getId(), handles);
}
}
return result.build();
}
use of io.trino.sql.planner.plan.RemoteSourceNode in project trino by trinodb.
the class PlanUtils method createBroadcastJoinPlanFragment.
static PlanFragment createBroadcastJoinPlanFragment(String name, PlanFragment buildFragment) {
Symbol symbol = new Symbol("column");
PlanNode tableScan = TableScanNode.newInstance(new PlanNodeId(name), TEST_TABLE_HANDLE, ImmutableList.of(symbol), ImmutableMap.of(symbol, new TestingMetadata.TestingColumnHandle("column")), false, Optional.empty());
RemoteSourceNode remote = new RemoteSourceNode(new PlanNodeId("build_id"), buildFragment.getId(), ImmutableList.of(), Optional.empty(), REPLICATE, RetryPolicy.NONE);
PlanNode join = new JoinNode(new PlanNodeId(name + "_id"), INNER, tableScan, remote, ImmutableList.of(), tableScan.getOutputSymbols(), remote.getOutputSymbols(), false, Optional.empty(), Optional.empty(), Optional.empty(), Optional.of(REPLICATED), Optional.empty(), ImmutableMap.of(), Optional.empty());
return createFragment(join);
}
Aggregations