This is an automated email from the ASF dual-hosted git repository.
morrysnow pushed a commit to branch branch-3.1
in repository https://gitbox.apache.org/repos/asf/doris.git
The following commit(s) were added to refs/heads/branch-3.1 by this push:
new afab6ef40e5 branch-3.1: [fix](nereids)alter sql block rule lost sql
pattern info #53559 (#54095)
afab6ef40e5 is described below
commit afab6ef40e50226768a1c3e7c7598463fbcbc7f2
Author: github-actions[bot]
<41898282+github-actions[bot]@users.noreply.github.com>
AuthorDate: Thu Jul 31 14:14:57 2025 +0800
branch-3.1: [fix](nereids)alter sql block rule lost sql pattern info #53559
(#54095)
Cherry-picked from #53559
Co-authored-by: starocean999 <[email protected]>
---
.../java/org/apache/doris/blockrule/SqlBlockRuleMgr.java | 2 ++
.../suites/sql_block_rule_p0/test_sql_block_rule.groovy | 13 +++++++++++++
2 files changed, 15 insertions(+)
diff --git
a/fe/fe-core/src/main/java/org/apache/doris/blockrule/SqlBlockRuleMgr.java
b/fe/fe-core/src/main/java/org/apache/doris/blockrule/SqlBlockRuleMgr.java
index 9b0cfa87e3b..8c9f265c94a 100644
--- a/fe/fe-core/src/main/java/org/apache/doris/blockrule/SqlBlockRuleMgr.java
+++ b/fe/fe-core/src/main/java/org/apache/doris/blockrule/SqlBlockRuleMgr.java
@@ -47,6 +47,7 @@ import java.io.IOException;
import java.util.List;
import java.util.Map;
import java.util.concurrent.locks.ReentrantReadWriteLock;
+import java.util.regex.Pattern;
import java.util.stream.Collectors;
/**
@@ -169,6 +170,7 @@ public class SqlBlockRuleMgr implements Writable {
if (sqlBlockRule.getEnable() == null) {
sqlBlockRule.setEnable(originRule.getEnable());
}
+ sqlBlockRule.setSqlPattern(Pattern.compile(sqlBlockRule.getSql()));
verifyLimitations(sqlBlockRule);
SqlBlockUtil.checkAlterValidate(sqlBlockRule);
diff --git
a/regression-test/suites/sql_block_rule_p0/test_sql_block_rule.groovy
b/regression-test/suites/sql_block_rule_p0/test_sql_block_rule.groovy
index 651ee946bd9..2864305d25a 100644
--- a/regression-test/suites/sql_block_rule_p0/test_sql_block_rule.groovy
+++ b/regression-test/suites/sql_block_rule_p0/test_sql_block_rule.groovy
@@ -248,4 +248,17 @@ suite("test_sql_block_rule", "nonConcurrent") {
"""
}
+ multi_sql """
+ drop SQL_BLOCK_RULE if exists rule_drop_r;
+
+ CREATE SQL_BLOCK_RULE rule_drop
+ PROPERTIES(
+ "sql"="select \\* from order_analysis",
+ "global"="true",
+ "enable"="true");
+
+ ALTER SQL_BLOCK_RULE rule_drop PROPERTIES("global"="true");
+
+ select NULL;
+ """
}
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]