From fd4de66282f5f503166e4b383bcb366d0c5e82d6 Mon Sep 17 00:00:00 2001 From: Fokko Driesprong Date: Fri, 6 Oct 2023 10:50:44 +0200 Subject: [PATCH] Use `copyOf` instead --- .../main/java/org/apache/iceberg/BaseSnapshot.java | 5 ++++- .../org/apache/iceberg/TestMetadataUpdateParser.java | 11 ++++++++--- .../java/org/apache/iceberg/TestSnapshotJson.java | 11 ++++++++--- .../java/org/apache/iceberg/TestTableMetadata.java | 5 ++++- 4 files changed, 24 insertions(+), 8 deletions(-) diff --git a/core/src/main/java/org/apache/iceberg/BaseSnapshot.java b/core/src/main/java/org/apache/iceberg/BaseSnapshot.java index 2c5556a598e9..f298c6052333 100644 --- a/core/src/main/java/org/apache/iceberg/BaseSnapshot.java +++ b/core/src/main/java/org/apache/iceberg/BaseSnapshot.java @@ -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) { diff --git a/core/src/test/java/org/apache/iceberg/TestMetadataUpdateParser.java b/core/src/test/java/org/apache/iceberg/TestMetadataUpdateParser.java index 34682f049bd3..1decdd95be4c 100644 --- a/core/src/test/java/org/apache/iceberg/TestMetadataUpdateParser.java +++ b/core/src/test/java/org/apache/iceberg/TestMetadataUpdateParser.java @@ -1236,9 +1236,14 @@ private String createManifestListWithManifestFiles(long snapshotId, Long parentS List 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)) { diff --git a/core/src/test/java/org/apache/iceberg/TestSnapshotJson.java b/core/src/test/java/org/apache/iceberg/TestSnapshotJson.java index b2d03c493204..1c39a4665409 100644 --- a/core/src/test/java/org/apache/iceberg/TestSnapshotJson.java +++ b/core/src/test/java/org/apache/iceberg/TestSnapshotJson.java @@ -176,9 +176,14 @@ private String createManifestListWithManifestFiles(long snapshotId, Long parentS List 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)) { diff --git a/core/src/test/java/org/apache/iceberg/TestTableMetadata.java b/core/src/test/java/org/apache/iceberg/TestTableMetadata.java index 87d5374fac9c..20fb3cf263ca 100644 --- a/core/src/test/java/org/apache/iceberg/TestTableMetadata.java +++ b/core/src/test/java/org/apache/iceberg/TestTableMetadata.java @@ -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();