Search in sources :

Example 16 with PlanFragmentId

use of com.facebook.presto.sql.planner.plan.PlanFragmentId in project presto by prestodb.

the class TestSourcePartitionedScheduler method createPlan.

private static SubPlan createPlan() {
    VariableReferenceExpression variable = new VariableReferenceExpression(Optional.empty(), "column", VARCHAR);
    // table scan with splitCount splits
    TableScanNode tableScan = new TableScanNode(Optional.empty(), TABLE_SCAN_NODE_ID, new TableHandle(CONNECTOR_ID, new TestingTableHandle(), TestingTransactionHandle.create(), Optional.empty()), ImmutableList.of(variable), ImmutableMap.of(variable, new TestingColumnHandle("column")), TupleDomain.all(), TupleDomain.all());
    RemoteSourceNode remote = new RemoteSourceNode(Optional.empty(), new PlanNodeId("remote_id"), new PlanFragmentId(0), ImmutableList.of(), false, Optional.empty(), GATHER);
    PlanFragment testFragment = new PlanFragment(new PlanFragmentId(0), new JoinNode(Optional.empty(), new PlanNodeId("join_id"), INNER, tableScan, remote, ImmutableList.of(), ImmutableList.<VariableReferenceExpression>builder().addAll(tableScan.getOutputVariables()).addAll(remote.getOutputVariables()).build(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.empty(), ImmutableMap.of()), ImmutableSet.of(variable), SOURCE_DISTRIBUTION, ImmutableList.of(TABLE_SCAN_NODE_ID), new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), ImmutableList.of(variable)), StageExecutionDescriptor.ungroupedExecution(), false, StatsAndCosts.empty(), Optional.empty());
    return new SubPlan(testFragment, ImmutableList.of());
}
Also used : PlanNodeId(com.facebook.presto.spi.plan.PlanNodeId) TestingColumnHandle(com.facebook.presto.testing.TestingMetadata.TestingColumnHandle) RemoteSourceNode(com.facebook.presto.sql.planner.plan.RemoteSourceNode) TableScanNode(com.facebook.presto.spi.plan.TableScanNode) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) TestingTableHandle(com.facebook.presto.testing.TestingMetadata.TestingTableHandle) JoinNode(com.facebook.presto.sql.planner.plan.JoinNode) PartitioningScheme(com.facebook.presto.sql.planner.PartitioningScheme) TableHandle(com.facebook.presto.spi.TableHandle) TestingTableHandle(com.facebook.presto.testing.TestingMetadata.TestingTableHandle) PlanFragmentId(com.facebook.presto.sql.planner.plan.PlanFragmentId) PlanFragment(com.facebook.presto.sql.planner.PlanFragment) SubPlan(com.facebook.presto.sql.planner.SubPlan)

Example 17 with PlanFragmentId

use of com.facebook.presto.sql.planner.plan.PlanFragmentId in project presto by prestodb.

the class TestPlanPrinter method domainToPrintedScan.

// Creates a trivial TableScan with the given domain on some column
private String domainToPrintedScan(VariableReferenceExpression variable, ColumnHandle colHandle, Domain domain) {
    TupleDomain<ColumnHandle> tupleDomain = withColumnDomains(ImmutableMap.<ColumnHandle, Domain>builder().put(colHandle, domain).build());
    TableScanNode scanNode = PLAN_BUILDER.tableScan(TABLE_HANDLE_WITH_LAYOUT, ImmutableList.of(variable), ImmutableMap.of(variable, colHandle), tupleDomain, tupleDomain);
    PlanFragment testFragment = new PlanFragment(new PlanFragmentId(0), scanNode, ImmutableSet.of(variable), SOURCE_DISTRIBUTION, ImmutableList.of(scanNode.getId()), new PartitioningScheme(Partitioning.create(SOURCE_DISTRIBUTION, ImmutableList.of()), ImmutableList.of(variable)), StageExecutionDescriptor.ungroupedExecution(), false, StatsAndCosts.empty(), Optional.empty());
    return PlanPrinter.textPlanFragment(testFragment, FUNCTION_AND_TYPE_MANAGER, TEST_SESSION, false);
}
Also used : ColumnHandle(com.facebook.presto.spi.ColumnHandle) TableScanNode(com.facebook.presto.spi.plan.TableScanNode) PartitioningScheme(com.facebook.presto.sql.planner.PartitioningScheme) PlanFragmentId(com.facebook.presto.sql.planner.plan.PlanFragmentId) PlanFragment(com.facebook.presto.sql.planner.PlanFragment)

Example 18 with PlanFragmentId

use of com.facebook.presto.sql.planner.plan.PlanFragmentId in project presto by prestodb.

the class PrestoSparkQueryExecutionFactory method createStageInfo.

private static StageInfo createStageInfo(QueryId queryId, SubPlan plan, List<TaskInfo> taskInfos) {
    ListMultimap<PlanFragmentId, TaskInfo> taskInfoMap = ArrayListMultimap.create();
    for (TaskInfo taskInfo : taskInfos) {
        PlanFragmentId fragmentId = new PlanFragmentId(taskInfo.getTaskId().getStageExecutionId().getStageId().getId());
        taskInfoMap.put(fragmentId, taskInfo);
    }
    return createStageInfo(queryId, plan, taskInfoMap);
}
Also used : TaskInfo(com.facebook.presto.execution.TaskInfo) SerializedTaskInfo(com.facebook.presto.spark.classloader_interface.SerializedTaskInfo) PlanFragmentId(com.facebook.presto.sql.planner.plan.PlanFragmentId)

Aggregations

PlanFragmentId (com.facebook.presto.sql.planner.plan.PlanFragmentId)18 PlanFragment (com.facebook.presto.sql.planner.PlanFragment)13 RemoteSourceNode (com.facebook.presto.sql.planner.plan.RemoteSourceNode)7 PlanNodeId (com.facebook.presto.spi.plan.PlanNodeId)5 TableScanNode (com.facebook.presto.spi.plan.TableScanNode)5 PartitioningScheme (com.facebook.presto.sql.planner.PartitioningScheme)5 ImmutableList (com.google.common.collect.ImmutableList)5 StageExecutionId (com.facebook.presto.execution.StageExecutionId)3 StageId (com.facebook.presto.execution.StageId)3 PrestoSparkTaskDescriptor (com.facebook.presto.spark.PrestoSparkTaskDescriptor)3 SerializedPrestoSparkTaskDescriptor (com.facebook.presto.spark.classloader_interface.SerializedPrestoSparkTaskDescriptor)3 SerializedTaskInfo (com.facebook.presto.spark.classloader_interface.SerializedTaskInfo)3 JoinNode (com.facebook.presto.sql.planner.plan.JoinNode)3 ImmutableSet (com.google.common.collect.ImmutableSet)3 Tuple2 (scala.Tuple2)3 Session (com.facebook.presto.Session)2 SqlStageExecution (com.facebook.presto.execution.SqlStageExecution)2 TaskSource (com.facebook.presto.execution.TaskSource)2 MutablePartitionId (com.facebook.presto.spark.classloader_interface.MutablePartitionId)2 PrestoSparkMutableRow (com.facebook.presto.spark.classloader_interface.PrestoSparkMutableRow)2