Search in sources :

Example 1 with QueryFailureInfo

use of io.trino.spi.eventlistener.QueryFailureInfo in project trino by trinodb.

the class TestEventListenerBasic method assertFailedQuery.

private void assertFailedQuery(Session session, @Language("SQL") String sql, String expectedFailure) throws Exception {
    queries.runQueryAndWaitForEvents(sql, 2, session, Optional.of(expectedFailure));
    QueryCompletedEvent queryCompletedEvent = getOnlyElement(generatedEvents.getQueryCompletedEvents());
    assertEquals(queryCompletedEvent.getMetadata().getQuery(), sql);
    QueryFailureInfo failureInfo = queryCompletedEvent.getFailureInfo().orElseThrow(() -> new AssertionError("Expected query event to be failed"));
    assertEquals(expectedFailure, failureInfo.getFailureMessage().orElse(null));
}
Also used : QueryFailureInfo(io.trino.spi.eventlistener.QueryFailureInfo) QueryCompletedEvent(io.trino.spi.eventlistener.QueryCompletedEvent)

Aggregations

QueryCompletedEvent (io.trino.spi.eventlistener.QueryCompletedEvent)1 QueryFailureInfo (io.trino.spi.eventlistener.QueryFailureInfo)1