This is an automated email from the ASF dual-hosted git repository. jiafengzheng pushed a commit to branch master in repository https://gitbox.apache.org/repos/asf/doris-website.git
The following commit(s) were added to refs/heads/master by this push: new 8c5d714fbfe sql-block-rule,add more example 8c5d714fbfe is described below commit 8c5d714fbfe0d02ca7fca93067321e0d3fee34f2 Author: jiafeng.zhang <zhang...@gmail.com> AuthorDate: Tue Aug 2 15:59:02 2022 +0800 sql-block-rule,add more example sql-block-rule,add more example --- .../Create/CREATE-SQL-BLOCK-RULE.md | 57 ++++++++++++-------- .../Create/CREATE-SQL-BLOCK-RULE.md | 61 +++++++++++++--------- 2 files changed, 72 insertions(+), 46 deletions(-) diff --git a/docs/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-SQL-BLOCK-RULE.md b/docs/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-SQL-BLOCK-RULE.md index 0790a9a3fee..7fc35132011 100644 --- a/docs/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-SQL-BLOCK-RULE.md +++ b/docs/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-SQL-BLOCK-RULE.md @@ -61,35 +61,48 @@ Parameter Description: 1. Create a block rule named test_rule - ```sql - mysql> CREATE SQL_BLOCK_RULE test_rule - -> PROPERTIES( - -> "sql"="select \\* from order_analysis;", - -> "global"="false", - -> "enable"="true" - -> ); - Query OK, 0 rows affected (0.01 sec) - ```` + ```sql + CREATE SQL_BLOCK_RULE test_rule + PROPERTIES( + "sql"="select \\* from order_analysis;", + "global"="false", + "enable"="true" + ); + ```` - When we execute the sql we just defined in the rule, an exception error will be returned. The example is as follows: + When we execute the sql we just defined in the rule, an exception error will be returned. The example is as follows: + + ```sql + select * from order_analysis; + ERROR 1064 (HY000): errCode = 2, detailMessage = sql match regex sql block rule: order_analysis_rule + ```` - ```sql - mysql> select * from order_analysis; - ERROR 1064 (HY000): errCode = 2, detailMessage = sql match regex sql block rule: order_analysis_rule - ```` 2. Create test_rule2, limit the maximum number of scanned partitions to 30, and limit the maximum scan base to 10 billion rows. The example is as follows: ```sql - mysql> CREATE SQL_BLOCK_RULE test_rule2 - -> PROPERTIES ( - -> "partition_num" = "30", - -> "cardinality" = "10000000000", - -> "global" = "false", - -> "enable" = "true" - -> ); - Query OK, 0 rows affected (0.01 sec) + CREATE SQL_BLOCK_RULE test_rule2 + PROPERTIES ( + "partition_num" = "30", + "cardinality" = "10000000000", + "global" = "false", + "enable" = "true" + ); ```` +3. Create SQL BLOCK RULE with special chars + + ```sql + CREATE SQL_BLOCK_RULE test_rule3 + PROPERTIES + ( + "sql" = "select count\\(1\\) from db1.tbl1" + ); + CREATE SQL_BLOCK_RULE test_rule4 + PROPERTIES + ( + "sql" = "select \\* from db1.tbl1" + ); + ``` ### Keywords diff --git a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-SQL-BLOCK-RULE.md b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-SQL-BLOCK-RULE.md index 17032f5afec..fa73c57e8c0 100644 --- a/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-SQL-BLOCK-RULE.md +++ b/i18n/zh-CN/docusaurus-plugin-content-docs/current/sql-manual/sql-reference/Data-Definition-Statements/Create/CREATE-SQL-BLOCK-RULE.md @@ -61,36 +61,49 @@ CREATE SQL_BLOCK_RULE rule_name 1. 创建一个名称为 test_rule 的阻止规则 - ```sql - mysql> CREATE SQL_BLOCK_RULE test_rule - -> PROPERTIES( - -> "sql"="select \\* from order_analysis;", - -> "global"="false", - -> "enable"="true" - -> ); - Query OK, 0 rows affected (0.01 sec) - ``` - - 当我们去执行刚才我们定义在规则里的sql时就会返回异常错误,示例如下: - - ```sql - mysql> select * from order_analysis; - ERROR 1064 (HY000): errCode = 2, detailMessage = sql match regex sql block rule: order_analysis_rule - ``` + ```sql + CREATE SQL_BLOCK_RULE test_rule + PROPERTIES( + "sql"="select \\* from order_analysis;", + "global"="false", + "enable"="true" + ); + ``` + + 当我们去执行刚才我们定义在规则里的sql时就会返回异常错误,示例如下: + + ```sql + mysql> select * from order_analysis; + ERROR 1064 (HY000): errCode = 2, detailMessage = sql match regex sql block rule: order_analysis_rule + ``` 2. 创建 test_rule2,将最大扫描的分区数量限制在30个,最大扫描基数限制在100亿行,示例如下: - ```sql - mysql> CREATE SQL_BLOCK_RULE test_rule2 - -> PROPERTIES + ```sql + CREATE SQL_BLOCK_RULE test_rule2 + PROPERTIES ( - -> "partition_num" = "30", - -> "cardinality" = "10000000000", - -> "global" = "false", - -> "enable" = "true" - -> ); + "partition_num" = "30", + "cardinality" = "10000000000", + "global" = "false", + "enable" = "true" + ); Query OK, 0 rows affected (0.01 sec) ``` +3. 创建包含特殊字符的 SQL BLOCK RULE: + + ```sql + CREATE SQL_BLOCK_RULE test_rule3 + PROPERTIES + ( + "sql" = "select count\\(1\\) from db1.tbl1" + ); + CREATE SQL_BLOCK_RULE test_rule4 + PROPERTIES + ( + "sql" = "select \\* from db1.tbl1" + ); + ``` ### Keywords --------------------------------------------------------------------- To unsubscribe, e-mail: commits-unsubscr...@doris.apache.org For additional commands, e-mail: commits-h...@doris.apache.org