From 389e9f6e1fe677f5770f94145cd54d5dfeed8c6a Mon Sep 17 00:00:00 2001 From: lichi Date: Fri, 26 Dec 2025 16:47:42 +0800 Subject: [PATCH] branch-2.1 [enhancemment](planner)check sql regex block rule before plan phase #57477 --- .../src/main/java/org/apache/doris/qe/StmtExecutor.java | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java index 1b1a5bfe290b43..62a6a6b2d34c6a 100644 --- a/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java +++ b/fe/fe-core/src/main/java/org/apache/doris/qe/StmtExecutor.java @@ -817,8 +817,9 @@ private void executeByNereids(TUniqueId queryId) throws Exception { syncJournalIfNeeded(); planner = new NereidsPlanner(statementContext); try { + checkBlockRulesByRegex(originStmt); planner.plan(parsedStmt, context.getSessionVariable().toThrift()); - checkBlockRules(); + checkBlockRulesByScan(planner); } catch (MustFallbackException | DoNotFallbackException e) { LOG.warn("Nereids plan query failed:\n{}", originStmt.originStmt, e); throw new NereidsException("Command(" + originStmt.originStmt + ") process failed.", e); @@ -916,6 +917,7 @@ public void executeByLegacy(TUniqueId queryId) throws Exception { } try { + checkBlockRulesByRegex(originStmt); // parsedStmt maybe null here, we parse it. Or the predicate will not work. parseByLegacy(); // set isQuery here because when fallback from Nereids, parsedStmt is null, so the above set will be skipped @@ -986,7 +988,7 @@ public void executeByLegacy(TUniqueId queryId) throws Exception { } // sql/sqlHash block - checkBlockRules(); + checkBlockRulesByScan(planner); if (parsedStmt instanceof QueryStmt) { handleQueryWithRetry(queryId); } else if (parsedStmt instanceof SetStmt) {