Skip to content

Commit

Permalink
Throw TrinoException when Iceberg commit fails
Browse files Browse the repository at this point in the history
  • Loading branch information
pajaks committed Nov 6, 2024
1 parent 8f66aef commit 80bdba4
Showing 1 changed file with 4 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -163,6 +163,8 @@
import org.apache.iceberg.UpdateSchema;
import org.apache.iceberg.UpdateStatistics;
import org.apache.iceberg.exceptions.AlreadyExistsException;
import org.apache.iceberg.exceptions.CommitFailedException;
import org.apache.iceberg.exceptions.CommitStateUnknownException;
import org.apache.iceberg.exceptions.ValidationException;
import org.apache.iceberg.expressions.Expressions;
import org.apache.iceberg.expressions.Term;
Expand Down Expand Up @@ -1810,7 +1812,7 @@ private static void commitUpdateAndTransaction(SnapshotUpdate<?> update, Connect
commit(update, session);
commitTransaction(transaction, operation);
}
catch (UncheckedIOException | ValidationException e) {
catch (UncheckedIOException | ValidationException | CommitFailedException | CommitStateUnknownException e) {
throw new TrinoException(ICEBERG_COMMIT_ERROR, format("Failed to commit during %s: %s", operation, firstNonNull(e.getMessage(), e)), e);
}
}
Expand All @@ -1820,7 +1822,7 @@ private static void commitTransaction(Transaction transaction, String operation)
try {
transaction.commitTransaction();
}
catch (ValidationException e) {
catch (ValidationException | CommitFailedException | CommitStateUnknownException e) {
throw new TrinoException(ICEBERG_COMMIT_ERROR, format("Failed to commit the transaction during %s: %s", operation, firstNonNull(e.getMessage(), e)), e);
}
}
Expand Down

0 comments on commit 80bdba4

Please sign in to comment.