Search in sources :

Example 16 with DistributedQueryRunner

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);
    }
}
Also used : DistributedQueryRunner(io.prestosql.tests.DistributedQueryRunner) QueryId(io.prestosql.spi.QueryId) ResourceGroupManagerPlugin(io.prestosql.plugin.resourcegroups.ResourceGroupManagerPlugin) TestQueryRunnerUtil.waitForQueryState(io.prestosql.execution.TestQueryRunnerUtil.waitForQueryState) Test(org.testng.annotations.Test)

Example 17 with DistributedQueryRunner

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"));
    }
}
Also used : DistributedQueryRunner(io.prestosql.tests.DistributedQueryRunner) ResourceGroupManagerPlugin(io.prestosql.plugin.resourcegroups.ResourceGroupManagerPlugin) Test(org.testng.annotations.Test)

Example 18 with DistributedQueryRunner

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"));
    }
}
Also used : DistributedQueryRunner(io.prestosql.tests.DistributedQueryRunner) ResourceGroupManagerPlugin(io.prestosql.plugin.resourcegroups.ResourceGroupManagerPlugin) Test(org.testng.annotations.Test)

Example 19 with DistributedQueryRunner

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());
}
Also used : DistributedQueryRunner(io.prestosql.tests.DistributedQueryRunner) Logger(io.airlift.log.Logger)

Example 20 with DistributedQueryRunner

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;
    }
}
Also used : DistributedQueryRunner(io.prestosql.tests.DistributedQueryRunner) HashMap(java.util.HashMap) TpchPlugin(io.prestosql.plugin.tpch.TpchPlugin)

Aggregations

DistributedQueryRunner (io.prestosql.tests.DistributedQueryRunner)75 Test (org.testng.annotations.Test)28 TpchPlugin (io.prestosql.plugin.tpch.TpchPlugin)22 Session (io.prestosql.Session)16 QueryId (io.prestosql.spi.QueryId)13 MaterializedResult (io.prestosql.testing.MaterializedResult)13 ResourceGroupManagerPlugin (io.prestosql.plugin.resourcegroups.ResourceGroupManagerPlugin)11 Logger (io.airlift.log.Logger)10 HashMap (java.util.HashMap)8 ResultWithQueryId (io.prestosql.tests.ResultWithQueryId)7 List (java.util.List)7 Assert.assertTrue (org.testng.Assert.assertTrue)7 ImmutableSet (com.google.common.collect.ImmutableSet)6 ENABLE_DYNAMIC_FILTERING (io.prestosql.SystemSessionProperties.ENABLE_DYNAMIC_FILTERING)6 JOIN_DISTRIBUTION_TYPE (io.prestosql.SystemSessionProperties.JOIN_DISTRIBUTION_TYPE)6 OperatorStats (io.prestosql.operator.OperatorStats)6 TestingPrestoServer (io.prestosql.server.testing.TestingPrestoServer)6 FeaturesConfig (io.prestosql.sql.analyzer.FeaturesConfig)6 TestingConnectorSession (io.prestosql.testing.TestingConnectorSession)6 AbstractTestQueryFramework (io.prestosql.tests.AbstractTestQueryFramework)6