This is an automated email from the ASF dual-hosted git repository.

JingsongLi pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/paimon.git


The following commit(s) were added to refs/heads/master by this push:
     new 1f01a70625 [core] Align vector row IDs after normal-only files (#11151)
1f01a70625 is described below

commit 1f01a70625f52a4a9b576b2247ba673a6b648374
Author: YueZhang <[email protected]>
AuthorDate: Tue Nov 17 09:28:55 2026 +0800

    [core] Align vector row IDs after normal-only files (#11151)
---
 .../operation/commit/RowTrackingCommitUtils.java   |  2 ++
 .../apache/paimon/append/VectorStoreTableTest.java | 32 ++++++++++++++++++++++
 2 files changed, 34 insertions(+)

diff --git 
a/paimon-core/src/main/java/org/apache/paimon/operation/commit/RowTrackingCommitUtils.java
 
b/paimon-core/src/main/java/org/apache/paimon/operation/commit/RowTrackingCommitUtils.java
index 8b8fcd3476..dc67cbfa80 100644
--- 
a/paimon-core/src/main/java/org/apache/paimon/operation/commit/RowTrackingCommitUtils.java
+++ 
b/paimon-core/src/main/java/org/apache/paimon/operation/commit/RowTrackingCommitUtils.java
@@ -138,6 +138,8 @@ public class RowTrackingCommitUtils {
                     rowIdAssigned.add(entry.assignFirstRowId(start));
                     blobStartDefault = start;
                     blobStarts.clear();
+                    // Skip the rows of normal files written without 
vector-store files.
+                    vectorStoreStart = Math.max(vectorStoreStart, start);
                     start += rowCount;
                 }
             } else {
diff --git 
a/paimon-core/src/test/java/org/apache/paimon/append/VectorStoreTableTest.java 
b/paimon-core/src/test/java/org/apache/paimon/append/VectorStoreTableTest.java
index 0de783b084..c631fd4050 100644
--- 
a/paimon-core/src/test/java/org/apache/paimon/append/VectorStoreTableTest.java
+++ 
b/paimon-core/src/test/java/org/apache/paimon/append/VectorStoreTableTest.java
@@ -84,6 +84,38 @@ public class VectorStoreTableTest extends 
DataEvolutionTestBase {
     private final AtomicInteger uniqueIdGen = new AtomicInteger(0);
     private final Map<Integer, InternalRow> rowsWritten = new HashMap<>();
 
+    @ParameterizedTest
+    @ValueSource(strings = {"json", "parquet"})
+    public void testVectorRowIdsAfterNormalOnlyFiles(String format) throws 
Exception {
+        catalog.createTable(
+                identifier(),
+                
vectorSchema(format).option(CoreOptions.TARGET_FILE_ROW_NUM.key(), "1").build(),
+                false);
+        FileStoreTable table = getTableDefault();
+        BatchWriteBuilder builder = table.newBatchWriteBuilder();
+        List<CommitMessage> messages = new ArrayList<>();
+        try (BatchTableWrite normalWrite =
+                        builder.newWrite()
+                                .withWriteType(
+                                        
table.rowType().project(Collections.singletonList("id")));
+                BatchTableWrite vectorWrite = builder.newWrite();
+                BatchTableCommit commit = builder.newCommit()) {
+            normalWrite.write(GenericRow.of(0));
+            normalWrite.write(GenericRow.of(1));
+            vectorWrite.write(GenericRow.of(2, vector(22)));
+            vectorWrite.write(GenericRow.of(3, vector(33)));
+            messages.addAll(normalWrite.prepareCommit());
+            messages.addAll(vectorWrite.prepareCommit());
+            commit.commit(messages);
+        }
+        List<InternalRow> rows = read(getTableDefault());
+        rows.sort(Comparator.comparingInt(row -> row.getInt(0)));
+        assertThat(rows).extracting(row -> row.getInt(0)).containsExactly(0, 
1, 2, 3);
+        assertThat(rows)
+                .extracting(row -> row.isNullAt(1) ? null : 
row.getVector(1).toFloatArray()[0])
+                .containsExactly(null, null, 22F, 33F);
+    }
+
     @Test
     public void testPartialUpdateOfSharedVectorFile() throws Exception {
         Schema schema =

Reply via email to