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 ee92b70a6a [core] Keep the deletion-vector meta cache when a table is 
copied (#9266)
ee92b70a6a is described below

commit ee92b70a6a34373858526d26c2c9192dcc35a7b2
Author: ZIHAN DAI <[email protected]>
AuthorDate: Thu Aug 20 12:18:38 2026 +1000

    [core] Keep the deletion-vector meta cache when a table is copied (#9266)
---
 .../paimon/table/AbstractFileStoreTable.java       |  3 ++
 .../apache/paimon/table/CopyKeepsCachesTest.java   | 63 ++++++++++++++++++++++
 2 files changed, 66 insertions(+)

diff --git 
a/paimon-core/src/main/java/org/apache/paimon/table/AbstractFileStoreTable.java 
b/paimon-core/src/main/java/org/apache/paimon/table/AbstractFileStoreTable.java
index 2f893d4e3b..88ee3f6a4b 100644
--- 
a/paimon-core/src/main/java/org/apache/paimon/table/AbstractFileStoreTable.java
+++ 
b/paimon-core/src/main/java/org/apache/paimon/table/AbstractFileStoreTable.java
@@ -403,6 +403,9 @@ abstract class AbstractFileStoreTable implements 
FileStoreTable {
         if (statsCache != null) {
             copied.setStatsCache(statsCache);
         }
+        if (dvmetaCache != null) {
+            copied.setDVMetaCache(dvmetaCache);
+        }
         return copied;
     }
 
diff --git 
a/paimon-core/src/test/java/org/apache/paimon/table/CopyKeepsCachesTest.java 
b/paimon-core/src/test/java/org/apache/paimon/table/CopyKeepsCachesTest.java
new file mode 100644
index 0000000000..3b6fa618f9
--- /dev/null
+++ b/paimon-core/src/test/java/org/apache/paimon/table/CopyKeepsCachesTest.java
@@ -0,0 +1,63 @@
+/*
+ * 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.table;
+
+import org.apache.paimon.CoreOptions;
+import org.apache.paimon.catalog.Identifier;
+import org.apache.paimon.schema.Schema;
+import org.apache.paimon.types.DataTypes;
+import org.apache.paimon.utils.DVMetaCache;
+
+import org.junit.jupiter.api.Test;
+
+import java.util.Collections;
+
+import static org.assertj.core.api.Assertions.assertThat;
+
+/**
+ * A caching catalog installs its caches on the table it loads, but engines 
read through a copy
+ * carrying dynamic options. Every cache has to survive that copy or it is 
inert in practice.
+ */
+public class CopyKeepsCachesTest extends TableTestBase {
+
+    @Test
+    public void testCopyKeepsTheDeletionVectorMetaCache() throws Exception {
+        Identifier id = identifier("dv_cache");
+        catalog.createTable(
+                id,
+                Schema.newBuilder()
+                        .column("a", DataTypes.INT())
+                        .column("b", DataTypes.INT())
+                        .option(CoreOptions.BUCKET.key(), "-1")
+                        .build(),
+                false);
+        AbstractFileStoreTable table = (AbstractFileStoreTable) 
catalog.getTable(id);
+
+        DVMetaCache dvMetaCache = new DVMetaCache(100);
+        table.setDVMetaCache(dvMetaCache);
+
+        AbstractFileStoreTable copied =
+                (AbstractFileStoreTable)
+                        table.copy(
+                                Collections.singletonMap(
+                                        
CoreOptions.SCAN_MAX_SPLITS_PER_TASK.key(), "7"));
+
+        assertThat(copied.dvmetaCache).isSameAs(dvMetaCache);
+    }
+}

Reply via email to