use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.
the class SingleStoreQueryRunner method createSingleStoreQueryRunner.
public static DistributedQueryRunner createSingleStoreQueryRunner(TestingSingleStoreServer server, Map<String, String> extraProperties, Map<String, String> connectorProperties, Iterable<TpchTable<?>> tables) throws Exception {
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(createSession()).setExtraProperties(extraProperties).build();
try {
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
connectorProperties = new HashMap<>(ImmutableMap.copyOf(connectorProperties));
connectorProperties.putIfAbsent("connection-url", server.getJdbcUrl());
connectorProperties.putIfAbsent("connection-user", server.getUsername());
connectorProperties.putIfAbsent("connection-password", server.getPassword());
server.execute("CREATE SCHEMA tpch");
queryRunner.installPlugin(new SingleStorePlugin());
queryRunner.createCatalog("singlestore", "singlestore", connectorProperties);
copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), tables);
return queryRunner;
} catch (Throwable e) {
closeAllSuppress(e, queryRunner);
throw e;
}
}
use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.
the class ThriftQueryRunner method createThriftQueryRunnerInternal.
private static DistributedQueryRunner createThriftQueryRunnerInternal(List<DriftServer> servers, Map<String, String> properties) throws Exception {
String addresses = servers.stream().map(server -> "localhost:" + driftServerPort(server)).collect(joining(","));
Session defaultSession = testSessionBuilder().setCatalog("thrift").setSchema("tiny").build();
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(defaultSession).setExtraProperties(properties).build();
queryRunner.installPlugin(new ThriftPlugin());
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();
queryRunner.createCatalog("thrift", "trino-thrift", connectorProperties);
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
return queryRunner;
}
use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.
the class TestSharedGlueMetastore method createQueryRunner.
@Override
protected QueryRunner createQueryRunner() throws Exception {
Session icebergSession = testSessionBuilder().setCatalog(ICEBERG_CATALOG).setSchema(schema).build();
Session hiveSession = testSessionBuilder().setCatalog(HIVE_CATALOG).setSchema(schema).build();
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(icebergSession).build();
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
this.dataDirectory = queryRunner.getCoordinator().getBaseDataDir().resolve("iceberg_data");
this.dataDirectory.toFile().deleteOnExit();
queryRunner.installPlugin(new IcebergPlugin());
queryRunner.createCatalog(ICEBERG_CATALOG, "iceberg", ImmutableMap.of("iceberg.catalog.type", "glue", "hive.metastore.glue.default-warehouse-dir", dataDirectory.toString()));
HdfsConfig hdfsConfig = new HdfsConfig();
HdfsEnvironment hdfsEnvironment = new HdfsEnvironment(new HiveHdfsConfiguration(new HdfsConfigurationInitializer(hdfsConfig), ImmutableSet.of()), hdfsConfig, new NoHdfsAuthentication());
this.glueMetastore = new GlueHiveMetastore(hdfsEnvironment, new GlueHiveMetastoreConfig(), directExecutor(), new DefaultGlueColumnStatisticsProviderFactory(new GlueHiveMetastoreConfig(), directExecutor(), directExecutor()), Optional.empty(), table -> true);
queryRunner.installPlugin(new TestingHivePlugin(glueMetastore));
queryRunner.createCatalog(HIVE_CATALOG, "hive");
queryRunner.createCatalog("hive_with_redirections", "hive", ImmutableMap.of("hive.iceberg-catalog-name", "iceberg"));
queryRunner.execute("CREATE SCHEMA " + schema + " WITH (location = '" + dataDirectory.toString() + "')");
copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, icebergSession, ImmutableList.of(TpchTable.NATION));
copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, hiveSession, ImmutableList.of(TpchTable.REGION));
return queryRunner;
}
use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.
the class TestIcebergMetadataFileOperations method createQueryRunner.
@Override
protected DistributedQueryRunner createQueryRunner() throws Exception {
Session session = testSessionBuilder().setCatalog("iceberg").setSchema("test_schema").build();
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(session).setNodeCount(1).build();
File baseDir = queryRunner.getCoordinator().getBaseDataDir().resolve("iceberg_data").toFile();
HiveMetastore metastore = createTestingFileHiveMetastore(baseDir);
trackingFileIoProvider = new TrackingFileIoProvider(new HdfsFileIoProvider(HDFS_ENVIRONMENT));
queryRunner.installPlugin(new TestingIcebergPlugin(Optional.of(metastore), Optional.of(trackingFileIoProvider), EMPTY_MODULE));
queryRunner.createCatalog("iceberg", "iceberg");
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
queryRunner.execute("CREATE SCHEMA test_schema");
copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, session, TpchTable.getTables());
return queryRunner;
}
use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.
the class OracleQueryRunner method createOracleQueryRunner.
public static DistributedQueryRunner createOracleQueryRunner(TestingOracleServer server, Map<String, String> extraProperties, Map<String, String> connectorProperties, Iterable<TpchTable<?>> tables) throws Exception {
DistributedQueryRunner queryRunner = null;
try {
queryRunner = DistributedQueryRunner.builder(createSession()).setExtraProperties(extraProperties).build();
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
queryRunner.installPlugin(new OraclePlugin());
queryRunner.createCatalog("oracle", "oracle", connectorProperties);
copyTpchTables(queryRunner, "tpch", TINY_SCHEMA_NAME, createSession(), tables);
return queryRunner;
} catch (Throwable e) {
closeAllSuppress(e, queryRunner, server);
throw e;
}
}
Aggregations