This is an automated email from the ASF dual-hosted git repository.
menghaoran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 9870592 Split SHARDINGRULE to SHARDING RULE on RDL (#8603)
9870592 is described below
commit 9870592bf87d7a8dda5926b015014d75112b75fd
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Dec 13 18:26:20 2020 +0800
Split SHARDINGRULE to SHARDING RULE on RDL (#8603)
* Add CreateRDLStatement and ShowRDLStatement
* Split SHARDINGRULE to SHARDING RULE on RDL g4 definition
* Update document
---
docs/document/content/features/sharding/use-norms/rdl.cn.md | 8 ++++----
docs/document/content/features/sharding/use-norms/rdl.en.md | 8 ++++----
.../src/main/antlr4/imports/Keyword.g4 | 10 +++++++---
.../src/main/antlr4/imports/RDLStatement.g4 | 4 ++--
4 files changed, 17 insertions(+), 13 deletions(-)
diff --git a/docs/document/content/features/sharding/use-norms/rdl.cn.md
b/docs/document/content/features/sharding/use-norms/rdl.cn.md
index 191a0f3..2968d09 100644
--- a/docs/document/content/features/sharding/use-norms/rdl.cn.md
+++ b/docs/document/content/features/sharding/use-norms/rdl.cn.md
@@ -24,11 +24,11 @@ CREATE datasources (
ds0=127.0.0.1:3306:demo_ds_0:root:pwd,
ds1=127.0.0.1:3306:demo_ds_1:root:pwd)
```
-- `CREATE SHARDINGRULE`,用于配置分片规则。
+- `CREATE SHARDING RULE`,用于配置分片规则。
```sql
// SQL
-CREATE SHARDINGRULE (
+CREATE SHARDING RULE (
sharding_table_name=sharding_algorithm(algorithm_property[,
algothrim_property])
[, sharding_table_name=sharding_algorithm_type(algorithm_property[,
algothrim_property]), ...]
)
@@ -38,7 +38,7 @@ mod_algorithm_properties: sharding_column,shards_amount
mod_hash_algorithm_properties: sharding_column,shards_amount
// Example
-CREATE shardingrules (
+CREATE SHARDING RULE (
t_order=hash_mod(order_id, 4),
t_item=mod(item_id, 2)
)
@@ -84,7 +84,7 @@ ds1=127.0.0.1:3306:demo_ds_3:root:pwd)
3. 创建分片规则
```SQL
-CREATE shardingrule (
+CREATE SHARDING RULE (
t_order=hash_mod(order_id, 4),
t_item=mod(item_id, 2)
)
diff --git a/docs/document/content/features/sharding/use-norms/rdl.en.md
b/docs/document/content/features/sharding/use-norms/rdl.en.md
index 933cabe..5bf5fb4 100644
--- a/docs/document/content/features/sharding/use-norms/rdl.en.md
+++ b/docs/document/content/features/sharding/use-norms/rdl.en.md
@@ -22,11 +22,11 @@ CREATE datasources (
ds0=127.0.0.1:3306:demo_ds_0:root:pwd,
ds1=127.0.0.1:3306:demo_ds_1:root:pwd)
```
-- `CREATE SHARDINGRULE` to create sharding rule made by table rules
+- `CREATE SHARDING RULE` to create sharding rule made by table rules
```sql
// SQL
-CREATE SHARDINGRULE (
+CREATE SHARDING RULE (
sharding_table_name=sharding_algorithm(algorithm_property[,
algothrim_property])
[, sharding_table_name=sharding_algorithm_type(algorithm_property[,
algothrim_property]), ...]
)
@@ -36,7 +36,7 @@ mod_algorithm_properties: sharding_column,shards_amount
mod_hash_algorithm_properties: sharding_column,shards_amount
// Example
-CREATE shardingrules (
+CREATE SHARDING RULE (
t_order=hash_mod(order_id, 4),
t_item=mod(item_id, 2)
)
@@ -82,7 +82,7 @@ ds1=127.0.0.1:3306:demo_ds_3:root:pwd)
3. Create Sharding rule
```SQL
-CREATE shardingrule (
+CREATE SHARDING RULE (
t_order=hash_mod(order_id, 4),
t_item=mod(item_id, 2)
)
diff --git
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/Keyword.g4
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/Keyword.g4
index 7275a0e..420183e 100644
---
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/Keyword.g4
+++
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/Keyword.g4
@@ -30,9 +30,9 @@ CREATE
DATASOURCES
: D A T A S O U R C E S
;
-
-SHARDINGRULE
- : S H A R D I N G R U L E
+
+RULE
+ : R U L E
;
SHOW
@@ -42,3 +42,7 @@ SHOW
FROM
: F R O M
;
+
+SHARDING
+ : S H A R D I N G
+ ;
diff --git
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RDLStatement.g4
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RDLStatement.g4
index 5e06b85..34c4885 100644
---
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RDLStatement.g4
+++
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RDLStatement.g4
@@ -60,7 +60,7 @@ password
;
createShardingRule
- : CREATE SHARDINGRULE LP tableRule (COMMA tableRule)* RP
+ : CREATE SHARDING RULE LP tableRule (COMMA tableRule)* RP
;
tableRule
@@ -96,7 +96,7 @@ columName
;
showShardingRule
- : SHOW SHARDINGRULE (FROM schemaName)?
+ : SHOW SHARDING RULE (FROM schemaName)?
;
schemaName