Search in sources :

Example 16 with LocalQueryRunner

use of com.facebook.presto.testing.LocalQueryRunner in project presto by prestodb.

the class RaptorBenchmarkQueryRunner method createLocalQueryRunner.

public static LocalQueryRunner createLocalQueryRunner() {
    Session session = testSessionBuilder().setCatalog("raptor").setSchema("benchmark").build();
    LocalQueryRunner localQueryRunner = new LocalQueryRunner(session);
    // add tpch
    localQueryRunner.createCatalog("tpch", new TpchConnectorFactory(1), ImmutableMap.of());
    // add raptor
    ConnectorFactory raptorConnectorFactory = getOnlyElement(new RaptorPlugin().getConnectorFactories());
    Map<String, String> config = createRaptorConfig(TPCH_CACHE_DIR);
    localQueryRunner.createCatalog("raptor", raptorConnectorFactory, config);
    if (!localQueryRunner.tableExists(session, "orders")) {
        localQueryRunner.execute("CREATE TABLE orders AS SELECT * FROM tpch.sf1.orders");
    }
    if (!localQueryRunner.tableExists(session, "lineitem")) {
        localQueryRunner.execute("CREATE TABLE lineitem AS SELECT * FROM tpch.sf1.lineitem");
    }
    return localQueryRunner;
}
Also used : TpchConnectorFactory(com.facebook.presto.tpch.TpchConnectorFactory) TpchConnectorFactory(com.facebook.presto.tpch.TpchConnectorFactory) ConnectorFactory(com.facebook.presto.spi.connector.ConnectorFactory) LocalQueryRunner(com.facebook.presto.testing.LocalQueryRunner) Session(com.facebook.presto.Session)

Example 17 with LocalQueryRunner

use of com.facebook.presto.testing.LocalQueryRunner 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 18 with LocalQueryRunner

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

Example 19 with LocalQueryRunner

use of com.facebook.presto.testing.LocalQueryRunner in project presto by prestodb.

the class TestLocalQueriesIndexed 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 IndexedTpchConnectorFactory(INDEX_SPEC, 1), ImmutableMap.of());
    return localQueryRunner;
}
Also used : IndexedTpchConnectorFactory(com.facebook.presto.tests.tpch.IndexedTpchConnectorFactory) LocalQueryRunner(com.facebook.presto.testing.LocalQueryRunner) Session(com.facebook.presto.Session)

Aggregations

LocalQueryRunner (com.facebook.presto.testing.LocalQueryRunner)19 Session (com.facebook.presto.Session)13 TpchConnectorFactory (com.facebook.presto.tpch.TpchConnectorFactory)11 ConnectorId (com.facebook.presto.connector.ConnectorId)3 SessionPropertyManager (com.facebook.presto.metadata.SessionPropertyManager)3 Plan (com.facebook.presto.sql.planner.Plan)3 BenchmarkQueryRunner.createLocalQueryRunner (com.facebook.presto.benchmark.BenchmarkQueryRunner.createLocalQueryRunner)2 TestingSession.testSessionBuilder (com.facebook.presto.testing.TestingSession.testSessionBuilder)2 ImmutableMap (com.google.common.collect.ImmutableMap)2 File (java.io.File)2 SessionBuilder (com.facebook.presto.Session.SessionBuilder)1 BenchmarkSuite (com.facebook.presto.benchmark.BenchmarkSuite)1 TestingHiveMetastore (com.facebook.presto.hive.metastore.TestingHiveMetastore)1 Driver (com.facebook.presto.operator.Driver)1 OperatorContext (com.facebook.presto.operator.OperatorContext)1 OutputFactory (com.facebook.presto.operator.OutputFactory)1 TaskContext (com.facebook.presto.operator.TaskContext)1 MemoryConnectorFactory (com.facebook.presto.plugin.memory.MemoryConnectorFactory)1 QueryId (com.facebook.presto.spi.QueryId)1 ConnectorFactory (com.facebook.presto.spi.connector.ConnectorFactory)1