use of io.trino.testing.LocalQueryRunner in project trino by trinodb.
the class TestMetadataQueryOptimization method createLocalQueryRunner.
@Override
protected LocalQueryRunner createLocalQueryRunner() {
Session session = testSessionBuilder().setCatalog(ICEBERG_CATALOG).setSchema(SCHEMA_NAME).build();
baseDir = Files.createTempDir();
HiveMetastore metastore = createTestingFileHiveMetastore(baseDir);
LocalQueryRunner queryRunner = LocalQueryRunner.create(session);
queryRunner.createCatalog(ICEBERG_CATALOG, new TestingIcebergConnectorFactory(Optional.of(metastore), Optional.empty(), EMPTY_MODULE), ImmutableMap.of());
Database database = Database.builder().setDatabaseName(SCHEMA_NAME).setOwnerName(Optional.of("public")).setOwnerType(Optional.of(PrincipalType.ROLE)).build();
metastore.createDatabase(database);
return queryRunner;
}
use of io.trino.testing.LocalQueryRunner in project trino by trinodb.
the class TestThriftProjectionPushdown method createLocalQueryRunner.
@Override
protected Optional<LocalQueryRunner> createLocalQueryRunner() {
try {
servers = startThriftServers(1, false);
} catch (Throwable t) {
try {
cleanup();
} catch (Throwable e) {
t.addSuppressed(e);
}
throw t;
}
String addresses = servers.stream().map(server -> "localhost:" + driftServerPort(server)).collect(joining(","));
Map<String, String> connectorProperties = ImmutableMap.<String, String>builder().put("trino.thrift.client.addresses", addresses).put("trino.thrift.client.connect-timeout", "30s").put("trino-thrift.lookup-requests-concurrency", "2").buildOrThrow();
LocalQueryRunner runner = LocalQueryRunner.create(SESSION);
runner.createCatalog(CATALOG, getOnlyElement(new ThriftPlugin().getConnectorFactories()), connectorProperties);
return Optional.of(runner);
}
use of io.trino.testing.LocalQueryRunner in project trino by trinodb.
the class ArrayComparisonBenchmark method main.
public static void main(String... args) {
LocalQueryRunner localQueryRunner = createLocalQueryRunner();
new ArrayEqualsBenchmark(localQueryRunner).runBenchmark(new SimpleLineBenchmarkResultWriter(System.out));
new ArrayLessThanBenchmark(localQueryRunner).runBenchmark(new SimpleLineBenchmarkResultWriter(System.out));
new ArrayGreaterThanBenchmark(localQueryRunner).runBenchmark(new SimpleLineBenchmarkResultWriter(System.out));
new ArrayNotEqualBenchmark(localQueryRunner).runBenchmark(new SimpleLineBenchmarkResultWriter(System.out));
new ArrayLessThanOrEqualBenchmark(localQueryRunner).runBenchmark(new SimpleLineBenchmarkResultWriter(System.out));
new ArrayGreaterThanOrEqualBenchmark(localQueryRunner).runBenchmark(new SimpleLineBenchmarkResultWriter(System.out));
}
use of io.trino.testing.LocalQueryRunner in project trino by trinodb.
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 = LocalQueryRunner.create(session);
// add tpch
localQueryRunner.createCatalog("tpch", new TpchConnectorFactory(1), ImmutableMap.of());
return localQueryRunner;
}
use of io.trino.testing.LocalQueryRunner in project trino by trinodb.
the class TestTpcdsCostBasedPlan method createLocalQueryRunner.
/*
* CAUTION: The expected plans here are not necessarily optimal yet. Their role is to prevent
* inadvertent regressions. A conscious improvement to the planner may require changing some
* of the expected plans, but any such change should be verified on an actual cluster with
* large amount of data.
*/
@Override
protected LocalQueryRunner createLocalQueryRunner() {
String catalog = "local";
Session.SessionBuilder sessionBuilder = testSessionBuilder().setCatalog(catalog).setSchema("sf3000.0").setSystemProperty("task_concurrency", // these tests don't handle exchanges from local parallel
"1").setSystemProperty(JOIN_REORDERING_STRATEGY, JoinReorderingStrategy.AUTOMATIC.name()).setSystemProperty(JOIN_DISTRIBUTION_TYPE, JoinDistributionType.AUTOMATIC.name());
LocalQueryRunner queryRunner = LocalQueryRunner.builder(sessionBuilder.build()).withNodeCountForStats(8).build();
queryRunner.createCatalog(catalog, new TpcdsConnectorFactory(1), ImmutableMap.of());
return queryRunner;
}
Aggregations