Search in sources :

Example 16 with TpchConnectorFactory

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

the class TestMLQueries 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());
    MLPlugin plugin = new MLPlugin();
    for (Type type : plugin.getTypes()) {
        localQueryRunner.getTypeManager().addType(type);
    }
    for (ParametricType parametricType : plugin.getParametricTypes()) {
        localQueryRunner.getTypeManager().addParametricType(parametricType);
    }
    localQueryRunner.getMetadata().addFunctions(extractFunctions(new MLPlugin().getFunctions()));
    return localQueryRunner;
}
Also used : TpchConnectorFactory(com.facebook.presto.tpch.TpchConnectorFactory) Type(com.facebook.presto.spi.type.Type) ParametricType(com.facebook.presto.spi.type.ParametricType) ParametricType(com.facebook.presto.spi.type.ParametricType) LocalQueryRunner(com.facebook.presto.testing.LocalQueryRunner) Session(com.facebook.presto.Session)

Example 17 with TpchConnectorFactory

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

the class MemoryLocalQueryRunner method createMemoryLocalQueryRunner.

private static LocalQueryRunner createMemoryLocalQueryRunner() {
    Session.SessionBuilder sessionBuilder = testSessionBuilder().setCatalog("memory").setSchema("default");
    Session session = sessionBuilder.build();
    LocalQueryRunner localQueryRunner = LocalQueryRunner.queryRunnerWithInitialTransaction(session);
    // add tpch
    localQueryRunner.createCatalog("tpch", new TpchConnectorFactory(1), ImmutableMap.<String, String>of());
    localQueryRunner.createCatalog("memory", new MemoryConnectorFactory(), ImmutableMap.<String, String>of());
    return localQueryRunner;
}
Also used : TpchConnectorFactory(com.facebook.presto.tpch.TpchConnectorFactory) MemoryConnectorFactory(com.facebook.presto.plugin.memory.MemoryConnectorFactory) LocalQueryRunner(com.facebook.presto.testing.LocalQueryRunner) Session(com.facebook.presto.Session)

Example 18 with TpchConnectorFactory

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

the class BenchmarkQueryRunner method createLocalQueryRunner.

public static LocalQueryRunner createLocalQueryRunner(boolean hashingEnabled) {
    SessionBuilder sessionBuilder = testSessionBuilder().setCatalog("tpch").setSchema(TINY_SCHEMA_NAME);
    if (hashingEnabled) {
        sessionBuilder.setSystemProperty("optimizer.optimize_hash_generation", "true");
    }
    Session session = sessionBuilder.build();
    LocalQueryRunner localQueryRunner = new LocalQueryRunner(session);
    // add tpch
    localQueryRunner.createCatalog("tpch", new TpchConnectorFactory(1), ImmutableMap.of());
    return localQueryRunner;
}
Also used : TpchConnectorFactory(com.facebook.presto.tpch.TpchConnectorFactory) SessionBuilder(com.facebook.presto.Session.SessionBuilder) TestingSession.testSessionBuilder(com.facebook.presto.testing.TestingSession.testSessionBuilder) LocalQueryRunner(com.facebook.presto.testing.LocalQueryRunner) Session(com.facebook.presto.Session)

Example 19 with TpchConnectorFactory

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

the class BenchmarkQueryRunner method createLocalQueryRunner.

public static LocalQueryRunner createLocalQueryRunner(Map<String, String> extraSessionProperties) {
    SessionBuilder sessionBuilder = testSessionBuilder().setCatalog("tpch").setSchema(TINY_SCHEMA_NAME);
    extraSessionProperties.forEach(sessionBuilder::setSystemProperty);
    Session session = sessionBuilder.build();
    LocalQueryRunner localQueryRunner = new LocalQueryRunner(session);
    // add tpch
    localQueryRunner.createCatalog("tpch", new TpchConnectorFactory(1), ImmutableMap.of());
    return localQueryRunner;
}
Also used : TpchConnectorFactory(com.facebook.presto.tpch.TpchConnectorFactory) SessionBuilder(com.facebook.presto.Session.SessionBuilder) TestingSession.testSessionBuilder(com.facebook.presto.testing.TestingSession.testSessionBuilder) LocalQueryRunner(com.facebook.presto.testing.LocalQueryRunner) Session(com.facebook.presto.Session)

Example 20 with TpchConnectorFactory

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

the class MemoryLocalQueryRunner method createMemoryLocalQueryRunner.

private static LocalQueryRunner createMemoryLocalQueryRunner(Session session) {
    LocalQueryRunner localQueryRunner = LocalQueryRunner.queryRunnerWithInitialTransaction(session);
    // add tpch
    localQueryRunner.createCatalog("tpch", new TpchConnectorFactory(1), ImmutableMap.of());
    localQueryRunner.createCatalog("memory", new MemoryConnectorFactory(), ImmutableMap.of("memory.max-data-per-node", "4GB"));
    return localQueryRunner;
}
Also used : TpchConnectorFactory(com.facebook.presto.tpch.TpchConnectorFactory) MemoryConnectorFactory(com.facebook.presto.plugin.memory.MemoryConnectorFactory) LocalQueryRunner(com.facebook.presto.testing.LocalQueryRunner)

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