Search in sources :

Example 1 with ExceptionFailure

use of org.apache.spark.ExceptionFailure in project presto by prestodb.

the class TestPrestoSparkExecutionExceptionFactory method testRoundTrip.

@Test
public void testRoundTrip() {
    String causeMessage = "cause message";
    IOException cause = new IOException(causeMessage);
    String suppressedMessage = "suppressed message";
    IllegalArgumentException suppressed = new IllegalArgumentException(suppressedMessage);
    String message = "presto exception message";
    PrestoException prestoException = new PrestoException(NOT_SUPPORTED, message, cause);
    prestoException.addSuppressed(suppressed);
    PrestoSparkExecutionException executionException = factory.toPrestoSparkExecutionException(prestoException);
    Optional<ExecutionFailureInfo> failure = factory.extractExecutionFailureInfo(executionException);
    assertTrue(failure.isPresent());
    assertFailure(failure.get().toFailure(), prestoException);
    ExceptionFailure exceptionFailure = new ExceptionFailure(executionException, asScalaBuffer(ImmutableList.of()));
    SparkException sparkException = new SparkException(SPARK_EXCEPTION_STRING + exceptionFailure.toErrorString());
    failure = factory.extractExecutionFailureInfo(sparkException);
    assertTrue(failure.isPresent());
    assertFailure(failure.get().toFailure(), prestoException);
}
Also used : SparkException(org.apache.spark.SparkException) ExceptionFailure(org.apache.spark.ExceptionFailure) PrestoException(com.facebook.presto.spi.PrestoException) IOException(java.io.IOException) PrestoSparkExecutionException(com.facebook.presto.spark.classloader_interface.PrestoSparkExecutionException) ExecutionFailureInfo(com.facebook.presto.execution.ExecutionFailureInfo) Test(org.testng.annotations.Test)

Aggregations

ExecutionFailureInfo (com.facebook.presto.execution.ExecutionFailureInfo)1 PrestoSparkExecutionException (com.facebook.presto.spark.classloader_interface.PrestoSparkExecutionException)1 PrestoException (com.facebook.presto.spi.PrestoException)1 IOException (java.io.IOException)1 ExceptionFailure (org.apache.spark.ExceptionFailure)1 SparkException (org.apache.spark.SparkException)1 Test (org.testng.annotations.Test)1