use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.
the class RedisQueryRunner method createRedisQueryRunner.
public static DistributedQueryRunner createRedisQueryRunner(RedisServer redisServer, Map<String, String> extraProperties, String dataFormat, Iterable<TpchTable<?>> tables) throws Exception {
DistributedQueryRunner queryRunner = null;
try {
queryRunner = DistributedQueryRunner.builder(createSession()).setExtraProperties(extraProperties).build();
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
Map<SchemaTableName, RedisTableDescription> tableDescriptions = createTpchTableDescriptions(queryRunner.getCoordinator().getTypeManager(), tables, dataFormat);
installRedisPlugin(redisServer, queryRunner, tableDescriptions);
TestingTrinoClient trinoClient = queryRunner.getClient();
log.info("Loading data...");
long startTime = System.nanoTime();
for (TpchTable<?> table : tables) {
loadTpchTable(redisServer, trinoClient, table, dataFormat);
}
log.info("Loading complete in %s", nanosSince(startTime).toString(SECONDS));
redisServer.destroyJedisPool();
return queryRunner;
} catch (Throwable e) {
closeAllSuppress(e, queryRunner, redisServer);
throw e;
}
}
use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.
the class TestQueryRunnerUtil method createQueryRunner.
public static DistributedQueryRunner createQueryRunner(Map<String, String> extraProperties) throws Exception {
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(testSessionBuilder().build()).setExtraProperties(extraProperties).setNodeCount(2).build();
try {
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
return queryRunner;
} catch (Exception e) {
queryRunner.close();
throw e;
}
}
use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.
the class TestErrorThrowableInQuery method createQueryRunner.
@Override
protected DistributedQueryRunner createQueryRunner() throws Exception {
Session session = testSessionBuilder().setSystemProperty("task_concurrency", "1").setCatalog("mock").setSchema("default").setClientInfo("{\"clientVersion\":\"testVersion\"}").build();
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(session).setNodeCount(1).build();
try {
queryRunner.installPlugin(new TpchPlugin());
queryRunner.installPlugin(new ResourceGroupManagerPlugin());
queryRunner.installPlugin(new Plugin() {
@Override
public Iterable<ConnectorFactory> getConnectorFactories() {
SchemaTableName stackOverflowErrorTableName = new SchemaTableName("default", "stack_overflow_during_planning");
SchemaTableName classFormatErrorTableName = new SchemaTableName("default", "class_format_error_during_planning");
MockConnectorFactory connectorFactory = MockConnectorFactory.builder().withListTables((session, s) -> ImmutableList.of(stackOverflowErrorTableName)).withGetColumns(schemaTableName -> ImmutableList.of(new ColumnMetadata("test_varchar", createUnboundedVarcharType()), new ColumnMetadata("test_bigint", BIGINT))).withGetTableHandle((session, schemaTableName) -> new MockConnectorTableHandle(schemaTableName)).withApplyProjection((session, handle, projections, assignments) -> {
MockConnectorTableHandle mockTableHandle = (MockConnectorTableHandle) handle;
if (stackOverflowErrorTableName.equals(mockTableHandle.getTableName())) {
throw new StackOverflowError("We run out of stack!!!!!!!!!!!");
}
if (classFormatErrorTableName.equals(mockTableHandle.getTableName())) {
throw new ClassFormatError("Bad class format!!!!!!!!!!");
}
throw new TrinoException(NOT_FOUND, "Unknown table: " + mockTableHandle.getTableName());
}).build();
return ImmutableList.of(connectorFactory);
}
});
queryRunner.createCatalog("mock", "mock", ImmutableMap.of());
} catch (Exception e) {
queryRunner.close();
throw e;
}
return queryRunner;
}
use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.
the class TestFinalQueryInfo method createQueryRunner.
public static DistributedQueryRunner createQueryRunner(Session session) throws Exception {
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(session).setNodeCount(2).build();
try {
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
return queryRunner;
} catch (Exception e) {
queryRunner.close();
throw e;
}
}
use of io.trino.plugin.tpch.TpchPlugin in project trino by trinodb.
the class TestKillQuery method createQueryRunner.
@Override
protected QueryRunner createQueryRunner() throws Exception {
Session defaultSession = testSessionBuilder().setCatalog("tpch").setSchema("tiny").build();
DistributedQueryRunner queryRunner = DistributedQueryRunner.builder(defaultSession).build();
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch");
return queryRunner;
}
Aggregations