public boolean shouldResubmit(Throwable throwable)
    {
        if (!(throwable instanceof PrestoQueryException)) {
            return false;
        }
        PrestoQueryException queryException = (PrestoQueryException) throwable;
        Optional<ErrorCodeSupplier> errorCode = queryException.getErrorCode();
        return errorCode.isPresent()
                && (resubmittedErrors.contains(errorCode.get())
                || conditionalResubmittedErrors.stream().anyMatch(matcher -> matcher.matches(errorCode.get(), queryException.getQueryStage(), queryException.getMessage())));
    }
@Test
    public void testResubmittedErrors()
    {
        assertTrue(classifier.shouldResubmit(createTestException(HIVE_PARTITION_DROPPED_DURING_QUERY, TEST_MAIN)));
        assertTrue(classifier.shouldResubmit(createTestException(HIVE_TABLE_DROPPED_DURING_QUERY, TEST_MAIN)));
        assertTrue(classifier.shouldResubmit(createTestException(CLUSTER_OUT_OF_MEMORY, TEST_MAIN)));
        assertTrue(classifier.shouldResubmit(createTestException(ADMINISTRATIVELY_PREEMPTED, TEST_MAIN)));

        // Target Table Already Exists
        String message = "Table 'a.b.c' already exists";
        assertTrue(classifier.shouldResubmit(createTestException(SYNTAX_ERROR, CONTROL_SETUP, message)));
        assertTrue(classifier.shouldResubmit(createTestException(SYNTAX_ERROR, TEST_SETUP, message)));
        assertFalse(classifier.shouldResubmit(createTestException(SYNTAX_ERROR, CONTROL_MAIN, message)));
    }