5757import org .apache .iceberg .deletes .PositionDeleteWriter ;
5858import org .apache .iceberg .encryption .EncryptedFiles ;
5959import org .apache .iceberg .exceptions .RuntimeIOException ;
60- import org .apache .iceberg .formats .FileWriterBuilder ;
6160import org .apache .iceberg .formats .FormatModelRegistry ;
62- import org .apache .iceberg .formats .ReadBuilder ;
6361import org .apache .iceberg .io .CloseableIterable ;
6462import org .apache .iceberg .io .DeleteSchemaUtil ;
6563import org .apache .iceberg .io .FileIO ;
@@ -727,10 +725,10 @@ private ForeachFunction<DeleteFile> rewritePositionDelete(
727725
728726 private static CloseableIterable <Record > positionDeletesReader (
729727 InputFile inputFile , FileFormat format , PartitionSpec spec ) {
730- Schema deleteSchema = DeleteSchemaUtil . posDeleteReadSchema ( spec . schema ());
731- ReadBuilder < Record , ?> builder =
732- FormatModelRegistry . readBuilder ( format , Record . class , inputFile );
733- return builder . project ( deleteSchema ). reuseContainers () .build ();
728+ return FormatModelRegistry . readBuilder ( format , Record . class , inputFile )
729+ . project ( DeleteSchemaUtil . posDeleteReadSchema ( spec . schema ()))
730+ . reuseContainers ()
731+ .build ();
734732 }
735733
736734 private static PositionDeleteWriter <Record > positionDeletesWriter (
@@ -741,10 +739,11 @@ private static PositionDeleteWriter<Record> positionDeletesWriter(
741739 Schema rowSchema )
742740 throws IOException {
743741 if (rowSchema == null ) {
744- FileWriterBuilder <PositionDeleteWriter <Record >, ?> builder =
745- FormatModelRegistry .positionDeleteWriteBuilder (
746- format , EncryptedFiles .plainAsEncryptedOutput (outputFile ));
747- return builder .partition (partition ).spec (spec ).build ();
742+ return FormatModelRegistry .<Record >positionDeleteWriteBuilder (
743+ format , EncryptedFiles .plainAsEncryptedOutput (outputFile ))
744+ .partition (partition )
745+ .spec (spec )
746+ .build ();
748747 } else {
749748 return switch (format ) {
750749 case AVRO ->
0 commit comments