You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@paimon.apache.org by je...@apache.org on 2026/03/18 07:18:25 UTC

(paimon) branch master updated: [core] fix AppendOnlyWriterTest after the update that vector always stored separately if vector.file.format is configured (#7463)

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

jerryjing 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 0826d2ac67 [core] fix AppendOnlyWriterTest after the update that vector always stored separately if vector.file.format is configured (#7463)
0826d2ac67 is described below

commit 0826d2ac67cfa9b27644b766cedaedfb6bb48ff0
Author: ColdL <ne...@gmail.com>
AuthorDate: Wed Mar 18 15:18:20 2026 +0800

    [core] fix AppendOnlyWriterTest after the update that vector always stored separately if vector.file.format is configured (#7463)
---
 .../apache/paimon/append/AppendOnlyWriterTest.java | 36 ++++++++++++++++++++--
 1 file changed, 34 insertions(+), 2 deletions(-)

diff --git a/paimon-core/src/test/java/org/apache/paimon/append/AppendOnlyWriterTest.java b/paimon-core/src/test/java/org/apache/paimon/append/AppendOnlyWriterTest.java
index 86af310504..c861296f2b 100644
--- a/paimon-core/src/test/java/org/apache/paimon/append/AppendOnlyWriterTest.java
+++ b/paimon-core/src/test/java/org/apache/paimon/append/AppendOnlyWriterTest.java
@@ -580,7 +580,7 @@ public class AppendOnlyWriterTest {
     }
 
     @Test
-    public void testVectorStoreSameFormatUsesRowDataWriter() throws Exception {
+    public void testVectorUsesRowDataWriterWithNoVectorFormat() throws Exception {
         RowType vectorStoreSchema =
                 RowType.builder()
                         .fields(
@@ -591,7 +591,7 @@ public class AppendOnlyWriterTest {
                                 },
                                 new String[] {"id", "name", "embed"})
                         .build();
-        FileFormat format = FileFormat.fromIdentifier(AVRO, new Options());
+        FileFormat format = null;
         AppendOnlyWriter writer = createVectorStoreWriter(1024 * 1024L, format, vectorStoreSchema);
         writer.write(rowWithVectors(1, "AAA", new float[] {1.0f, 2.0f, 3.0f}));
         CommitIncrement increment = writer.prepareCommit(true);
@@ -602,6 +602,38 @@ public class AppendOnlyWriterTest {
         assertThat(meta.fileName()).doesNotContain(".vector");
     }
 
+    @Test
+    public void testVectorUsesNewWriterWithSameVectorFormat() throws Exception {
+        RowType vectorStoreSchema =
+                RowType.builder()
+                        .fields(
+                                new DataType[] {
+                                    new IntType(),
+                                    new VarCharType(),
+                                    DataTypes.VECTOR(3, DataTypes.FLOAT())
+                                },
+                                new String[] {"id", "name", "embed"})
+                        .build();
+        FileFormat format = FileFormat.fromIdentifier(AVRO, new Options());
+        AppendOnlyWriter writer = createVectorStoreWriter(1024 * 1024L, format, vectorStoreSchema);
+        writer.write(rowWithVectors(1, "AAA", new float[] {1.0f, 2.0f, 3.0f}));
+        CommitIncrement increment = writer.prepareCommit(true);
+        writer.close();
+
+        assertThat(increment.newFilesIncrement().newFiles()).hasSize(2);
+        List<DataFileMeta> metaFiles = increment.newFilesIncrement().newFiles();
+        int countWithVector = 0, countWithoutVector = 0;
+        for (DataFileMeta meta : metaFiles) {
+            if (meta.fileName().contains(".vector")) {
+                ++countWithVector;
+            } else {
+                ++countWithoutVector;
+            }
+        }
+        assertThat(countWithVector).isEqualTo(1);
+        assertThat(countWithoutVector).isEqualTo(1);
+    }
+
     private SimpleColStats initStats(Integer min, Integer max, long nullCount) {
         return new SimpleColStats(min, max, nullCount);
     }