Search in sources :

Example 11 with TpchConnectorFactory

use of com.facebook.presto.tpch.TpchConnectorFactory in project presto by prestodb.

the class BasePlanTest method createQueryRunner.

private static LocalQueryRunner createQueryRunner(Map<String, String> sessionProperties) {
    Session.SessionBuilder sessionBuilder = testSessionBuilder().setCatalog("local").setSchema("tiny").setSystemProperty("task_concurrency", // these tests don't handle exchanges from local parallel
    "1");
    sessionProperties.entrySet().forEach(entry -> sessionBuilder.setSystemProperty(entry.getKey(), entry.getValue()));
    LocalQueryRunner queryRunner = new LocalQueryRunner(sessionBuilder.build());
    queryRunner.createCatalog(queryRunner.getDefaultSession().getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of());
    return queryRunner;
}
Also used : TpchConnectorFactory(com.facebook.presto.tpch.TpchConnectorFactory) LocalQueryRunner(com.facebook.presto.testing.LocalQueryRunner) Session(com.facebook.presto.Session)

Example 12 with TpchConnectorFactory

use of com.facebook.presto.tpch.TpchConnectorFactory in project presto by prestodb.

the class TestAccessControlManager method registerBogusConnector.

private static ConnectorId registerBogusConnector(CatalogManager catalogManager, TransactionManager transactionManager, AccessControl accessControl, String catalogName) {
    ConnectorId connectorId = new ConnectorId(catalogName);
    Connector connector = new TpchConnectorFactory().create(catalogName, ImmutableMap.of(), new TestingConnectorContext());
    InMemoryNodeManager nodeManager = new InMemoryNodeManager();
    MetadataManager metadata = MetadataManager.createTestMetadataManager(catalogManager);
    ConnectorId systemId = createSystemTablesConnectorId(connectorId);
    catalogManager.registerCatalog(new Catalog(catalogName, connectorId, connector, createInformationSchemaConnectorId(connectorId), new InformationSchemaConnector(catalogName, nodeManager, metadata, accessControl, ImmutableList.of()), systemId, new SystemConnector(systemId, nodeManager, connector.getSystemTables(), transactionId -> transactionManager.getConnectorTransaction(transactionId, connectorId))));
    return connectorId;
}
Also used : SystemConnector(com.facebook.presto.connector.system.SystemConnector) InformationSchemaConnector(com.facebook.presto.connector.informationSchema.InformationSchemaConnector) Connector(com.facebook.presto.spi.connector.Connector) SystemConnector(com.facebook.presto.connector.system.SystemConnector) TpchConnectorFactory(com.facebook.presto.tpch.TpchConnectorFactory) InformationSchemaConnector(com.facebook.presto.connector.informationSchema.InformationSchemaConnector) MetadataManager(com.facebook.presto.metadata.MetadataManager) TestingConnectorContext(com.facebook.presto.testing.TestingConnectorContext) Catalog(com.facebook.presto.metadata.Catalog) ConnectorId.createSystemTablesConnectorId(com.facebook.presto.spi.ConnectorId.createSystemTablesConnectorId) ConnectorId.createInformationSchemaConnectorId(com.facebook.presto.spi.ConnectorId.createInformationSchemaConnectorId) ConnectorId(com.facebook.presto.spi.ConnectorId) InMemoryNodeManager(com.facebook.presto.metadata.InMemoryNodeManager)

Example 13 with TpchConnectorFactory

use of com.facebook.presto.tpch.TpchConnectorFactory in project presto by prestodb.

the class TestHiddenColumns method setUp.

@BeforeClass
public void setUp() {
    runner = new LocalQueryRunner(TEST_SESSION);
    runner.createCatalog(TEST_SESSION.getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of());
}
Also used : TpchConnectorFactory(com.facebook.presto.tpch.TpchConnectorFactory) LocalQueryRunner(com.facebook.presto.testing.LocalQueryRunner) BeforeClass(org.testng.annotations.BeforeClass)

