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

kxiao pushed a commit to branch branch-2.0
in repository https://gitbox.apache.org/repos/asf/doris.git

commit 1bccbf9b2d9056bfbf186c4d24d503ae1c87d03d
Author: DongLiang-0 <[email protected]>
AuthorDate: Mon Oct 9 10:04:10 2023 +0800

    [fix](catalog)fix use regex parse partition may cause backtracking (#24876)
---
 .../glue/catalog/converters/PartitionNameParser.java        | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git 
a/fe/fe-core/src/main/java/com/amazonaws/glue/catalog/converters/PartitionNameParser.java
 
b/fe/fe-core/src/main/java/com/amazonaws/glue/catalog/converters/PartitionNameParser.java
index 1419896a588..7ecc7450577 100644
--- 
a/fe/fe-core/src/main/java/com/amazonaws/glue/catalog/converters/PartitionNameParser.java
+++ 
b/fe/fe-core/src/main/java/com/amazonaws/glue/catalog/converters/PartitionNameParser.java
@@ -30,12 +30,10 @@ import java.util.LinkedHashMap;
 import java.util.List;
 import java.util.Map.Entry;
 import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
 
 public class PartitionNameParser {
 
-  private static final Pattern PARTITION_NAME_VALUE_PATTERN = 
Pattern.compile("([^/]+)=([^/]+)");
+  private static final String PARTITION_DELIMITER = "=";
   private static final String PARTITION_NAME_DELIMITER = "/";
 
   private static final char STORE_AS_NUMBER = 'n';
@@ -117,11 +115,10 @@ public class PartitionNameParser {
   private static AbstractMap.SimpleEntry getPartitionColumnValuePair(String 
partition) {
     String column = null;
     String value = null;
-    Matcher partitionMatcher = PARTITION_NAME_VALUE_PATTERN.matcher(partition);
-
-    if (partitionMatcher.matches()) {
-      column = unescapePathName(partitionMatcher.group(1));
-      value = unescapePathName(partitionMatcher.group(2));
+    String[] splitPartition = partition.split(PARTITION_DELIMITER);
+    if (splitPartition.length == 2) {
+      column = unescapePathName(splitPartition[0]);
+      value = unescapePathName(splitPartition[1]);
     } else {
       throw new InvalidPartitionNameException(partition);
     }


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to