rdblue commented on code in PR #6799: URL: https://github.com/apache/iceberg/pull/6799#discussion_r1111314641
########## core/src/main/java/org/apache/iceberg/ManifestLists.java: ########## @@ -21,51 +21,79 @@ import java.io.IOException; import java.util.List; import org.apache.iceberg.avro.Avro; +import org.apache.iceberg.avro.AvroIterable; import org.apache.iceberg.exceptions.RuntimeIOException; import org.apache.iceberg.io.CloseableIterable; import org.apache.iceberg.io.InputFile; import org.apache.iceberg.io.OutputFile; +import org.apache.iceberg.relocated.com.google.common.annotations.VisibleForTesting; import org.apache.iceberg.relocated.com.google.common.base.Preconditions; import org.apache.iceberg.relocated.com.google.common.collect.Lists; class ManifestLists { private ManifestLists() {} static List<ManifestFile> read(InputFile manifestList) { - try (CloseableIterable<ManifestFile> files = - Avro.read(manifestList) - .rename("manifest_file", GenericManifestFile.class.getName()) - .rename("partitions", GenericPartitionFieldSummary.class.getName()) - .rename("r508", GenericPartitionFieldSummary.class.getName()) - .classLoader(GenericManifestFile.class.getClassLoader()) - .project(ManifestFile.schema()) - .reuseContainers(false) - .build()) { - + try (CloseableIterable<ManifestFile> files = manifestFileIterable(manifestList)) { return Lists.newLinkedList(files); - } catch (IOException e) { throw new RuntimeIOException( e, "Cannot read manifest list file: %s", manifestList.location()); } } + @VisibleForTesting + static AvroIterable<ManifestFile> manifestFileIterable(InputFile manifestList) { + return Avro.read(manifestList) + .rename("manifest_file", GenericManifestFile.class.getName()) + .rename("partitions", GenericPartitionFieldSummary.class.getName()) + .rename("r508", GenericPartitionFieldSummary.class.getName()) + .classLoader(GenericManifestFile.class.getClassLoader()) + .project(ManifestFile.schema()) + .reuseContainers(false) + .build(); + } + static ManifestListWriter write( int formatVersion, OutputFile manifestListFile, long snapshotId, Long parentSnapshotId, long sequenceNumber) { + return write( + formatVersion, + manifestListFile, + snapshotId, + parentSnapshotId, + sequenceNumber, + /* compressionCodec */ null, + /* compressionLevel */ null); Review Comment: Style: Comments like this usually follow the argument. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: issues-unsubscr...@iceberg.apache.org For additional commands, e-mail: issues-h...@iceberg.apache.org