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;
}
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;
}
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;
}
use of com.facebook.presto.testing.LocalQueryRunner 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;
}
use of com.facebook.presto.testing.LocalQueryRunner in project presto by prestodb.
the class BasePlanTest method assertMinimallyOptimizedPlan.
protected void assertMinimallyOptimizedPlan(@Language("SQL") String sql, PlanMatchPattern pattern) {
LocalQueryRunner queryRunner = getQueryRunner();
List<PlanOptimizer> optimizers = ImmutableList.of(new UnaliasSymbolReferences(), new PruneUnreferencedOutputs(), new PruneIdentityProjections());
queryRunner.inTransaction(transactionSession -> {
Plan actualPlan = queryRunner.createPlan(transactionSession, sql, optimizers, LogicalPlanner.Stage.OPTIMIZED);
PlanAssert.assertPlan(transactionSession, queryRunner.getMetadata(), actualPlan, pattern);
return null;
});
}
Aggregations