Search in sources :

Example 6 with WarningCode

use of io.prestosql.spi.WarningCode in project hetu-core by openlookeng.

the class TestCompletedEventWarnings method assertWarnings.

private void assertWarnings(@Language("SQL") String sql, Map<String, String> sessionProperties, List<WarningCode> expectedWarnings) throws InterruptedException {
    // Task concurrency must be 1 otherwise these tests fail due to change in the number of EXPECTED_EVENTS
    SessionBuilder sessionBuilder = testSessionBuilder().setSystemProperty("task_concurrency", "1");
    sessionProperties.forEach(sessionBuilder::setSystemProperty);
    queryRunner.execute(sessionBuilder.build(), sql);
    generatedEvents.waitForEvents(10);
    Set<WarningCode> warnings = getOnlyElement(generatedEvents.getQueryCompletedEvents()).getWarnings().stream().map(PrestoWarning::getWarningCode).collect(toImmutableSet());
    for (WarningCode warningCode : expectedWarnings) {
        if (!warnings.contains(warningCode)) {
            fail("Expected warning: " + warningCode);
        }
    }
}
Also used : SessionBuilder(io.prestosql.Session.SessionBuilder) TestingSession.testSessionBuilder(io.prestosql.testing.TestingSession.testSessionBuilder) WarningCode(io.prestosql.spi.WarningCode)

Aggregations

WarningCode (io.prestosql.spi.WarningCode)6 PrestoWarning (io.prestosql.spi.PrestoWarning)4 Test (org.testng.annotations.Test)4 ImmutableList (com.google.common.collect.ImmutableList)2 Session (io.prestosql.Session)2 DefaultWarningCollector (io.prestosql.execution.warnings.DefaultWarningCollector)2 WarningCollector (io.prestosql.execution.warnings.WarningCollector)2 WarningCollectorConfig (io.prestosql.execution.warnings.WarningCollectorConfig)2 SemanticException (io.prestosql.sql.analyzer.SemanticException)2 TestingSession.testSessionBuilder (io.prestosql.testing.TestingSession.testSessionBuilder)2 Preconditions.checkArgument (com.google.common.base.Preconditions.checkArgument)1 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)1 ImmutableMap (com.google.common.collect.ImmutableMap)1 ImmutableSet (com.google.common.collect.ImmutableSet)1 ImmutableSet.toImmutableSet (com.google.common.collect.ImmutableSet.toImmutableSet)1 SessionBuilder (io.prestosql.Session.SessionBuilder)1 Captures (io.prestosql.matching.Captures)1 Pattern (io.prestosql.matching.Pattern)1 TpchConnectorFactory (io.prestosql.plugin.tpch.TpchConnectorFactory)1 ProjectNode (io.prestosql.spi.plan.ProjectNode)1