This is an automated email from the ASF dual-hosted git repository. XiaoHongbo-Hope pushed a commit to branch release-2.1 in repository https://gitbox.apache.org/repos/asf/paimon.git
commit 0cb4b9825928c8e2dc667cb7482d2cb76267a553 Author: JingsongLi <[email protected]> AuthorDate: Sun Sep 13 23:04:46 2026 +0800 [core] Simplify ManifestFileMeta constructors and field order --- .../apache/paimon/manifest/ManifestAvroWriter.java | 4 +- .../apache/paimon/manifest/ManifestFileMeta.java | 94 ++++------------------ .../manifest/ManifestFileMetaSerializer.java | 8 +- .../DataEvolutionCompactCoordinatorTest.java | 8 +- .../DataEvolutionCompactRangePlannerTest.java | 2 + .../DataEvolutionRowIdReassignerTest.java | 4 +- .../LegacyManifestFileMetaSerializerPaimon10.java | 2 + .../manifest/ManifestFileMetaSerializerTest.java | 4 +- .../paimon/manifest/ManifestFileMetaTest.java | 12 ++- .../apache/paimon/manifest/ManifestFileTest.java | 4 +- .../apache/paimon/manifest/ManifestListTest.java | 6 +- .../paimon/manifest/ManifestTestDataGenerator.java | 4 +- .../paimon/operation/BucketSelectorTest.java | 4 +- .../paimon/operation/ExpireSnapshotsTest.java | 3 + .../operation/LocalOrphanFilesCleanTest.java | 1 + .../paimon/operation/ManifestFileMergerTest.java | 4 +- 16 files changed, 66 insertions(+), 98 deletions(-) diff --git a/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestAvroWriter.java b/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestAvroWriter.java index c0eb377b79..4dabe54f3f 100644 --- a/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestAvroWriter.java +++ b/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestAvroWriter.java @@ -739,8 +739,8 @@ public final class ManifestAvroWriter implements AutoCloseable { levelStatsKnown ? maxLevel : null, rowIdStats == null ? null : rowIdStats.minRowId, rowIdStats == null ? null : rowIdStats.maxRowId, - null, - totalBucketsKnown ? totalBuckets : null); + totalBucketsKnown ? totalBuckets : null, + null); } } diff --git a/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestFileMeta.java b/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestFileMeta.java index b0c7f7b13f..6a4c81abb5 100644 --- a/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestFileMeta.java +++ b/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestFileMeta.java @@ -59,11 +59,12 @@ public class ManifestFileMeta { new DataField(9, "_MAX_LEVEL", new IntType(true)), new DataField(10, "_MIN_ROW_ID", new BigIntType(true)), new DataField(11, "_MAX_ROW_ID", new BigIntType(true)), + new DataField(12, "_TOTAL_BUCKETS", new IntType(true)), new DataField( - 12, + 13, "_EXTRA_FILES", - new ArrayType(true, new VarCharType(false, Integer.MAX_VALUE))), - new DataField(13, "_TOTAL_BUCKETS", new IntType(true)))); + new ArrayType( + true, new VarCharType(false, Integer.MAX_VALUE))))); private final String fileName; private final long fileSize; @@ -77,38 +78,8 @@ public class ManifestFileMeta { private final @Nullable Integer maxLevel; private final @Nullable Long minRowId; private final @Nullable Long maxRowId; - private final @Nullable List<String> extraFiles; private final @Nullable Integer totalBuckets; - - public ManifestFileMeta( - String fileName, - long fileSize, - long numAddedFiles, - long numDeletedFiles, - SimpleStats partitionStats, - long schemaId, - @Nullable Integer minBucket, - @Nullable Integer maxBucket, - @Nullable Integer minLevel, - @Nullable Integer maxLevel, - @Nullable Long minRowId, - @Nullable Long maxRowId) { - this( - fileName, - fileSize, - numAddedFiles, - numDeletedFiles, - partitionStats, - schemaId, - minBucket, - maxBucket, - minLevel, - maxLevel, - minRowId, - maxRowId, - null, - null); - } + private final @Nullable List<String> extraFiles; public ManifestFileMeta( String fileName, @@ -123,39 +94,8 @@ public class ManifestFileMeta { @Nullable Integer maxLevel, @Nullable Long minRowId, @Nullable Long maxRowId, + @Nullable Integer totalBuckets, @Nullable List<String> extraFiles) { - this( - fileName, - fileSize, - numAddedFiles, - numDeletedFiles, - partitionStats, - schemaId, - minBucket, - maxBucket, - minLevel, - maxLevel, - minRowId, - maxRowId, - extraFiles, - null); - } - - public ManifestFileMeta( - String fileName, - long fileSize, - long numAddedFiles, - long numDeletedFiles, - SimpleStats partitionStats, - long schemaId, - @Nullable Integer minBucket, - @Nullable Integer maxBucket, - @Nullable Integer minLevel, - @Nullable Integer maxLevel, - @Nullable Long minRowId, - @Nullable Long maxRowId, - @Nullable List<String> extraFiles, - @Nullable Integer totalBuckets) { this.fileName = fileName; this.fileSize = fileSize; this.numAddedFiles = numAddedFiles; @@ -168,8 +108,8 @@ public class ManifestFileMeta { this.maxLevel = maxLevel; this.minRowId = minRowId; this.maxRowId = maxRowId; - this.extraFiles = extraFiles; this.totalBuckets = totalBuckets; + this.extraFiles = extraFiles; } public String fileName() { @@ -220,14 +160,14 @@ public class ManifestFileMeta { return maxRowId; } - public @Nullable List<String> extraFiles() { - return extraFiles; - } - public @Nullable Integer totalBuckets() { return totalBuckets; } + public @Nullable List<String> extraFiles() { + return extraFiles; + } + @Override public boolean equals(Object o) { if (!(o instanceof ManifestFileMeta)) { @@ -246,8 +186,8 @@ public class ManifestFileMeta { && Objects.equals(maxLevel, that.maxLevel) && Objects.equals(minRowId, that.minRowId) && Objects.equals(maxRowId, that.maxRowId) - && Objects.equals(extraFiles, that.extraFiles) - && Objects.equals(totalBuckets, that.totalBuckets); + && Objects.equals(totalBuckets, that.totalBuckets) + && Objects.equals(extraFiles, that.extraFiles); } @Override @@ -265,8 +205,8 @@ public class ManifestFileMeta { maxLevel, minRowId, maxRowId, - extraFiles, - totalBuckets); + totalBuckets, + extraFiles); } @Override @@ -285,8 +225,8 @@ public class ManifestFileMeta { maxLevel, minRowId, maxRowId, - extraFiles, - totalBuckets); + totalBuckets, + extraFiles); } // ----------------------- Serialization ----------------------------- diff --git a/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestFileMetaSerializer.java b/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestFileMetaSerializer.java index 7e44d42f99..30f74a305a 100644 --- a/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestFileMetaSerializer.java +++ b/paimon-core/src/main/java/org/apache/paimon/manifest/ManifestFileMetaSerializer.java @@ -60,8 +60,8 @@ public class ManifestFileMetaSerializer extends ObjectSerializer<ManifestFileMet meta.maxLevel(), meta.minRowId(), meta.maxRowId(), - toStringArrayData(meta.extraFiles()), - meta.totalBuckets()); + meta.totalBuckets(), + toStringArrayData(meta.extraFiles())); } @Override @@ -96,7 +96,7 @@ public class ManifestFileMetaSerializer extends ObjectSerializer<ManifestFileMet row.isNullAt(9) ? null : row.getInt(9), row.isNullAt(10) ? null : row.getLong(10), row.isNullAt(11) ? null : row.getLong(11), - row.isNullAt(12) ? null : fromStringArrayData(row.getArray(12)), - row.getFieldCount() <= 13 || row.isNullAt(13) ? null : row.getInt(13)); + row.isNullAt(12) ? null : row.getInt(12), + row.isNullAt(13) ? null : fromStringArrayData(row.getArray(13))); } } diff --git a/paimon-core/src/test/java/org/apache/paimon/append/dataevolution/DataEvolutionCompactCoordinatorTest.java b/paimon-core/src/test/java/org/apache/paimon/append/dataevolution/DataEvolutionCompactCoordinatorTest.java index 0ce6a252a5..f222705a1e 100644 --- a/paimon-core/src/test/java/org/apache/paimon/append/dataevolution/DataEvolutionCompactCoordinatorTest.java +++ b/paimon-core/src/test/java/org/apache/paimon/append/dataevolution/DataEvolutionCompactCoordinatorTest.java @@ -717,6 +717,8 @@ public class DataEvolutionCompactCoordinatorTest { null, null, null, + null, + null, null); ManifestFileMeta metaWithRowId = new ManifestFileMeta( @@ -731,7 +733,9 @@ public class DataEvolutionCompactCoordinatorTest { null, null, 0L, - 199L); + 199L, + null, + null); List<ManifestFileMeta> metas = Arrays.asList(metaWithNullRowId, metaWithRowId); when(manifestsReader.read(snapshot, ScanMode.ALL)) .thenReturn(new ManifestsReader.Result(snapshot, metas, metas)); @@ -818,6 +822,8 @@ public class DataEvolutionCompactCoordinatorTest { null, null, null, + null, + null, null); when(manifestsReader.read(snapshot, ScanMode.ALL)) .thenReturn( diff --git a/paimon-core/src/test/java/org/apache/paimon/append/dataevolution/DataEvolutionCompactRangePlannerTest.java b/paimon-core/src/test/java/org/apache/paimon/append/dataevolution/DataEvolutionCompactRangePlannerTest.java index 93059aeea1..0ba815a3d1 100644 --- a/paimon-core/src/test/java/org/apache/paimon/append/dataevolution/DataEvolutionCompactRangePlannerTest.java +++ b/paimon-core/src/test/java/org/apache/paimon/append/dataevolution/DataEvolutionCompactRangePlannerTest.java @@ -447,6 +447,8 @@ class DataEvolutionCompactRangePlannerTest extends TableTestBase { meta.minLevel(), meta.maxLevel(), null, + null, + null, null); } diff --git a/paimon-core/src/test/java/org/apache/paimon/append/dataevolution/DataEvolutionRowIdReassignerTest.java b/paimon-core/src/test/java/org/apache/paimon/append/dataevolution/DataEvolutionRowIdReassignerTest.java index 54e89507c9..3cde9a1b7c 100644 --- a/paimon-core/src/test/java/org/apache/paimon/append/dataevolution/DataEvolutionRowIdReassignerTest.java +++ b/paimon-core/src/test/java/org/apache/paimon/append/dataevolution/DataEvolutionRowIdReassignerTest.java @@ -2351,7 +2351,9 @@ public class DataEvolutionRowIdReassignerTest extends TableTestBase { manifestMeta.minLevel(), manifestMeta.maxLevel(), manifestMeta.minRowId(), - manifestMeta.maxRowId()); + manifestMeta.maxRowId(), + null, + null); } private void assertReassignedOutOfOrderPartitionEntries( diff --git a/paimon-core/src/test/java/org/apache/paimon/manifest/LegacyManifestFileMetaSerializerPaimon10.java b/paimon-core/src/test/java/org/apache/paimon/manifest/LegacyManifestFileMetaSerializerPaimon10.java index a1a38b2638..f13ce99aeb 100644 --- a/paimon-core/src/test/java/org/apache/paimon/manifest/LegacyManifestFileMetaSerializerPaimon10.java +++ b/paimon-core/src/test/java/org/apache/paimon/manifest/LegacyManifestFileMetaSerializerPaimon10.java @@ -92,6 +92,8 @@ public class LegacyManifestFileMetaSerializerPaimon10 extends ObjectSerializer<M null, null, null, + null, + null, null); } } diff --git a/paimon-core/src/test/java/org/apache/paimon/manifest/ManifestFileMetaSerializerTest.java b/paimon-core/src/test/java/org/apache/paimon/manifest/ManifestFileMetaSerializerTest.java index 7600c7d01f..46ff2067d2 100644 --- a/paimon-core/src/test/java/org/apache/paimon/manifest/ManifestFileMetaSerializerTest.java +++ b/paimon-core/src/test/java/org/apache/paimon/manifest/ManifestFileMetaSerializerTest.java @@ -68,8 +68,8 @@ public class ManifestFileMetaSerializerTest extends ObjectSerializerTestBase<Man original.maxLevel(), original.minRowId(), original.maxRowId(), - extraFiles, - original.totalBuckets()); + original.totalBuckets(), + extraFiles); ManifestFileMeta fromRow = serializer.fromRow(serializer.toRow(meta)); ManifestFileMeta fromBytes = serializer.deserializeFromBytes(meta.toBytes()); diff --git a/paimon-core/src/test/java/org/apache/paimon/manifest/ManifestFileMetaTest.java b/paimon-core/src/test/java/org/apache/paimon/manifest/ManifestFileMetaTest.java index 593b625cec..c27d8c012f 100644 --- a/paimon-core/src/test/java/org/apache/paimon/manifest/ManifestFileMetaTest.java +++ b/paimon-core/src/test/java/org/apache/paimon/manifest/ManifestFileMetaTest.java @@ -2534,7 +2534,9 @@ public class ManifestFileMetaTest extends ManifestFileMetaTestBase { manifestA.minLevel(), manifestA.maxLevel(), manifestA.minRowId(), - manifestA.maxRowId())); + manifestA.maxRowId(), + null, + null)); // Manifest B: partitions [5, 15] - overlaps with A List<ManifestEntry> entriesB = new ArrayList<>(); @@ -2555,7 +2557,9 @@ public class ManifestFileMetaTest extends ManifestFileMetaTestBase { manifestB.minLevel(), manifestB.maxLevel(), manifestB.minRowId(), - manifestB.maxRowId())); + manifestB.maxRowId(), + null, + null)); // Manifest C: partitions [10, 20] - overlaps with B List<ManifestEntry> entriesC = new ArrayList<>(); @@ -2576,7 +2580,9 @@ public class ManifestFileMetaTest extends ManifestFileMetaTestBase { manifestC.minLevel(), manifestC.maxLevel(), manifestC.minRowId(), - manifestC.maxRowId())); + manifestC.maxRowId(), + null, + null)); // Set small budget to force split Options testOptions = new Options(); diff --git a/paimon-core/src/test/java/org/apache/paimon/manifest/ManifestFileTest.java b/paimon-core/src/test/java/org/apache/paimon/manifest/ManifestFileTest.java index c472eb1d34..c85d82bf9c 100644 --- a/paimon-core/src/test/java/org/apache/paimon/manifest/ManifestFileTest.java +++ b/paimon-core/src/test/java/org/apache/paimon/manifest/ManifestFileTest.java @@ -281,7 +281,9 @@ public class ManifestFileTest { null, null, source.minRowId(), - source.maxRowId()); + source.maxRowId(), + null, + null); ManifestAvroWriter writer = manifestFile.createAvroWriter(); try (ManifestAvroReader reader = openManifestReader(source)) { diff --git a/paimon-core/src/test/java/org/apache/paimon/manifest/ManifestListTest.java b/paimon-core/src/test/java/org/apache/paimon/manifest/ManifestListTest.java index 37b840b9fe..bc4bca410a 100644 --- a/paimon-core/src/test/java/org/apache/paimon/manifest/ManifestListTest.java +++ b/paimon-core/src/test/java/org/apache/paimon/manifest/ManifestListTest.java @@ -158,6 +158,8 @@ public class ManifestListTest { null, null, null, + null, + null, null)); } return result; @@ -194,8 +196,8 @@ public class ManifestListTest { meta.maxLevel(), meta.minRowId(), meta.maxRowId(), - extraFiles, - meta.totalBuckets())); + meta.totalBuckets(), + extraFiles)); } return metas; } diff --git a/paimon-core/src/test/java/org/apache/paimon/manifest/ManifestTestDataGenerator.java b/paimon-core/src/test/java/org/apache/paimon/manifest/ManifestTestDataGenerator.java index a9cbb498e9..c44ac3e4a9 100644 --- a/paimon-core/src/test/java/org/apache/paimon/manifest/ManifestTestDataGenerator.java +++ b/paimon-core/src/test/java/org/apache/paimon/manifest/ManifestTestDataGenerator.java @@ -143,8 +143,8 @@ public class ManifestTestDataGenerator { maxLevel, null, null, - null, - totalBucketsKnown ? totalBuckets : null); + totalBucketsKnown ? totalBuckets : null, + null); } private void mergeLevelsIfNeeded(BinaryRow partition, int bucket) { diff --git a/paimon-core/src/test/java/org/apache/paimon/operation/BucketSelectorTest.java b/paimon-core/src/test/java/org/apache/paimon/operation/BucketSelectorTest.java index bcee6762ed..cd5208753f 100644 --- a/paimon-core/src/test/java/org/apache/paimon/operation/BucketSelectorTest.java +++ b/paimon-core/src/test/java/org/apache/paimon/operation/BucketSelectorTest.java @@ -104,8 +104,8 @@ public class BucketSelectorTest { 0, null, null, - null, - totalBuckets); + totalBuckets, + null); } @Test diff --git a/paimon-core/src/test/java/org/apache/paimon/operation/ExpireSnapshotsTest.java b/paimon-core/src/test/java/org/apache/paimon/operation/ExpireSnapshotsTest.java index 8dfcb1c21a..24a6e0eaea 100644 --- a/paimon-core/src/test/java/org/apache/paimon/operation/ExpireSnapshotsTest.java +++ b/paimon-core/src/test/java/org/apache/paimon/operation/ExpireSnapshotsTest.java @@ -534,6 +534,7 @@ public class ExpireSnapshotsTest { null, null, null, + null, extraFiles); } @@ -947,6 +948,8 @@ public class ExpireSnapshotsTest { null, null, null, + null, + null, null); String manifestList = store.manifestListFactory() diff --git a/paimon-core/src/test/java/org/apache/paimon/operation/LocalOrphanFilesCleanTest.java b/paimon-core/src/test/java/org/apache/paimon/operation/LocalOrphanFilesCleanTest.java index 36499bb4a6..9e3bf05b69 100644 --- a/paimon-core/src/test/java/org/apache/paimon/operation/LocalOrphanFilesCleanTest.java +++ b/paimon-core/src/test/java/org/apache/paimon/operation/LocalOrphanFilesCleanTest.java @@ -570,6 +570,7 @@ public class LocalOrphanFilesCleanTest { meta.maxLevel(), meta.minRowId(), meta.maxRowId(), + null, Collections.singletonList(extraFile))); Pair<String, Long> newManifestList = manifestList.write(manifests); ObjectNode node = diff --git a/paimon-core/src/test/java/org/apache/paimon/operation/ManifestFileMergerTest.java b/paimon-core/src/test/java/org/apache/paimon/operation/ManifestFileMergerTest.java index ff6e738f4d..cfd1cb8fc1 100644 --- a/paimon-core/src/test/java/org/apache/paimon/operation/ManifestFileMergerTest.java +++ b/paimon-core/src/test/java/org/apache/paimon/operation/ManifestFileMergerTest.java @@ -239,6 +239,8 @@ public class ManifestFileMergerTest extends ManifestFileMetaTestBase { current.minLevel(), current.maxLevel(), current.minRowId(), - current.maxRowId()); + current.maxRowId(), + null, + null); } }
