6262import org .apache .iceberg .exceptions .AlreadyExistsException ;
6363import org .apache .iceberg .exceptions .BadRequestException ;
6464import org .apache .iceberg .exceptions .NoSuchTableException ;
65+ import org .apache .iceberg .exceptions .NotFoundException ;
6566import org .apache .iceberg .io .CloseableIterable ;
6667import org .apache .iceberg .io .FileAppender ;
6768import org .apache .iceberg .io .FileIO ;
@@ -361,7 +362,15 @@ private static List<DataFile> processFile(
361362 };
362363
363364 InputFile inputFile = Input .newFile (file , catalog , inputIO == null ? tableIO : inputIO );
364- ParquetMetadata metadata = Metadata .read (inputFile );
365+ ParquetMetadata metadata ;
366+ try {
367+ metadata = Metadata .read (inputFile );
368+ } catch (NotFoundException e ) {
369+ if (options .ignoreNotFound ) {
370+ return List .of ();
371+ }
372+ throw e ;
373+ }
365374
366375 boolean sorted = options .assumeSorted ;
367376 if (!sorted && sortOrder .isSorted ()) {
@@ -724,6 +733,7 @@ public record Options(
724733 boolean s3NoSignRequest ,
725734 boolean s3CopyObject ,
726735 boolean assumeSorted ,
736+ boolean ignoreNotFound ,
727737 @ Nullable String retryListFile ,
728738 @ Nullable List <Main .IcePartition > partitionList ,
729739 @ Nullable List <Main .IceSortOrder > sortOrderList ,
@@ -743,6 +753,7 @@ public static final class Builder {
743753 private boolean s3NoSignRequest ;
744754 private boolean s3CopyObject ;
745755 private boolean assumeSorted ;
756+ private boolean ignoreNotFound ;
746757 String retryListFile ;
747758 List <Main .IcePartition > partitionList = List .of ();
748759 List <Main .IceSortOrder > sortOrderList = List .of ();
@@ -795,6 +806,11 @@ public Builder assumeSorted(boolean assumeSorted) {
795806 return this ;
796807 }
797808
809+ public Builder ignoreNotFound (boolean ignoreNotFound ) {
810+ this .ignoreNotFound = ignoreNotFound ;
811+ return this ;
812+ }
813+
798814 public Builder retryListFile (String retryListFile ) {
799815 this .retryListFile = retryListFile ;
800816 return this ;
@@ -826,6 +842,7 @@ public Options build() {
826842 s3NoSignRequest ,
827843 s3CopyObject ,
828844 assumeSorted ,
845+ ignoreNotFound ,
829846 retryListFile ,
830847 partitionList ,
831848 sortOrderList ,
0 commit comments