File tree Expand file tree Collapse file tree 3 files changed +16
-8
lines changed
api/src/main/java/org/apache/iceberg/exceptions
core/src/main/java/org/apache/iceberg/rest Expand file tree Collapse file tree 3 files changed +16
-8
lines changed Original file line number Diff line number Diff line change 2121import com .google .errorprone .annotations .FormatMethod ;
2222
2323/** Exception thrown on HTTP 400 - Bad Request */
24- public class BadRequestException extends RuntimeException implements CleanableFailure {
24+ public class BadRequestException extends RESTException implements CleanableFailure {
2525 @ FormatMethod
2626 public BadRequestException (String message , Object ... args ) {
27- super (String . format ( message , args ) );
27+ super (message , args );
2828 }
2929
3030 @ FormatMethod
3131 public BadRequestException (Throwable cause , String message , Object ... args ) {
32- super (String . format ( message , args ), cause );
32+ super (cause , message , args );
3333 }
3434}
Original file line number Diff line number Diff line change 2121import com .google .errorprone .annotations .FormatMethod ;
2222
2323/** Exception thrown on HTTP 403 Forbidden - Failed authorization checks. */
24- public class ForbiddenException extends RuntimeException implements CleanableFailure {
24+ public class ForbiddenException extends RESTException implements CleanableFailure {
2525 @ FormatMethod
2626 public ForbiddenException (String message , Object ... args ) {
27- super (String . format ( message , args ) );
27+ super (message , args );
2828 }
2929
3030 @ FormatMethod
3131 public ForbiddenException (Throwable cause , String message , Object ... args ) {
32- super (String . format ( message , args ), cause );
32+ super (cause , message , args );
3333 }
3434}
Original file line number Diff line number Diff line change 5959import org .apache .iceberg .exceptions .NoSuchNamespaceException ;
6060import org .apache .iceberg .exceptions .NoSuchTableException ;
6161import org .apache .iceberg .exceptions .NoSuchViewException ;
62+ import org .apache .iceberg .exceptions .RESTException ;
6263import org .apache .iceberg .hadoop .Configurable ;
6364import org .apache .iceberg .io .CloseableGroup ;
6465import org .apache .iceberg .io .FileIO ;
@@ -717,8 +718,15 @@ public Transaction createTransaction() {
717718
718719 @ Override
719720 public Transaction replaceTransaction () {
720- if (viewExists (context , ident )) {
721- throw new AlreadyExistsException ("View with same name already exists: %s" , ident );
721+ try {
722+ if (viewExists (context , ident )) {
723+ throw new AlreadyExistsException ("View with same name already exists: %s" , ident );
724+ }
725+ } catch (RESTException | UnsupportedOperationException e ) {
726+ // don't fail if the server doesn't support views, which could be due to:
727+ // 1. server or backing catalog doesn't support views
728+ // 2. newer client talks to an older server that doesn't support views
729+ LOG .debug ("Failed to check whether view {} exists" , ident , e );
722730 }
723731
724732 LoadTableResponse response = loadInternal (context , ident , snapshotMode );
You can’t perform that action at this time.
0 commit comments