use of io.prestosql.tests.DistributedQueryRunner in project hetu-core by openlookeng.
the class TestQueues method testResourceGroupManagerWithTwoDashboardQueriesRequestedAtTheSameTime.
@Test(timeOut = 240_000)
public void testResourceGroupManagerWithTwoDashboardQueriesRequestedAtTheSameTime() throws Exception {
try (DistributedQueryRunner queryRunner = createQueryRunner()) {
queryRunner.installPlugin(new ResourceGroupManagerPlugin());
queryRunner.getCoordinator().getResourceGroupManager().get().setConfigurationManager("file", ImmutableMap.of("resource-groups.config-file", getResourceFilePath("resource_groups_config_dashboard.json")));
QueryId firstDashboardQuery = createDashboardQuery(queryRunner);
QueryId secondDashboardQuery = createDashboardQuery(queryRunner);
ImmutableSet<QueryState> queuedOrRunning = ImmutableSet.of(QUEUED, RUNNING);
waitForQueryState(queryRunner, firstDashboardQuery, queuedOrRunning);
waitForQueryState(queryRunner, secondDashboardQuery, queuedOrRunning);
}
}
use of io.prestosql.tests.DistributedQueryRunner in project hetu-core by openlookeng.
the class TestQueues method testQueryTypeBasedSelection.
@Test(timeOut = 240_000)
public void testQueryTypeBasedSelection() throws Exception {
try (DistributedQueryRunner queryRunner = TpchQueryRunnerBuilder.builder().build()) {
queryRunner.installPlugin(new ResourceGroupManagerPlugin());
queryRunner.getCoordinator().getResourceGroupManager().get().setConfigurationManager("file", ImmutableMap.of("resource-groups.config-file", getResourceFilePath("resource_groups_query_type_based_config.json")));
assertResourceGroup(queryRunner, newAdhocSession(), LONG_LASTING_QUERY, createResourceGroupId("global", "select"));
assertResourceGroup(queryRunner, newAdhocSession(), "SHOW TABLES", createResourceGroupId("global", "describe"));
assertResourceGroup(queryRunner, newAdhocSession(), "EXPLAIN " + LONG_LASTING_QUERY, createResourceGroupId("global", "explain"));
assertResourceGroup(queryRunner, newAdhocSession(), "DESCRIBE lineitem", createResourceGroupId("global", "describe"));
assertResourceGroup(queryRunner, newAdhocSession(), "RESET SESSION " + HASH_PARTITION_COUNT, createResourceGroupId("global", "data_definition"));
}
}
use of io.prestosql.tests.DistributedQueryRunner in project hetu-core by openlookeng.
the class TestQueues method testClientTagsBasedSelection.
@Test(timeOut = 240_000)
public void testClientTagsBasedSelection() throws Exception {
try (DistributedQueryRunner queryRunner = createQueryRunner()) {
queryRunner.installPlugin(new ResourceGroupManagerPlugin());
queryRunner.getCoordinator().getResourceGroupManager().get().setConfigurationManager("file", ImmutableMap.of("resource-groups.config-file", getResourceFilePath("resource_groups_client_tags_based_config.json")));
assertResourceGroup(queryRunner, newSessionWithTags(ImmutableSet.of("a")), LONG_LASTING_QUERY, createResourceGroupId("global", "a", "default"));
assertResourceGroup(queryRunner, newSessionWithTags(ImmutableSet.of("b")), LONG_LASTING_QUERY, createResourceGroupId("global", "b"));
assertResourceGroup(queryRunner, newSessionWithTags(ImmutableSet.of("a", "c")), LONG_LASTING_QUERY, createResourceGroupId("global", "a", "c"));
}
}
use of io.prestosql.tests.DistributedQueryRunner in project hetu-core by openlookeng.
the class KafkaQueryRunner method main.
public static void main(String[] args) throws Exception {
Logging.initialize();
DistributedQueryRunner queryRunner = createKafkaQueryRunner(EmbeddedKafka.createEmbeddedKafka(), TpchTable.getTables());
Thread.sleep(10);
Logger logger = Logger.get(KafkaQueryRunner.class);
logger.info("======== SERVER STARTED ========");
logger.info("\n====\n%s\n====", queryRunner.getCoordinator().getBaseUrl());
}
use of io.prestosql.tests.DistributedQueryRunner in project hetu-core by openlookeng.
the class DataCenterQueryRunner method createDCQueryRunner.
static QueryRunner createDCQueryRunner(TestingPrestoServer hetuServer, Map<String, String> properties, Iterable<TpchTable<?>> tables) throws Exception {
hetuServer.installPlugin(new TpchPlugin());
hetuServer.createCatalog("tpch", "tpch");
DistributedQueryRunner queryRunner = null;
try {
DistributedQueryRunner.Builder builder = DistributedQueryRunner.builder(createSession());
queryRunner = builder.build();
Map<String, String> connectorProperties = new HashMap<>(properties);
connectorProperties.putIfAbsent("connection-url", hetuServer.getBaseUrl().toString());
connectorProperties.putIfAbsent("connection-user", "root");
queryRunner.installPlugin(new DataCenterPlugin());
queryRunner.createDCCatalog("dc", "dc", connectorProperties);
queryRunner.installPlugin(new TpchPlugin());
queryRunner.createCatalog("tpch", "tpch", properties);
return queryRunner;
} catch (Throwable e) {
closeAllSuppress(e, queryRunner);
throw e;
}
}
Aggregations