Search in sources :

Example 26 with ConnectorId

use of com.facebook.presto.connector.ConnectorId in project presto by prestodb.

the class SplitManager method getSplits.

public SplitSource getSplits(Session session, TableLayoutHandle layout) {
    ConnectorId connectorId = layout.getConnectorId();
    ConnectorSplitManager splitManager = getConnectorSplitManager(connectorId);
    ConnectorSession connectorSession = session.toConnectorSession(connectorId);
    ConnectorSplitSource source = splitManager.getSplits(layout.getTransactionHandle(), connectorSession, layout.getConnectorHandle());
    SplitSource splitSource = new ConnectorAwareSplitSource(connectorId, layout.getTransactionHandle(), source);
    if (minScheduleSplitBatchSize > 1) {
        splitSource = new BufferingSplitSource(splitSource, minScheduleSplitBatchSize);
    }
    return splitSource;
}
Also used : ConnectorSplitManager(com.facebook.presto.spi.connector.ConnectorSplitManager) ConnectorSession(com.facebook.presto.spi.ConnectorSession) ConnectorSplitSource(com.facebook.presto.spi.ConnectorSplitSource) ConnectorSplitSource(com.facebook.presto.spi.ConnectorSplitSource) ConnectorId(com.facebook.presto.connector.ConnectorId)

Example 27 with ConnectorId

use of com.facebook.presto.connector.ConnectorId in project presto by prestodb.

the class LocalQueryRunner method createCatalog.

public void createCatalog(String catalogName, ConnectorFactory connectorFactory, Map<String, String> properties) {
    nodeManager.addCurrentNodeConnector(new ConnectorId(catalogName));
    connectorManager.addConnectorFactory(connectorFactory);
    connectorManager.createConnection(catalogName, connectorFactory.getName(), properties);
}
Also used : ConnectorId(com.facebook.presto.connector.ConnectorId)

Example 28 with ConnectorId

use of com.facebook.presto.connector.ConnectorId in project presto by prestodb.

the class TestSystemSplit method testSerialization.

@Test
public void testSerialization() throws Exception {
    ConnectorId connectorId = new ConnectorId("testid");
    SystemTableHandle tableHandle = new SystemTableHandle(connectorId, "xyz", "foo");
    SystemSplit expected = new SystemSplit(connectorId, tableHandle, HostAddress.fromParts("127.0.0.1", 0), TupleDomain.all());
    JsonCodec<SystemSplit> codec = jsonCodec(SystemSplit.class);
    SystemSplit actual = codec.fromJson(codec.toJson(expected));
    assertEquals(actual.getConnectorId(), expected.getConnectorId());
    assertEquals(actual.getTableHandle(), expected.getTableHandle());
    assertEquals(actual.getAddresses(), expected.getAddresses());
    assertEquals(actual.getConstraint(), expected.getConstraint());
}
Also used : ConnectorId(com.facebook.presto.connector.ConnectorId) Test(org.testng.annotations.Test)

Example 29 with ConnectorId

use of com.facebook.presto.connector.ConnectorId in project presto by prestodb.

the class MockRemoteTaskFactory method createTableScanTask.

public MockRemoteTask createTableScanTask(TaskId taskId, Node newNode, List<Split> splits, PartitionedSplitCountTracker partitionedSplitCountTracker) {
    Symbol symbol = new Symbol("column");
    PlanNodeId sourceId = new PlanNodeId("sourceId");
    PlanFragment testFragment = new PlanFragment(new PlanFragmentId("test"), new TableScanNode(sourceId, new TableHandle(new ConnectorId("test"), new TestingTableHandle()), ImmutableList.of(symbol), ImmutableMap.of(symbol, new TestingColumnHandle("column")), Optional.empty(), TupleDomain.all(), null), ImmutableMap.of(symbol, VARCHAR), SOURCE_DISTRIBUTION, ImmutableList.of(sourceId), new PartitioningScheme(Partitioning.create(SINGLE_DISTRIBUTION, ImmutableList.of()), ImmutableList.of(symbol)));
    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), partitionedSplitCountTracker, true);
}
Also used : Symbol(com.facebook.presto.sql.planner.Symbol) TestingTableHandle(com.facebook.presto.sql.planner.TestingTableHandle) PartitioningScheme(com.facebook.presto.sql.planner.PartitioningScheme) PlanFragment(com.facebook.presto.sql.planner.PlanFragment) PlanNodeId(com.facebook.presto.sql.planner.plan.PlanNodeId) TestingColumnHandle(com.facebook.presto.sql.planner.TestingColumnHandle) TableScanNode(com.facebook.presto.sql.planner.plan.TableScanNode) TestingTableHandle(com.facebook.presto.sql.planner.TestingTableHandle) TableHandle(com.facebook.presto.metadata.TableHandle) PlanFragmentId(com.facebook.presto.sql.planner.plan.PlanFragmentId) ImmutableMultimap(com.google.common.collect.ImmutableMultimap) Split(com.facebook.presto.metadata.Split) ConnectorId(com.facebook.presto.connector.ConnectorId)

Example 30 with ConnectorId

use of com.facebook.presto.connector.ConnectorId in project presto by prestodb.

the class TestOutput method testRoundTrip.

@Test
public void testRoundTrip() throws Exception {
    Output expected = new Output(new ConnectorId("connectorId"), "schema", "table");
    String json = codec.toJson(expected);
    Output actual = codec.fromJson(json);
    assertEquals(actual, expected);
}
Also used : ConnectorId(com.facebook.presto.connector.ConnectorId) Test(org.testng.annotations.Test)

Aggregations

ConnectorId (com.facebook.presto.connector.ConnectorId)76 ConnectorMetadata (com.facebook.presto.spi.connector.ConnectorMetadata)39 ConnectorSession (com.facebook.presto.spi.ConnectorSession)14 Session (com.facebook.presto.Session)12 PrestoException (com.facebook.presto.spi.PrestoException)9 ConnectorTransactionHandle (com.facebook.presto.spi.connector.ConnectorTransactionHandle)7 Test (org.testng.annotations.Test)7 ConnectorId.createInformationSchemaConnectorId (com.facebook.presto.connector.ConnectorId.createInformationSchemaConnectorId)5 ConnectorId.createSystemTablesConnectorId (com.facebook.presto.connector.ConnectorId.createSystemTablesConnectorId)5 TableHandle (com.facebook.presto.metadata.TableHandle)5 ConnectorTableMetadata (com.facebook.presto.spi.ConnectorTableMetadata)5 SchemaTableName (com.facebook.presto.spi.SchemaTableName)5 PlanNodeId (com.facebook.presto.sql.planner.plan.PlanNodeId)5 ImmutableList (com.google.common.collect.ImmutableList)5 QualifiedObjectName (com.facebook.presto.metadata.QualifiedObjectName)4 QualifiedObjectName.convertFromSchemaTableName (com.facebook.presto.metadata.QualifiedObjectName.convertFromSchemaTableName)4 SessionPropertyManager (com.facebook.presto.metadata.SessionPropertyManager)4 ConnectorInsertTableHandle (com.facebook.presto.spi.ConnectorInsertTableHandle)4 SemanticException (com.facebook.presto.sql.analyzer.SemanticException)4 TransactionManager (com.facebook.presto.transaction.TransactionManager)4