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 dec9ec9811 [cdc] fix special regex characters unescaped in excluded 
table patterns (#7619)
dec9ec9811 is described below

commit dec9ec9811549c3b408b759b510c1538abaaa058
Author: liziyan <[email protected]>
AuthorDate: Mon Apr 13 11:41:34 2026 +0800

    [cdc] fix special regex characters unescaped in excluded table patterns 
(#7619)
---
 .../paimon/flink/action/cdc/CdcActionCommonUtils.java       | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git 
a/paimon-flink/paimon-flink-cdc/src/main/java/org/apache/paimon/flink/action/cdc/CdcActionCommonUtils.java
 
b/paimon-flink/paimon-flink-cdc/src/main/java/org/apache/paimon/flink/action/cdc/CdcActionCommonUtils.java
index dc487c1033..97f057ddd2 100644
--- 
a/paimon-flink/paimon-flink-cdc/src/main/java/org/apache/paimon/flink/action/cdc/CdcActionCommonUtils.java
+++ 
b/paimon-flink/paimon-flink-cdc/src/main/java/org/apache/paimon/flink/action/cdc/CdcActionCommonUtils.java
@@ -36,6 +36,7 @@ import java.util.Arrays;
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
+import java.util.regex.Pattern;
 import java.util.stream.Collectors;
 
 import static org.apache.paimon.flink.action.MultiTablesSinkMode.COMBINED;
@@ -302,19 +303,19 @@ public class CdcActionCommonUtils {
         // be excluded by excluding pattern at the same time
         String includingPattern =
                 String.format("(%s)\\.(%s)", databasePattern, 
includingTablePattern);
-
+        LOG.info("Combined mode including pattern is {}", includingPattern);
         if (excludedTables.isEmpty()) {
             return includingPattern;
         }
 
+        // Use Pattern.quote to escape special regex characters (e.g., '$' in 
mysql table name)
+        // in database and table names, ensuring exact literal matching in the 
regex.
         String excludingPattern =
                 excludedTables.stream()
-                        .map(
-                                t ->
-                                        String.format(
-                                                "(^%s$)",
-                                                t.getDatabaseName() + "\\." + 
t.getObjectName()))
+                        .map(Identifier::getFullName)
+                        .map(n -> String.format("(^%s$)", Pattern.quote(n)))
                         .collect(Collectors.joining("|"));
+        LOG.info("Combined mode excluding pattern is {}", excludingPattern);
         excludingPattern = "?!" + excludingPattern;
         return String.format("(%s)(%s)", excludingPattern, includingPattern);
     }

Reply via email to