Search in sources :

Example 21 with PrestoWarning

use of com.facebook.presto.spi.PrestoWarning in project presto by prestodb.

the class TestDefaultWarningCollector method testWarningAsErrorNoExceptionWhenAddingParserWarning.

@Test
public void testWarningAsErrorNoExceptionWhenAddingParserWarning() {
    WarningCollector warningCollector = new DefaultWarningCollector(new WarningCollectorConfig(), WarningHandlingLevel.AS_ERROR);
    warningCollector.add(new PrestoWarning(StandardWarningCode.PARSER_WARNING, "1"));
    assertEquals(warningCollector.getWarnings().size(), 1);
}
Also used : PrestoWarning(com.facebook.presto.spi.PrestoWarning) WarningCollector(com.facebook.presto.spi.WarningCollector) Test(org.testng.annotations.Test)

Example 22 with PrestoWarning

use of com.facebook.presto.spi.PrestoWarning in project presto by prestodb.

the class TestCompletedEventWarnings method testCompletedEventWarnings.

@Test
public void testCompletedEventWarnings() throws InterruptedException {
    TestingWarningCollectorConfig warningCollectorConfig = new TestingWarningCollectorConfig().setPreloadedWarnings(TEST_WARNINGS);
    TestingWarningCollector testingWarningCollector = new TestingWarningCollector(new WarningCollectorConfig(), warningCollectorConfig);
    assertWarnings("select 1", ImmutableMap.of(), testingWarningCollector.getWarnings().stream().map(PrestoWarning::getWarningCode).collect(toImmutableList()));
}
Also used : TestingWarningCollectorConfig(com.facebook.presto.testing.TestingWarningCollectorConfig) WarningCollectorConfig(com.facebook.presto.execution.warnings.WarningCollectorConfig) TestingWarningCollectorConfig(com.facebook.presto.testing.TestingWarningCollectorConfig) PrestoWarning(com.facebook.presto.spi.PrestoWarning) TestingWarningCollector(com.facebook.presto.testing.TestingWarningCollector) Test(org.testng.annotations.Test)

Aggregations

PrestoWarning (com.facebook.presto.spi.PrestoWarning)22 Test (org.testng.annotations.Test)14 WarningCollector (com.facebook.presto.spi.WarningCollector)10 WarningCode (com.facebook.presto.spi.WarningCode)6 ImmutableList (com.google.common.collect.ImmutableList)6 WarningCollectorConfig (com.facebook.presto.execution.warnings.WarningCollectorConfig)5 StandardWarningCode (com.facebook.presto.spi.StandardWarningCode)4 TestingWarningCollector (com.facebook.presto.testing.TestingWarningCollector)3 TestingWarningCollectorConfig (com.facebook.presto.testing.TestingWarningCollectorConfig)3 RemoteTask (com.facebook.presto.execution.RemoteTask)2 TaskId (com.facebook.presto.execution.TaskId)2 DefaultWarningCollector (com.facebook.presto.execution.warnings.DefaultWarningCollector)2 ImmutableList.toImmutableList (com.google.common.collect.ImmutableList.toImmutableList)2 SQLWarning (java.sql.SQLWarning)2 HashMap (java.util.HashMap)2 AfterClass (org.testng.annotations.AfterClass)2 BoundedExecutor (com.facebook.airlift.concurrent.BoundedExecutor)1 Threads.daemonThreadsNamed (com.facebook.airlift.concurrent.Threads.daemonThreadsNamed)1 CounterStat (com.facebook.airlift.stats.CounterStat)1 Session (com.facebook.presto.Session)1