Skip to content

Commit

Permalink
Use copyOf instead
Browse files Browse the repository at this point in the history
  • Loading branch information
Fokko committed Oct 6, 2023
1 parent 73947f2 commit fd4de66
Show file tree
Hide file tree
Showing 4 changed files with 24 additions and 8 deletions.
5 changes: 4 additions & 1 deletion core/src/main/java/org/apache/iceberg/BaseSnapshot.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,10 @@ private void cacheManifests(FileIO fileIO) {
Lists.transform(
Arrays.asList(v1ManifestLocations),
location ->
GenericManifestFile.copyOf(new GenericManifestFile(fileIO.newInputFile(location), 0)).withSnapshotId(this.snapshotId).build());
GenericManifestFile.copyOf(
new GenericManifestFile(fileIO.newInputFile(location), 0))
.withSnapshotId(this.snapshotId)
.build());
}

if (allManifests == null) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1236,9 +1236,14 @@ private String createManifestListWithManifestFiles(long snapshotId, Long parentS

List<ManifestFile> manifests =
ImmutableList.of(
GenericManifestFile.copyOf(new GenericManifestFile(localInput("file:/tmp/manifest1.avro"), 0)).withSnapshotId(snapshotId).build(),
GenericManifestFile.copyOf(new GenericManifestFile(localInput("file:/tmp/manifest2.avro"), 0)).withSnapshotId(snapshotId).build()
);
GenericManifestFile.copyOf(
new GenericManifestFile(localInput("file:/tmp/manifest1.avro"), 0))
.withSnapshotId(snapshotId)
.build(),
GenericManifestFile.copyOf(
new GenericManifestFile(localInput("file:/tmp/manifest2.avro"), 0))
.withSnapshotId(snapshotId)
.build());

try (ManifestListWriter writer =
ManifestLists.write(1, Files.localOutput(manifestList), snapshotId, parentSnapshotId, 0)) {
Expand Down
11 changes: 8 additions & 3 deletions core/src/test/java/org/apache/iceberg/TestSnapshotJson.java
Original file line number Diff line number Diff line change
Expand Up @@ -176,9 +176,14 @@ private String createManifestListWithManifestFiles(long snapshotId, Long parentS

List<ManifestFile> manifests =
ImmutableList.of(
GenericManifestFile.copyOf(new GenericManifestFile(localInput("file:/tmp/manifest1.avro"), 0)).withSnapshotId(snapshotId).build(),
GenericManifestFile.copyOf(new GenericManifestFile(localInput("file:/tmp/manifest2.avro"), 0)).withSnapshotId(snapshotId).build(),
);
GenericManifestFile.copyOf(
new GenericManifestFile(localInput("file:/tmp/manifest1.avro"), 0))
.withSnapshotId(snapshotId)
.build(),
GenericManifestFile.copyOf(
new GenericManifestFile(localInput("file:/tmp/manifest2.avro"), 0))
.withSnapshotId(snapshotId)
.build());

try (ManifestListWriter writer =
ManifestLists.write(1, Files.localOutput(manifestList), snapshotId, parentSnapshotId, 0)) {
Expand Down
5 changes: 4 additions & 1 deletion core/src/test/java/org/apache/iceberg/TestTableMetadata.java
Original file line number Diff line number Diff line change
Expand Up @@ -1585,7 +1585,10 @@ private String createManifestListWithManifestFile(
ManifestLists.write(1, Files.localOutput(manifestList), snapshotId, parentSnapshotId, 0)) {
writer.addAll(
ImmutableList.of(
GenericManifestFile.copyOf(new GenericManifestFile(localInput(manifestFile), SPEC_5.specId())).withSnapshotId(snapshotId).build()));
GenericManifestFile.copyOf(
new GenericManifestFile(localInput(manifestFile), SPEC_5.specId()))
.withSnapshotId(snapshotId)
.build()));
}

return localInput(manifestList).location();
Expand Down

0 comments on commit fd4de66

Please sign in to comment.