Example 14 with TpchConnectorFactory

use of com.facebook.presto.tpch.TpchConnectorFactory in project presto by prestodb.

the class TestQueryPlanDeterminism method createLocalQueryRunner.

public static LocalQueryRunner createLocalQueryRunner() {
    Session defaultSession = testSessionBuilder().setCatalog("local").setSchema(TINY_SCHEMA_NAME).build();
    LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession);
    // add the tpch catalog
    // local queries run directly against the generator
    localQueryRunner.createCatalog(defaultSession.getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.<String, String>of());
    localQueryRunner.getMetadata().addFunctions(CUSTOM_FUNCTIONS);
    SessionPropertyManager sessionPropertyManager = localQueryRunner.getMetadata().getSessionPropertyManager();
    sessionPropertyManager.addSystemSessionProperties(TEST_SYSTEM_PROPERTIES);
    sessionPropertyManager.addConnectorSessionProperties(new ConnectorId(TESTING_CATALOG), TEST_CATALOG_PROPERTIES);
    return localQueryRunner;
}
Also used : TpchConnectorFactory(com.facebook.presto.tpch.TpchConnectorFactory) SessionPropertyManager(com.facebook.presto.metadata.SessionPropertyManager) LocalQueryRunner(com.facebook.presto.testing.LocalQueryRunner) Session(com.facebook.presto.Session) ConnectorId(com.facebook.presto.connector.ConnectorId)

Example 15 with TpchConnectorFactory

use of com.facebook.presto.tpch.TpchConnectorFactory in project presto by prestodb.

the class TestQueryPlansDeterministic method createLocalQueryRunner.

private static LocalQueryRunner createLocalQueryRunner() {
    Session defaultSession = testSessionBuilder().setCatalog("local").setSchema(TINY_SCHEMA_NAME).build();
    LocalQueryRunner localQueryRunner = new LocalQueryRunner(defaultSession);
    // add the tpch catalog
    // local queries run directly against the generator
    localQueryRunner.createCatalog(defaultSession.getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of());
    return localQueryRunner;
}
Also used : TpchConnectorFactory(com.facebook.presto.tpch.TpchConnectorFactory) LocalQueryRunner(com.facebook.presto.testing.LocalQueryRunner) Session(com.facebook.presto.Session)

Aggregations

TpchConnectorFactory (com.facebook.presto.tpch.TpchConnectorFactory)30 LocalQueryRunner (com.facebook.presto.testing.LocalQueryRunner)25 Session (com.facebook.presto.Session)18 BeforeClass (org.testng.annotations.BeforeClass)6 InformationSchemaConnector (com.facebook.presto.connector.informationSchema.InformationSchemaConnector)4 SystemConnector (com.facebook.presto.connector.system.SystemConnector)4 SessionPropertyManager (com.facebook.presto.metadata.SessionPropertyManager)4 Connector (com.facebook.presto.spi.connector.Connector)4 TestingConnectorContext (com.facebook.presto.testing.TestingConnectorContext)4 Test (org.testng.annotations.Test)4 CatalogManager (com.facebook.presto.metadata.CatalogManager)3 MemoryConnectorFactory (com.facebook.presto.plugin.memory.MemoryConnectorFactory)3 ConnectorId (com.facebook.presto.spi.ConnectorId)3 ConnectorMetadata (com.facebook.presto.spi.connector.ConnectorMetadata)3 TestingSession.testSessionBuilder (com.facebook.presto.testing.TestingSession.testSessionBuilder)3 SessionBuilder (com.facebook.presto.Session.SessionBuilder)2 ConnectorId (com.facebook.presto.connector.ConnectorId)2 QueryId (com.facebook.presto.spi.QueryId)2 ConnectorFactory (com.facebook.presto.spi.connector.ConnectorFactory)2 MemoryPoolId (com.facebook.presto.spi.memory.MemoryPoolId)2