Search in sources :

Example 1 with TestingColumnHandle

use of com.facebook.presto.testing.TestingMetadata.TestingColumnHandle in project presto by prestodb.

the class TestPhasedExecutionSchedule method createBroadcastJoinPlanFragment.

private static PlanFragment createBroadcastJoinPlanFragment(String name, PlanFragment buildFragment) {
    VariableReferenceExpression variable = new VariableReferenceExpression(Optional.empty(), "column", BIGINT);
    PlanNode tableScan = new TableScanNode(Optional.empty(), new PlanNodeId(name), new TableHandle(new ConnectorId("test"), 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("build_id"), buildFragment.getId(), ImmutableList.of(), false, Optional.empty(), REPLICATE);
    PlanNode join = new JoinNode(Optional.empty(), new PlanNodeId(name + "_id"), INNER, tableScan, remote, ImmutableList.of(), ImmutableList.<VariableReferenceExpression>builder().addAll(tableScan.getOutputVariables()).addAll(remote.getOutputVariables()).build(), Optional.empty(), Optional.empty(), Optional.empty(), Optional.of(REPLICATED), ImmutableMap.of());
    return createFragment(join);
}
Also used : PlanNodeId(com.facebook.presto.spi.plan.PlanNodeId) TestingColumnHandle(com.facebook.presto.testing.TestingMetadata.TestingColumnHandle) RemoteSourceNode(com.facebook.presto.sql.planner.plan.RemoteSourceNode) PlanNode(com.facebook.presto.spi.plan.PlanNode) 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) TableHandle(com.facebook.presto.spi.TableHandle) TestingTableHandle(com.facebook.presto.testing.TestingMetadata.TestingTableHandle) ConnectorId(com.facebook.presto.spi.ConnectorId)

Example 2 with TestingColumnHandle

use of com.facebook.presto.testing.TestingMetadata.TestingColumnHandle in project presto by prestodb.

the class TestPhasedExecutionSchedule method createTableScanPlanFragment.

private static PlanFragment createTableScanPlanFragment(String name) {
    VariableReferenceExpression variable = new VariableReferenceExpression(Optional.empty(), "column", BIGINT);
    PlanNode planNode = new TableScanNode(Optional.empty(), new PlanNodeId(name), new TableHandle(new ConnectorId("test"), new TestingTableHandle(), TestingTransactionHandle.create(), Optional.empty()), ImmutableList.of(variable), ImmutableMap.of(variable, new TestingColumnHandle("column")), TupleDomain.all(), TupleDomain.all());
    return createFragment(planNode);
}
Also used : PlanNodeId(com.facebook.presto.spi.plan.PlanNodeId) TestingColumnHandle(com.facebook.presto.testing.TestingMetadata.TestingColumnHandle) PlanNode(com.facebook.presto.spi.plan.PlanNode) TableScanNode(com.facebook.presto.spi.plan.TableScanNode) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) TestingTableHandle(com.facebook.presto.testing.TestingMetadata.TestingTableHandle) TableHandle(com.facebook.presto.spi.TableHandle) TestingTableHandle(com.facebook.presto.testing.TestingMetadata.TestingTableHandle) ConnectorId(com.facebook.presto.spi.ConnectorId)

Example 3 with TestingColumnHandle

use of com.facebook.presto.testing.TestingMetadata.TestingColumnHandle in project presto by prestodb.

the class TestTypeValidator method setUp.

@BeforeClass
public void setUp() {
    variableAllocator = new PlanVariableAllocator();
    variableA = variableAllocator.newVariable("a", BIGINT);
    variableB = variableAllocator.newVariable("b", INTEGER);
    variableC = variableAllocator.newVariable("c", DOUBLE);
    variableD = variableAllocator.newVariable("d", DATE);
    // varchar(3), to test type only coercion
    variableE = variableAllocator.newVariable("e", VarcharType.createVarcharType(3));
    Map<VariableReferenceExpression, ColumnHandle> assignments = ImmutableMap.<VariableReferenceExpression, ColumnHandle>builder().put(variableA, new TestingColumnHandle("a")).put(variableB, new TestingColumnHandle("b")).put(variableC, new TestingColumnHandle("c")).put(variableD, new TestingColumnHandle("d")).put(variableE, new TestingColumnHandle("e")).build();
    baseTableScan = new TableScanNode(Optional.empty(), newId(), TEST_TABLE_HANDLE, ImmutableList.copyOf(assignments.keySet()), assignments, TupleDomain.all(), TupleDomain.all());
}
Also used : TestingColumnHandle(com.facebook.presto.testing.TestingMetadata.TestingColumnHandle) ColumnHandle(com.facebook.presto.spi.ColumnHandle) TestingColumnHandle(com.facebook.presto.testing.TestingMetadata.TestingColumnHandle) TableScanNode(com.facebook.presto.spi.plan.TableScanNode) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) BeforeClass(org.testng.annotations.BeforeClass)

