use of com.facebook.presto.testing.LocalQueryRunner in project presto by prestodb.
the class LocalAtopQueryRunner method createQueryRunner.
public static LocalQueryRunner createQueryRunner(Map<String, String> catalogProperties, Class<? extends AtopFactory> factoryClass) throws Exception {
Session session = testSessionBuilder().setCatalog("atop").setSchema("default").setTimeZoneKey(TimeZoneKey.getTimeZoneKey(TimeZone.getDefault().getID())).build();
LocalQueryRunner queryRunner = new LocalQueryRunner(session);
try {
AtopConnectorFactory connectorFactory = new AtopConnectorFactory(factoryClass, LocalAtopQueryRunner.class.getClassLoader());
ImmutableMap.Builder<String, String> properties = ImmutableMap.<String, String>builder().putAll(catalogProperties).put("atop.max-history-days", "1");
queryRunner.createCatalog("atop", connectorFactory, properties.build());
return queryRunner;
} catch (Exception e) {
closeAllSuppress(e, queryRunner);
throw e;
}
}
use of com.facebook.presto.testing.LocalQueryRunner in project presto by prestodb.
the class StatisticsBenchmark method main.
public static void main(String... args) {
LocalQueryRunner localQueryRunner = createLocalQueryRunner();
new LongVarianceBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
new LongVariancePopBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
new DoubleVarianceBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
new DoubleVariancePopBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
new LongStdDevBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
new LongStdDevPopBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
new DoubleStdDevBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
new DoubleStdDevPopBenchmark(localQueryRunner).runBenchmark(new AverageBenchmarkResults());
}
use of com.facebook.presto.testing.LocalQueryRunner in project presto by prestodb.
the class TestIterativeOptimizer method setUp.
@BeforeClass
public void setUp() {
Session.SessionBuilder sessionBuilder = testSessionBuilder().setCatalog("local").setSchema("tiny").setSystemProperty("task_concurrency", "1").setSystemProperty("iterative_optimizer_enabled", "true").setSystemProperty("iterative_optimizer_timeout", "1ms");
queryRunner = new LocalQueryRunner(sessionBuilder.build());
queryRunner.createCatalog(queryRunner.getDefaultSession().getCatalog().get(), new TpchConnectorFactory(1), ImmutableMap.of());
}
use of com.facebook.presto.testing.LocalQueryRunner in project presto by prestodb.
the class TestMergeWindows method assertUnitPlan.
private void assertUnitPlan(@Language("SQL") String sql, PlanMatchPattern pattern) {
LocalQueryRunner queryRunner = getQueryRunner();
List<PlanOptimizer> optimizers = ImmutableList.of(new UnaliasSymbolReferences(), new PruneIdentityProjections(), new MergeWindows(), new PruneUnreferencedOutputs());
queryRunner.inTransaction(transactionSession -> {
Plan actualPlan = queryRunner.createPlan(transactionSession, sql, optimizers);
PlanAssert.assertPlan(transactionSession, queryRunner.getMetadata(), actualPlan, pattern);
return null;
});
}
use of com.facebook.presto.testing.LocalQueryRunner in project presto by prestodb.
the class TestLocalBinarySpilledQueries method createLocalQueryRunner.
private static LocalQueryRunner createLocalQueryRunner() {
Session defaultSession = testSessionBuilder().setCatalog("local").setSchema(TINY_SCHEMA_NAME).setSystemProperty(SystemSessionProperties.SPILL_ENABLED, "true").setSystemProperty(SystemSessionProperties.OPERATOR_MEMORY_LIMIT_BEFORE_SPILL, //spill constantly
"1B").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());
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;
}
Aggregations