Search in sources :

Example 26 with PlanFragment

use of io.prestosql.sql.planner.PlanFragment in project hetu-core by openlookeng.

the class MockRemoteTaskFactory method createTableScanTask.

public MockRemoteTask createTableScanTask(TaskId taskId, InternalNode newNode, List<Split> splits, PartitionedSplitCountTracker partitionedSplitCountTracker) {
    // for now, just use a filler instanceId for tests
    String instanceId = "testInstanceId";
    Symbol symbol = new Symbol("column");
    PlanNodeId sourceId = new PlanNodeId("sourceId");
    PlanFragment testFragment = new PlanFragment(new PlanFragmentId("test"), TableScanNode.newInstance(sourceId, TEST_TABLE_HANDLE, ImmutableList.of(symbol), ImmutableMap.of(symbol, new TestingColumnHandle("column")), ReuseExchangeOperator.STRATEGY.REUSE_STRATEGY_DEFAULT, new UUID(0, 0), 0, false), ImmutableMap.of(symbol, VARCHAR), SOURCE_DISTRIBUTION, ImmutableList.of(sourceId), new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), ImmutableList.of(symbol)), ungroupedExecution(), StatsAndCosts.empty(), Optional.empty(), Optional.empty(), Optional.empty());
    ImmutableMultimap.Builder<PlanNodeId, Split> initialSplits = ImmutableMultimap.builder();
    for (Split sourceSplit : splits) {
        initialSplits.put(sourceId, sourceSplit);
    }
    return createRemoteTask(TEST_SESSION, taskId, instanceId, newNode, testFragment, initialSplits.build(), OptionalInt.empty(), createInitialEmptyOutputBuffers(BROADCAST), partitionedSplitCountTracker, true, Optional.empty(), new QuerySnapshotManager(taskId.getQueryId(), NOOP_SNAPSHOT_UTILS, TEST_SESSION));
}
Also used : PlanNodeId(io.prestosql.spi.plan.PlanNodeId) TestingColumnHandle(io.prestosql.testing.TestingMetadata.TestingColumnHandle) Symbol(io.prestosql.spi.plan.Symbol) PartitioningScheme(io.prestosql.sql.planner.PartitioningScheme) PlanFragmentId(io.prestosql.sql.planner.plan.PlanFragmentId) ImmutableMultimap(com.google.common.collect.ImmutableMultimap) UUID(java.util.UUID) Split(io.prestosql.metadata.Split) PlanFragment(io.prestosql.sql.planner.PlanFragment) QuerySnapshotManager(io.prestosql.snapshot.QuerySnapshotManager)

Example 27 with PlanFragment

use of io.prestosql.sql.planner.PlanFragment in project hetu-core by openlookeng.

the class StatsAndCosts method reconstructStatsAndCosts.

private static void reconstructStatsAndCosts(StageInfo stage, ImmutableMap.Builder<PlanNodeId, PlanNodeStatsEstimate> planNodeStats, ImmutableMap.Builder<PlanNodeId, PlanCostEstimate> planNodeCosts, Set<PlanNodeId> visitedPlanNodeId) {
    PlanFragment planFragment = stage.getPlan();
    if (planFragment != null) {
        if (!visitedPlanNodeId.contains(planFragment.getRoot().getId())) {
            visitedPlanNodeId.add(planFragment.getRoot().getId());
            planNodeStats.putAll(planFragment.getStatsAndCosts().getStats());
            planNodeCosts.putAll(planFragment.getStatsAndCosts().getCosts());
        }
    }
    for (StageInfo subStage : stage.getSubStages()) {
        reconstructStatsAndCosts(subStage, planNodeStats, planNodeCosts, visitedPlanNodeId);
    }
}
Also used : StageInfo(io.prestosql.execution.StageInfo) PlanFragment(io.prestosql.sql.planner.PlanFragment)

Example 28 with PlanFragment

use of io.prestosql.sql.planner.PlanFragment in project hetu-core by openlookeng.

the class GraphvizPrinter method printSubPlan.

private static void printSubPlan(SubPlan plan, Map<PlanFragmentId, PlanFragment> fragmentsById, PlanNodeIdGenerator idGenerator, StringBuilder output) {
    PlanFragment fragment = plan.getFragment();
    printFragmentNodes(output, fragment, idGenerator);
    fragment.getRoot().accept(new EdgePrinter(output, fragmentsById, idGenerator), null);
    for (SubPlan child : plan.getChildren()) {
        printSubPlan(child, fragmentsById, idGenerator, output);
    }
}
Also used : PlanFragment(io.prestosql.sql.planner.PlanFragment) SubPlan(io.prestosql.sql.planner.SubPlan)

Example 29 with PlanFragment

use of io.prestosql.sql.planner.PlanFragment in project hetu-core by openlookeng.

the class GraphvizPrinter method printLogical.

public static String printLogical(List<PlanFragment> fragments) {
    Map<PlanFragmentId, PlanFragment> fragmentsById = Maps.uniqueIndex(fragments, PlanFragment::getId);
    PlanNodeIdGenerator idGenerator = new PlanNodeIdGenerator();
    StringBuilder output = new StringBuilder();
    output.append("digraph logical_plan {\n");
    for (PlanFragment fragment : fragments) {
        printFragmentNodes(output, fragment, idGenerator);
    }
    for (PlanFragment fragment : fragments) {
        fragment.getRoot().accept(new EdgePrinter(output, fragmentsById, idGenerator), null);
    }
    output.append("}\n");
    return output.toString();
}
Also used : PlanFragmentId(io.prestosql.sql.planner.plan.PlanFragmentId) PlanFragment(io.prestosql.sql.planner.PlanFragment)

Aggregations

PlanFragment (io.prestosql.sql.planner.PlanFragment)29 PlanNodeId (io.prestosql.spi.plan.PlanNodeId)13 Test (org.testng.annotations.Test)12 ImmutableSet (com.google.common.collect.ImmutableSet)11 Set (java.util.Set)11 PlanFragmentId (io.prestosql.sql.planner.plan.PlanFragmentId)10 TableInfo (io.prestosql.execution.TableInfo)9 UUID (java.util.UUID)9 Symbol (io.prestosql.spi.plan.Symbol)8 SqlStageExecution (io.prestosql.execution.SqlStageExecution)7 PlanNode (io.prestosql.spi.plan.PlanNode)7 PartitioningScheme (io.prestosql.sql.planner.PartitioningScheme)7 Split (io.prestosql.metadata.Split)5 QuerySnapshotManager (io.prestosql.snapshot.QuerySnapshotManager)5 QualifiedObjectName (io.prestosql.spi.connector.QualifiedObjectName)5 ConnectorAwareSplitSource (io.prestosql.split.ConnectorAwareSplitSource)5 StageExecutionPlan (io.prestosql.sql.planner.StageExecutionPlan)5 DynamicFilterService (io.prestosql.dynamicfilter.DynamicFilterService)4 MockRemoteTaskFactory (io.prestosql.execution.MockRemoteTaskFactory)4 NodeTaskMap (io.prestosql.execution.NodeTaskMap)4