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);
}
Aggregations