@Override
    public Optional<String> resolveQueryFailure(QueryStats controlQueryStats, QueryException queryException, Optional<QueryObjectBundle> test)
    {
        return mapMatchingPrestoException(queryException, TEST_MAIN, ImmutableSet.of(EXCEEDED_GLOBAL_MEMORY_LIMIT),
                e -> e.getQueryActionStats().getQueryStats().isPresent()
                        && controlQueryStats.getPeakTotalMemoryBytes() > e.getQueryActionStats().getQueryStats().get().getPeakTotalMemoryBytes()
                        ? Optional.of("Control query uses more memory than the test cluster memory limit")
                        : Optional.empty());
    }
@Test
    public void testResolved()
    {
        assertEquals(
                getFailureResolver().resolveQueryFailure(
                        CONTROL_QUERY_STATS,
                        new PrestoQueryException(
                                new RuntimeException(),
                                false,
                                TEST_MAIN,
                                Optional.of(EXCEEDED_GLOBAL_MEMORY_LIMIT),
                                createQueryActionStats(CONTROL_CPU_TIME_MILLIS, 500L * 1024 * 1024 * 1024)),
                        Optional.empty()),
                Optional.of("Control query uses more memory than the test cluster memory limit"));
    }