You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@doris.apache.org by GitBox <gi...@apache.org> on 2022/06/19 03:01:30 UTC

[GitHub] [doris] morningman commented on a diff in pull request #10213: [fix](auth) Authentication exception when the name of database or table contains an underscore in grant statement.

morningman commented on code in PR #10213:
URL: https://github.com/apache/doris/pull/10213#discussion_r901039146


##########
fe/fe-core/src/main/java/org/apache/doris/mysql/privilege/DbPrivEntry.java:
##########
@@ -70,8 +70,7 @@ private static PatternMatcher createDbPatternMatcher(String db) throws AnalysisE
             dbCaseSensibility = false;
         }
 
-        PatternMatcher dbPattern = PatternMatcher.createMysqlPattern(db.equals(ANY_DB) ? "%" : db, dbCaseSensibility);
-        return dbPattern;
+        return  PatternMatcher.createFlatPattern(db, dbCaseSensibility, db.equals(ANY_DB));

Review Comment:
   ```suggestion
           return PatternMatcher.createFlatPattern(db, dbCaseSensibility, db.equals(ANY_DB));
   ```



##########
fe/fe-core/src/main/java/org/apache/doris/common/PatternMatcher.java:
##########
@@ -20,27 +20,58 @@
 import com.google.common.base.Strings;
 import com.google.common.collect.Sets;
 
+import java.util.Locale;
 import java.util.Set;
 import java.util.regex.Pattern;
 
 // Wrap for Java pattern and matcher
 public class PatternMatcher {
+    public static final PatternMatcher MATCH_ANY = new PatternMatcher(Pattern.compile(".*"));
     private Pattern pattern;
+    private String flatPattern;

Review Comment:
   Add some comment in code to explain the different between `pattern` and `flatPattern`. Better to give some example.
   And looks like the `flatPattern` is not a real pattern, more like an `origin string`?



-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@doris.apache.org
For additional commands, e-mail: commits-help@doris.apache.org