Example 4 with TestingColumnHandle

use of com.facebook.presto.testing.TestingMetadata.TestingColumnHandle in project presto by prestodb.

the class MockRemoteTaskFactory method createTableScanTask.

public MockRemoteTask createTableScanTask(TaskId taskId, InternalNode newNode, List<Split> splits, NodeTaskMap.NodeStatsTracker nodeStatsTracker) {
    VariableReferenceExpression variable = new VariableReferenceExpression(Optional.empty(), "column", VARCHAR);
    PlanNodeId sourceId = new PlanNodeId("sourceId");
    PlanFragment testFragment = new PlanFragment(new PlanFragmentId(0), new TableScanNode(Optional.empty(), sourceId, new TableHandle(new ConnectorId("test"), new TestingTableHandle(), TestingTransactionHandle.create(), Optional.of(TestingHandle.INSTANCE)), ImmutableList.of(variable), ImmutableMap.of(variable, new TestingColumnHandle("column")), TupleDomain.all(), TupleDomain.all()), ImmutableSet.of(variable), SOURCE_DISTRIBUTION, ImmutableList.of(sourceId), new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), ImmutableList.of(variable)), StageExecutionDescriptor.ungroupedExecution(), false, StatsAndCosts.empty(), Optional.empty());
    ImmutableMultimap.Builder<PlanNodeId, Split> initialSplits = ImmutableMultimap.builder();
    for (Split sourceSplit : splits) {
        initialSplits.put(sourceId, sourceSplit);
    }
    return createRemoteTask(TEST_SESSION, taskId, newNode, testFragment, initialSplits.build(), createInitialEmptyOutputBuffers(BROADCAST), nodeStatsTracker, true, new TableWriteInfo(Optional.empty(), Optional.empty(), Optional.empty()));
}
Also used : TableWriteInfo(com.facebook.presto.execution.scheduler.TableWriteInfo) TestingTableHandle(com.facebook.presto.testing.TestingMetadata.TestingTableHandle) PartitioningScheme(com.facebook.presto.sql.planner.PartitioningScheme) PlanFragment(com.facebook.presto.sql.planner.PlanFragment) PlanNodeId(com.facebook.presto.spi.plan.PlanNodeId) TestingColumnHandle(com.facebook.presto.testing.TestingMetadata.TestingColumnHandle) TableScanNode(com.facebook.presto.spi.plan.TableScanNode) VariableReferenceExpression(com.facebook.presto.spi.relation.VariableReferenceExpression) TableHandle(com.facebook.presto.spi.TableHandle) TestingTableHandle(com.facebook.presto.testing.TestingMetadata.TestingTableHandle) PlanFragmentId(com.facebook.presto.sql.planner.plan.PlanFragmentId) ImmutableMultimap(com.google.common.collect.ImmutableMultimap) Split(com.facebook.presto.metadata.Split) ConnectorId(com.facebook.presto.spi.ConnectorId)

Example 5 with TestingColumnHandle

use of com.facebook.presto.testing.TestingMetadata.TestingColumnHandle 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)

Aggregations

TestingColumnHandle (com.facebook.presto.testing.TestingMetadata.TestingColumnHandle)6 TableScanNode (com.facebook.presto.spi.plan.TableScanNode)5 VariableReferenceExpression (com.facebook.presto.spi.relation.VariableReferenceExpression)5 TableHandle (com.facebook.presto.spi.TableHandle)4 PlanNodeId (com.facebook.presto.spi.plan.PlanNodeId)4 TestingTableHandle (com.facebook.presto.testing.TestingMetadata.TestingTableHandle)4 ConnectorId (com.facebook.presto.spi.ConnectorId)3 ColumnHandle (com.facebook.presto.spi.ColumnHandle)2 PlanNode (com.facebook.presto.spi.plan.PlanNode)2 PartitioningScheme (com.facebook.presto.sql.planner.PartitioningScheme)2 PlanFragment (com.facebook.presto.sql.planner.PlanFragment)2 JoinNode (com.facebook.presto.sql.planner.plan.JoinNode)2 PlanFragmentId (com.facebook.presto.sql.planner.plan.PlanFragmentId)2 RemoteSourceNode (com.facebook.presto.sql.planner.plan.RemoteSourceNode)2 JsonObjectMapperProvider (com.facebook.airlift.json.JsonObjectMapperProvider)1 TableWriteInfo (com.facebook.presto.execution.scheduler.TableWriteInfo)1 Split (com.facebook.presto.metadata.Split)1 ConstantProperty (com.facebook.presto.spi.ConstantProperty)1 GroupingProperty (com.facebook.presto.spi.GroupingProperty)1 SortingProperty (com.facebook.presto.spi.SortingProperty)1