You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@paimon.apache.org by "JingsongLi (via GitHub)" <gi...@apache.org> on 2026/07/28 08:13:07 UTC

[PR] [core] Refactor row ID reassignment manifest processing [paimon]

JingsongLi opened a new pull request, #8887:
URL: https://github.com/apache/paimon/pull/8887

   ## What changed
   
   - Extract row-ID reassignment planning from `DataEvolutionRowIdReassigner` into a focused planner.
   - Add reusable projected `BinaryManifestEntry` and `BinaryDataFileMeta` views.
   - Bind projected fields by schema field ID instead of relying on a planner-specific fixed layout.
   - Keep the manifest scan hot path on binary strings and serialized rows without materializing POJOs.
   - Add dedicated unit tests for both binary views, including arbitrary projections, unsupported fields, null handling, reuse, and lifecycle checks.
   
   ## Why
   
   The row-ID reassignment implementation introduced in #8882 combines orchestration, planning state, binary manifest decoding, and compact data structures in one large class. This makes the algorithm difficult to review and gives its inline binary decoding logic a schema that is specific to one caller.
   
   The extracted binary views make projection handling reusable and keep the planner focused on row-ID assignment.
   
   ## Impact
   
   This is an internal refactor. Row-ID assignment behavior and manifest serialization remain unchanged. Accessors for projected fields implement the existing `ManifestEntry` and `DataFileMeta` contracts; access to fields that were not projected fails explicitly.
   
   ## Validation
   
   ```text
   mvn -pl paimon-core -DfailIfNoTests=false -DwildcardSuites=none \
     -Dtest=BinaryDataFileMetaTest,BinaryManifestEntryTest,DataEvolutionRowIdReassignerTest test
   ```
   
   51 tests passed. Checkstyle, Spotless, and Enforcer passed.
   


-- 
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-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [core] Refactor row ID reassignment manifest processing [paimon]

Posted by "leaves12138 (via GitHub)" <gi...@apache.org>.
leaves12138 commented on code in PR #8887:
URL: https://github.com/apache/paimon/pull/8887#discussion_r3664061741


##########
paimon-core/src/test/java/org/apache/paimon/io/BinaryDataFileMetaTest.java:
##########
@@ -0,0 +1,170 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.paimon.io;
+
+import org.apache.paimon.data.BinaryString;
+import org.apache.paimon.data.GenericRow;
+import org.apache.paimon.manifest.FileSource;
+import org.apache.paimon.stats.SimpleStats;
+import org.apache.paimon.types.DataField;
+import org.apache.paimon.types.RowType;
+import org.apache.paimon.utils.Range;
+import org.apache.paimon.utils.RoaringBitmap32;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Arrays;
+import java.util.Collections;
+
+import static org.assertj.core.api.Assertions.assertThat;
+import static org.assertj.core.api.Assertions.assertThatThrownBy;
+
+/** Tests for {@link BinaryDataFileMeta}. */
+public class BinaryDataFileMetaTest {
+
+    @Test
+    void testImplementsProjectedDataFileMeta() {
+        DataFileMeta expected =
+                DataFileMeta.forAppend(
+                        "data.parquet",
+                        123L,
+                        5L,
+                        SimpleStats.EMPTY_STATS,
+                        2L,
+                        3L,
+                        4L,
+                        Arrays.asList("extra-1", "extra-2"),
+                        new byte[] {1, 2},
+                        FileSource.COMPACT,
+                        Collections.singletonList("value_col"),
+                        "external/dir/data.parquet",
+                        10L,
+                        Collections.singletonList("write_col"));
+        BinaryDataFileMeta actual =
+                BinaryDataFileMeta.Projection.create(DataFileMeta.SCHEMA)
+                        .createDataFile()
+                        .replace(new DataFileMetaSerializer().toRow(expected));
+
+        assertThat(actual.fileName()).isEqualTo(expected.fileName());
+        assertThat(actual.fileNameBinary()).isEqualTo(BinaryString.fromString(expected.fileName()));
+        assertThat(actual.fileSize()).isEqualTo(expected.fileSize());
+        assertThat(actual.rowCount()).isEqualTo(expected.rowCount());
+        assertThat(actual.deleteRowCount()).isEqualTo(expected.deleteRowCount());
+        assertThat(actual.minKey()).isEqualTo(expected.minKey());
+        assertThat(actual.maxKey()).isEqualTo(expected.maxKey());
+        assertThat(actual.keyStats()).isEqualTo(expected.keyStats());
+        assertThat(actual.valueStats()).isEqualTo(expected.valueStats());
+        assertThat(actual.minSequenceNumber()).isEqualTo(expected.minSequenceNumber());
+        assertThat(actual.maxSequenceNumber()).isEqualTo(expected.maxSequenceNumber());
+        assertThat(actual.schemaId()).isEqualTo(expected.schemaId());
+        assertThat(actual.level()).isEqualTo(expected.level());
+        assertThat(actual.extraFiles()).isEqualTo(expected.extraFiles());
+        assertThat(actual.extraFileCount()).isEqualTo(2);
+        assertThat(actual.extraFile(1).toString()).isEqualTo("extra-2");
+        assertThat(actual.creationTime()).isEqualTo(expected.creationTime());
+        assertThat(actual.creationTimeEpochMillis()).isEqualTo(expected.creationTimeEpochMillis());
+        assertThat(actual.fileFormat()).isEqualTo("parquet");
+        assertThat(actual.hasEmbeddedIndex()).isTrue();
+        assertThat(actual.embeddedIndex()).containsExactly(1, 2);
+        assertThat(actual.fileSource()).contains(FileSource.COMPACT);
+        assertThat(actual.valueStatsCols()).containsExactly("value_col");
+        assertThat(actual.hasExternalPath()).isTrue();
+        assertThat(actual.externalPath()).isEqualTo(expected.externalPath());
+        assertThat(actual.externalPathDir()).isEqualTo(expected.externalPathDir());
+        assertThat(actual.hasFirstRowId()).isTrue();
+        assertThat(actual.firstRowId()).isEqualTo(10L);
+        assertThat(actual.firstRowIdValue()).isEqualTo(10L);

Review Comment:
   `firstRowIdValue()` was removed from `BinaryDataFileMeta` in the latest commit, but this assertion still calls it, so `paimon-core` fails during test compilation. Please switch this to `actual.nonNullFirstRowId()` (or restore the helper).



-- 
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-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


Re: [PR] [core] Refactor row ID reassignment manifest processing [paimon]

Posted by "JingsongLi (via GitHub)" <gi...@apache.org>.
JingsongLi merged PR #8887:
URL: https://github.com/apache/paimon/pull/8887


-- 
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-unsubscribe@paimon.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org