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

lzljs3620320 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 6b613496b4 [common] Copy bundle while shredding (#7111)
6b613496b4 is described below

commit 6b613496b4023d6025c05ec2c4aa5898385c95a8
Author: YeJunHao <[email protected]>
AuthorDate: Fri Jan 23 13:06:18 2026 +0800

    [common] Copy bundle while shredding (#7111)
---
 .../format/variant/InferVariantShreddingWriter.java  | 20 +++++++++++++++++++-
 1 file changed, 19 insertions(+), 1 deletion(-)

diff --git 
a/paimon-common/src/main/java/org/apache/paimon/format/variant/InferVariantShreddingWriter.java
 
b/paimon-common/src/main/java/org/apache/paimon/format/variant/InferVariantShreddingWriter.java
index edb7b6bfd5..077a8d3da1 100644
--- 
a/paimon-common/src/main/java/org/apache/paimon/format/variant/InferVariantShreddingWriter.java
+++ 
b/paimon-common/src/main/java/org/apache/paimon/format/variant/InferVariantShreddingWriter.java
@@ -27,8 +27,11 @@ import org.apache.paimon.io.BundleRecords;
 import org.apache.paimon.types.RowType;
 import org.apache.paimon.utils.InternalRowUtils;
 
+import javax.annotation.Nonnull;
+
 import java.io.IOException;
 import java.util.ArrayList;
+import java.util.Iterator;
 import java.util.List;
 
 /**
@@ -87,7 +90,22 @@ public class InferVariantShreddingWriter implements 
BundleFormatWriter {
     @Override
     public void writeBundle(BundleRecords bundle) throws IOException {
         if (!schemaFinalized) {
-            bufferedBundles.add(bundle);
+            final List<InternalRow> rows = new ArrayList<>();
+            bundle.forEach(row -> 
rows.add(InternalRowUtils.copyInternalRow(row, rowType)));
+            BundleRecords copiedBundle =
+                    new BundleRecords() {
+                        @Override
+                        @Nonnull
+                        public Iterator<InternalRow> iterator() {
+                            return rows.iterator();
+                        }
+
+                        @Override
+                        public long rowCount() {
+                            return rows.size();
+                        }
+                    };
+            bufferedBundles.add(copiedBundle);
             totalBufferedRowCount += bundle.rowCount();
             if (totalBufferedRowCount >= maxBufferRow) {
                 finalizeSchemaAndFlush();

Reply via email to