stalary commented on a change in pull request #6192: URL: https://github.com/apache/incubator-doris/pull/6192#discussion_r667318757
########## File path: fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java ########## @@ -1169,5 +1178,33 @@ private void handleExportStmt() throws Exception { private List<PrimitiveType> exprToType(List<Expr> exprs) { return exprs.stream().map(e -> e.getType().getPrimitiveType()).collect(Collectors.toList()); } + + private void matchSql(QueryStmt queryStmt) throws AnalysisException { + Map<String, List<SqlBlockRule>> userToSqlBlockRuleMap = Catalog.getCurrentCatalog().getSqlBlocklistMgr().getUserToSqlBlockRuleMap(); + // match default rule + String sql = queryStmt.getOrigStmt().originStmt; + List<SqlBlockRule> defaultRules = userToSqlBlockRuleMap.getOrDefault(SqlBlockRule.DEFAULT_USER, new ArrayList<>()); + for (SqlBlockRule rule : defaultRules) { + matchSql(rule, sql); + } + // match user rule + String user = context.getUserIdentity().getUser(); + List<SqlBlockRule> userRules = userToSqlBlockRuleMap.getOrDefault(user, new ArrayList<>()); + for (SqlBlockRule rule : userRules) { + matchSql(rule, sql); + } + } + + @VisibleForTesting + public static void matchSql(SqlBlockRule rule, String sql) throws AnalysisException { + if (rule.getEnable() != null && rule.getEnable()) { + String sqlPattern = rule.getSql(); + Pattern pattern = Pattern.compile(sqlPattern); Review comment: Yes, there is a performance problem. Let me fix it -- 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-unsubscr...@doris.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org