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 cf596ebcbe [core] Sanitize lookup file name prefixes (#11063)
cf596ebcbe is described below

commit cf596ebcbe48cd5f2f52deb86b42e6d27f9236c8
Author: tsreaper <[email protected]>
AuthorDate: Tue Nov 10 21:42:42 2026 +0800

    [core] Sanitize lookup file name prefixes (#11063)
---
 .../src/main/java/org/apache/paimon/mergetree/LookupFile.java |  4 +++-
 .../test/java/org/apache/paimon/mergetree/LookupFileTest.java | 11 +++++++++++
 2 files changed, 14 insertions(+), 1 deletion(-)

diff --git 
a/paimon-core/src/main/java/org/apache/paimon/mergetree/LookupFile.java 
b/paimon-core/src/main/java/org/apache/paimon/mergetree/LookupFile.java
index 7ffd9c31cf..692a50304e 100644
--- a/paimon-core/src/main/java/org/apache/paimon/mergetree/LookupFile.java
+++ b/paimon-core/src/main/java/org/apache/paimon/mergetree/LookupFile.java
@@ -198,7 +198,9 @@ public class LookupFile {
         if (partition.getFieldCount() == 0) {
             return String.format("%s-%s", bucket, remoteFileName);
         } else {
-            String partitionString = partToSimpleString(partitionType, 
partition, "-", 20);
+            String partitionString =
+                    partToSimpleString(partitionType, partition, "-", 20)
+                            .replaceAll("[^a-zA-Z0-9._-]", "_");
             return String.format("%s-%s-%s", partitionString, bucket, 
remoteFileName);
         }
     }
diff --git 
a/paimon-core/src/test/java/org/apache/paimon/mergetree/LookupFileTest.java 
b/paimon-core/src/test/java/org/apache/paimon/mergetree/LookupFileTest.java
index ec74aa9cd4..7735e4379b 100644
--- a/paimon-core/src/test/java/org/apache/paimon/mergetree/LookupFileTest.java
+++ b/paimon-core/src/test/java/org/apache/paimon/mergetree/LookupFileTest.java
@@ -69,6 +69,17 @@ public class LookupFileTest {
                         
"2024073105-05-212323-10-data-ccbb95e7-8b8c-4549-8ca9-f553843d67ad-3.orc");
     }
 
+    @Test
+    public void testLocalFilePrefixWithInvalidPathCharacters() throws 
IOException {
+        String fileName =
+                localFilePrefix(
+                        RowType.of(DataTypes.STRING()),
+                        singleColumn("a\u0000/b"),
+                        0,
+                        "data.parquet");
+        assertThat(new File(tempDir.toFile(), 
fileName).createNewFile()).isTrue();
+    }
+
     @Test
     public void testCloseCleansLocalStateWhenReaderCloseFails() throws 
Exception {
         File localFile = tempDir.resolve("lookup-file").toFile();

Reply via email to