This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 a7354c8480c Revise SHARDING RULE test cases (#21833)
a7354c8480c is described below
commit a7354c8480c4861c2705cf6811c5ddb296d65d39
Author: ChenJiaHao <[email protected]>
AuthorDate: Sat Oct 29 03:41:27 2022 +0800
Revise SHARDING RULE test cases (#21833)
---
test/parser/src/main/resources/case/rdl/alter.xml | 38 +++++--
test/parser/src/main/resources/case/rdl/create.xml | 110 ++++++++++++++++-----
.../src/main/resources/sql/supported/rdl/alter.xml | 8 +-
.../main/resources/sql/supported/rdl/create.xml | 14 +--
4 files changed, 129 insertions(+), 41 deletions(-)
diff --git a/test/parser/src/main/resources/case/rdl/alter.xml
b/test/parser/src/main/resources/case/rdl/alter.xml
index 2513510f1e0..3fc13fa9672 100644
--- a/test/parser/src/main/resources/case/rdl/alter.xml
+++ b/test/parser/src/main/resources/case/rdl/alter.xml
@@ -92,10 +92,18 @@
<rule name="t_order" key-generate-strategy-column="another_id">
<data-source>ms_group_${0..1}</data-source>
<table-strategy type="standard" sharding-column="user_id">
- <algorithm-segment algorithm-name="table_inline" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="t_order_${user_id % 2}" />
+ </properties>
+ </algorithm-segment>
</table-strategy>
<database-strategy type="standard" sharding-column="order_id">
- <algorithm-segment algorithm-name="database_inline" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="ms_group_${order_id % 2}" />
+ </properties>
+ </algorithm-segment>
</database-strategy>
<key-generate-strategy algorithm-name="snowflake" />
</rule>
@@ -103,12 +111,20 @@
<alter-sharding-table-rule sql-case-id="alter-sharding-table-rule-complex">
<rule name="t_order" key-generate-strategy-column="another_id">
- <data-source>ms_group_${0..1}</data-source>
+ <data-source>ms_group_${0..1}_${0..1}.t_order_${0..1}</data-source>
<table-strategy type="standard" sharding-column="user_id">
- <algorithm-segment algorithm-name="table_inline" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="t_order_${user_id % 2}" />
+ </properties>
+ </algorithm-segment>
</table-strategy>
<database-strategy type="complex"
sharding-column="order_id,user_id">
- <algorithm-segment algorithm-name="database_inline" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="ms_group_${order_id % 2}_${user_id % 2}" />
+ </properties>
+ </algorithm-segment>
</database-strategy>
<key-generate-strategy algorithm-name="snowflake" />
</rule>
@@ -249,13 +265,21 @@
<alter-default-sharding-strategy
sql-case-id="alter-default-sharding-strategy">
<strategy default-type="TABLE" strategy-type="standard"
sharding-column="order_id">
- <algorithm-segment algorithm-name="INLINE" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="t_order_${order_id % 2}" />
+ </properties>
+ </algorithm-segment>
</strategy>
</alter-default-sharding-strategy>
<alter-default-sharding-strategy
sql-case-id="alter-default-sharding-strategy-complex">
<strategy default-type="TABLE" strategy-type="complex"
sharding-column="order_id,user_id">
- <algorithm-segment algorithm-name="INLINE" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="t_order_${order_id % 2}_${user_id % 2}" />
+ </properties>
+ </algorithm-segment>
</strategy>
</alter-default-sharding-strategy>
</sql-parser-test-cases>
diff --git a/test/parser/src/main/resources/case/rdl/create.xml
b/test/parser/src/main/resources/case/rdl/create.xml
index a023993feb7..1dcf0e09ee8 100644
--- a/test/parser/src/main/resources/case/rdl/create.xml
+++ b/test/parser/src/main/resources/case/rdl/create.xml
@@ -113,78 +113,130 @@
<rule name="t_order" key-generate-strategy-column="another_id">
<data-source>ms_group_${0..1}</data-source>
<table-strategy type="standard" sharding-column="user_id">
- <algorithm-segment algorithm-name="INLINE" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="t_order_${user_id % 2}" />
+ </properties>
+ </algorithm-segment>
</table-strategy>
<database-strategy type="standard" sharding-column="order_id">
- <algorithm-segment algorithm-name="INLINE" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="ms_group_${order_id % 2}" />
+ </properties>
+ </algorithm-segment>
</database-strategy>
<key-generate-strategy algorithm-name="snowflake" />
</rule>
<rule name="t_order_item" key-generate-strategy-column="another_id">
<data-source>ms_group_${0..1}</data-source>
<table-strategy type="standard" sharding-column="user_id">
- <algorithm-segment algorithm-name="INLINE" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="t_order_item_${user_id % 2}" />
+ </properties>
+ </algorithm-segment>
</table-strategy>
<database-strategy type="standard" sharding-column="order_id">
- <algorithm-segment algorithm-name="INLINE" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="ms_group_${order_id % 2}" />
+ </properties>
+ </algorithm-segment>
</database-strategy>
</rule>
</create-sharding-table-rule>
<create-sharding-table-rule
sql-case-id="create-sharding-table-rule-with-enum-inline-expression">
<rule name="t_order" key-generate-strategy-column="another_id">
- <data-source>ms_group_${['abc','ac']}.table</data-source>
+ <data-source>ms_group_${['abc','ac']}.t_order_${0..1}</data-source>
<table-strategy type="standard" sharding-column="user_id">
- <algorithm-segment algorithm-name="INLINE" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="t_order_${user_id % 2}" />
+ </properties>
+ </algorithm-segment>
</table-strategy>
- <database-strategy type="standard" sharding-column="order_id">
- <algorithm-segment algorithm-name="INLINE" />
+ <database-strategy type="standard" sharding-column="order_name">
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="ms_group_${order_name}" />
+ </properties>
+ </algorithm-segment>
</database-strategy>
<key-generate-strategy algorithm-name="snowflake" />
</rule>
<rule name="t_order_item" key-generate-strategy-column="another_id">
- <data-source>ms_group_${0..1}</data-source>
+ <data-source>ms_group_${0..1}.t_order_item_${0..1}</data-source>
<table-strategy type="standard" sharding-column="user_id">
- <algorithm-segment algorithm-name="INLINE" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="t_order_item_${user_id % 2}" />
+ </properties>
+ </algorithm-segment>
</table-strategy>
<database-strategy type="standard" sharding-column="order_id">
- <algorithm-segment algorithm-name="INLINE" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="ms_group_${order_id % 2}" />
+ </properties>
+ </algorithm-segment>
</database-strategy>
</rule>
</create-sharding-table-rule>
<create-sharding-table-rule
sql-case-id="create-sharding-table-rule-complex">
<rule name="t_order" key-generate-strategy-column="another_id">
- <data-source>ms_group_${0..1}</data-source>
+ <data-source>ms_group_${0..1}_${0..1}.t_order_${0..1}</data-source>
<table-strategy type="standard" sharding-column="user_id">
- <algorithm-segment algorithm-name="INLINE" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="t_order_${user_id % 2}" />
+ </properties>
+ </algorithm-segment>
</table-strategy>
<database-strategy type="complex"
sharding-column="order_id,user_id">
- <algorithm-segment algorithm-name="INLINE" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="ms_group_${order_id % 2}_${user_id % 2}" />
+ </properties>
+ </algorithm-segment>
</database-strategy>
<key-generate-strategy algorithm-name="snowflake" />
</rule>
<rule name="t_order_item" key-generate-strategy-column="another_id">
- <data-source>ms_group_${0..1}</data-source>
+ <data-source>ms_group_${0..1}.t_order_item_${0..1}</data-source>
<table-strategy type="standard" sharding-column="user_id">
- <algorithm-segment algorithm-name="INLINE" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="t_order_item_${user_id % 2}" />
+ </properties>
+ </algorithm-segment>
</table-strategy>
<database-strategy type="standard" sharding-column="order_id">
- <algorithm-segment algorithm-name="INLINE" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="ms_group_${order_id % 2}" />
+ </properties>
+ </algorithm-segment>
</database-strategy>
</rule>
</create-sharding-table-rule>
<create-sharding-table-rule
sql-case-id="create-sharding-table-rule-with-auto-create-algorithm">
<rule name="t_order" key-generate-strategy-column="another_id">
- <data-source>ms_group_${0..1}</data-source>
+ <data-source>ms_group_${0..1}.t_order_${0..1}</data-source>
<table-strategy type="standard" sharding-column="user_id">
- <algorithm-segment algorithm-name="INLINE" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="t_order_${user_id % 2}" />
+ </properties>
+ </algorithm-segment>
</table-strategy>
<database-strategy type="standard" sharding-column="order_id" >
<algorithm-segment algorithm-name="INLINE">
<properties>
- <property key="algorithm-expression"
value="ms_group_${order_id% 2}" />
+ <property key="algorithm-expression"
value="ms_group_${order_id % 2}" />
</properties>
</algorithm-segment>
</database-strategy>
@@ -396,19 +448,31 @@
<create-default-sharding-strategy
sql-case-id="create-default-sharding-table-strategy-with-lower-case">
<strategy default-type="table" strategy-type="standard"
sharding-column="order_id">
- <algorithm-segment algorithm-name="INLINE" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="t_order_${order_id % 2}" />
+ </properties>
+ </algorithm-segment>
</strategy>
</create-default-sharding-strategy>
<create-default-sharding-strategy
sql-case-id="create-default-sharding-database-strategy">
<strategy default-type="DATABASE" strategy-type="STANDARD"
sharding-column="ORDER_ID">
- <algorithm-segment algorithm-name="INLINE" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="ms_group_${user_id % 2}" />
+ </properties>
+ </algorithm-segment>
</strategy>
</create-default-sharding-strategy>
<create-default-sharding-strategy
sql-case-id="create-default-sharding-strategy-complex">
<strategy default-type="TABLE" strategy-type="complex"
sharding-column="order_id,user_id">
- <algorithm-segment algorithm-name="INLINE" />
+ <algorithm-segment algorithm-name="INLINE">
+ <properties>
+ <property key="algorithm-expression"
value="t_order_${user_id % 2}_${order_id % 2}" />
+ </properties>
+ </algorithm-segment>
</strategy>
</create-default-sharding-strategy>
diff --git a/test/parser/src/main/resources/sql/supported/rdl/alter.xml
b/test/parser/src/main/resources/sql/supported/rdl/alter.xml
index 13c203bccd6..a2ff8e69e21 100644
--- a/test/parser/src/main/resources/sql/supported/rdl/alter.xml
+++ b/test/parser/src/main/resources/sql/supported/rdl/alter.xml
@@ -36,10 +36,10 @@
<distsql-case id="alter-encrypt-rule-with-query-with-cipher-column"
value="ALTER ENCRYPT RULE t_encrypt (RESOURCE=ds_1,
COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,
TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))), (NAME=order_id,
CIPHER =order_cipher,TYPE(NAME='MD5'))), QUERY_WITH_CIPHER_COLUMN=false)" />
<distsql-case id="alter-default-shadow-algorithm" value="ALTER DEFAULT
SHADOW ALGORITHM TYPE(NAME='SIMPLE_HINT', PROPERTIES('shadow'='true',
'foo'='bar'))" />
<distsql-case id="alter-shadow-rule" value="ALTER SHADOW RULE
shadow_rule(SOURCE=demo_ds,SHADOW=demo_ds_shadow,t_order(TYPE(NAME='REGEX_MATCH',PROPERTIES('operation'='insert','column'='user_id','regex'='[1]')),TYPE(NAME='SIMPLE_HINT',PROPERTIES('shadow'='true','foo'='bar'))))"
/>
- <distsql-case id="alter-sharding-table-rule" value="ALTER SHARDING TABLE
RULE t_order
(DATANODES('ms_group_${0..1}'),DATABASE_STRATEGY(TYPE='standard',sharding_column
=
order_id,sharding_algorithm(type(name='database_inline'))),TABLE_STRATEGY(TYPE='standard',sharding_column
=
user_id,sharding_algorithm(type(name='table_inline'))),KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME='snowflake')))"
/>
- <distsql-case id="alter-sharding-table-rule-complex" value="ALTER SHARDING
TABLE RULE t_order
(DATANODES('ms_group_${0..1}'),DATABASE_STRATEGY(TYPE='complex',sharding_columns
= order_id,user_id,
sharding_algorithm(type(name='database_inline'))),TABLE_STRATEGY(TYPE='standard',sharding_column
=
user_id,sharding_algorithm(type(name='table_inline'))),KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME='snowflake')))"
/>
+ <distsql-case id="alter-sharding-table-rule" value="ALTER SHARDING TABLE
RULE t_order
(DATANODES('ms_group_${0..1}'),DATABASE_STRATEGY(TYPE='standard',sharding_column
=
order_id,sharding_algorithm(type(name='INLINE',PROPERTIES('algorithm-expression'='ms_group_${order_id
% 2}')))),TABLE_STRATEGY(TYPE='standard',sharding_column =
user_id,sharding_algorithm(type(name='INLINE',PROPERTIES('algorithm-expression'='t_order_${user_id
% 2}')))),KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME [...]
+ <distsql-case id="alter-sharding-table-rule-complex" value="ALTER SHARDING
TABLE RULE t_order
(DATANODES('ms_group_${0..1}_${0..1}.t_order_${0..1}'),DATABASE_STRATEGY(TYPE='complex',sharding_columns
= order_id,user_id,
sharding_algorithm(type(name='INLINE',PROPERTIES('algorithm-expression'='ms_group_${order_id
% 2}_${user_id % 2}')))),TABLE_STRATEGY(TYPE='standard',sharding_column =
user_id,sharding_algorithm(type(name='INLINE',PROPERTIES('algorithm-expression'='t_order_${user_id
% 2 [...]
<distsql-case id="alter-default-single-table" value="SET DEFAULT SINGLE
TABLE STORAGE UNIT = ds_0" />
<distsql-case id="alter-sharding-auditor" value="ALTER SHARDING AUDITOR
sharding_key_required_auditor(TYPE(NAME='DML_SHARDING_CONDITIONS'))" />
- <distsql-case id="alter-default-sharding-strategy" value="ALTER DEFAULT
SHARDING TABLE STRATEGY(TYPE='standard', SHARDING_COLUMN=order_id,
SHARDING_ALGORITHM(TYPE(NAME='INLINE')))" />
- <distsql-case id="alter-default-sharding-strategy-complex" value="ALTER
DEFAULT SHARDING TABLE STRATEGY(TYPE='complex',
SHARDING_COLUMNS=order_id,user_id, SHARDING_ALGORITHM(TYPE(NAME='INLINE')))" />
+ <distsql-case id="alter-default-sharding-strategy" value="ALTER DEFAULT
SHARDING TABLE STRATEGY(TYPE='standard', SHARDING_COLUMN=order_id,
SHARDING_ALGORITHM(TYPE(NAME='INLINE',PROPERTIES('algorithm-expression'='t_order_${order_id
% 2}'))))" />
+ <distsql-case id="alter-default-sharding-strategy-complex" value="ALTER
DEFAULT SHARDING TABLE STRATEGY(TYPE='complex',
SHARDING_COLUMNS=order_id,user_id,
SHARDING_ALGORITHM(TYPE(NAME='INLINE',PROPERTIES('algorithm-expression'='t_order_${order_id
% 2}_${user_id % 2}'))))" />
</sql-cases>
diff --git a/test/parser/src/main/resources/sql/supported/rdl/create.xml
b/test/parser/src/main/resources/sql/supported/rdl/create.xml
index aa8c6223895..78167fc1589 100644
--- a/test/parser/src/main/resources/sql/supported/rdl/create.xml
+++ b/test/parser/src/main/resources/sql/supported/rdl/create.xml
@@ -37,13 +37,13 @@
<distsql-case id="create-encrypt-rule" value="CREATE ENCRYPT RULE
t_encrypt (RESOURCE=ds_1,
COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))),
(NAME=order_id, CIPHER =order_cipher,TYPE(NAME='MD5'))))" />
<distsql-case id="create-encrypt-rule-with-assisted-query-column"
value="CREATE ENCRYPT RULE t_encrypt (RESOURCE=ds_1,
COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ASSISTED_QUERY_COLUMN=assisted_column,
TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc')), TYPE(NAME='MD5')),
(NAME=order_id, CIPHER =order_cipher,TYPE(NAME='MD5'))))" />
<distsql-case id="create-shadow-rule" value="CREATE SHADOW RULE
shadow_rule(SOURCE=demo_ds,SHADOW=demo_ds_shadow,t_order(TYPE(NAME='REGEX_MATCH',PROPERTIES('operation'='insert','column'='user_id','regex'='[1]')),TYPE(NAME='SIMPLE_HINT',PROPERTIES('shadow'='true','foo'='bar'))))"
/>
- <distsql-case id="create-default-sharding-table-strategy-with-lower-case"
value="create default sharding table strategy(type='standard',
sharding_column=order_id, SHARDING_ALGORITHM(TYPE(NAME='INLINE')))" />
- <distsql-case id="create-default-sharding-database-strategy" value="CREATE
DEFAULT SHARDING DATABASE STRATEGY(TYPE='STANDARD', SHARDING_COLUMN=ORDER_ID,
SHARDING_ALGORITHM(TYPE(NAME='INLINE')))" />
- <distsql-case id="create-default-sharding-strategy-complex" value="CREATE
DEFAULT SHARDING TABLE STRATEGY(TYPE='complex',
SHARDING_COLUMNS=order_id,user_id, SHARDING_ALGORITHM(TYPE(NAME='INLINE')))" />
- <distsql-case id="create-sharding-table-rule" value="CREATE SHARDING TABLE
RULE t_order
(DATANODES('ms_group_${0..1}'),DATABASE_STRATEGY(TYPE='standard',sharding_column
=
order_id,sharding_algorithm(type(name='INLINE'))),TABLE_STRATEGY(TYPE='standard',sharding_column
=
user_id,sharding_algorithm(type(name='INLINE'))),KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME='snowflake'))),t_order_item
(DATANODES('ms_group_${0..1}'),DATABASE_STRATEGY(TYPE='standard',sharding_column
= order_id [...]
- <distsql-case id="create-sharding-table-rule-with-enum-inline-expression"
value="CREATE SHARDING TABLE RULE t_order
(DATANODES("ms_group_${['abc','ac']}.table "
),DATABASE_STRATEGY(TYPE='standard',sharding_column =
order_id,sharding_algorithm(type(name='INLINE'))),TABLE_STRATEGY(TYPE='standard',sharding_column
=
user_id,sharding_algorithm(type(name='INLINE'))),KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME='snowflake'))),t_order_item
(DATANODES('ms_group_${0..1}'),DATABA [...]
- <distsql-case id="create-sharding-table-rule-complex" value="CREATE
SHARDING TABLE RULE t_order
(DATANODES('ms_group_${0..1}'),DATABASE_STRATEGY(TYPE='complex',sharding_columns
=
order_id,user_id,sharding_algorithm(type(name='INLINE'))),TABLE_STRATEGY(TYPE='standard',sharding_column
=
user_id,sharding_algorithm(type(name='INLINE'))),KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME='snowflake'))),t_order_item
(DATANODES('ms_group_${0..1}'),DATABASE_STRATEGY(TYPE='standard',sharding_c
[...]
- <distsql-case id="create-sharding-table-rule-with-auto-create-algorithm"
value="CREATE SHARDING TABLE RULE t_order
(DATANODES('ms_group_${0..1}'),DATABASE_STRATEGY(TYPE='standard',sharding_column
=
order_id,sharding_algorithm(TYPE(NAME='INLINE',PROPERTIES('algorithm-expression'='ms_group_${order_id%
2}')))),TABLE_STRATEGY(TYPE='standard',sharding_column =
user_id,sharding_algorithm(type(name='INLINE'))),KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME='snowflake')))"
/>
+ <distsql-case id="create-default-sharding-table-strategy-with-lower-case"
value="create default sharding table strategy(type='standard',
sharding_column=order_id,
SHARDING_ALGORITHM(TYPE(NAME='INLINE',PROPERTIES('algorithm-expression'='t_order_${order_id
% 2}'))))" />
+ <distsql-case id="create-default-sharding-database-strategy" value="CREATE
DEFAULT SHARDING DATABASE STRATEGY(TYPE='STANDARD', SHARDING_COLUMN=ORDER_ID,
SHARDING_ALGORITHM(TYPE(NAME='INLINE',PROPERTIES('algorithm-expression'='ms_group_${order_id
% 2}'))))" />
+ <distsql-case id="create-default-sharding-strategy-complex" value="CREATE
DEFAULT SHARDING TABLE STRATEGY(TYPE='complex',
SHARDING_COLUMNS=order_id,user_id,
SHARDING_ALGORITHM(TYPE(NAME='INLINE',PROPERTIES('algorithm-expression'='t_order_${user_id
% 2}_${order_id % 2}'))))" />
+ <distsql-case id="create-sharding-table-rule" value="CREATE SHARDING TABLE
RULE t_order
(DATANODES('ms_group_${0..1}'),DATABASE_STRATEGY(TYPE='standard',sharding_column
=
order_id,sharding_algorithm(type(name='INLINE',PROPERTIES('algorithm-expression'='ms_group_${order_id
% 2}')))),TABLE_STRATEGY(TYPE='standard',sharding_column =
user_id,sharding_algorithm(type(name='INLINE',PROPERTIES('algorithm-expression'='t_order_${user_id
% 2}')))),KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NA [...]
+ <distsql-case id="create-sharding-table-rule-with-enum-inline-expression"
value="CREATE SHARDING TABLE RULE t_order
(DATANODES("ms_group_${['abc','ac']}.t_order_${0..1}"),DATABASE_STRATEGY(TYPE='standard',sharding_column
=
order_name,sharding_algorithm(type(name='INLINE',PROPERTIES('algorithm-expression'='ms_group_{order_name}')))),TABLE_STRATEGY(TYPE='standard',sharding_column
=
user_id,sharding_algorithm(type(name='INLINE',PROPERTIES('algorithm-expression'='t_order_${user
[...]
+ <distsql-case id="create-sharding-table-rule-complex" value="CREATE
SHARDING TABLE RULE t_order
(DATANODES('ms_group_${0..1}_${0..1}.t_order_${0..1}'),DATABASE_STRATEGY(TYPE='complex',sharding_columns
=
order_id,user_id,sharding_algorithm(type(name='INLINE',PROPERTIES('algorithm-expression'='ms_group_${order_id
% 2}_${user_id % 2}')))),TABLE_STRATEGY(TYPE='standard',sharding_column =
user_id,sharding_algorithm(type(name='INLINE',PROPERTIES('algorithm-expression'='t_order_${user_id
% [...]
+ <distsql-case id="create-sharding-table-rule-with-auto-create-algorithm"
value="CREATE SHARDING TABLE RULE t_order
(DATANODES('ms_group_${0..1}.t_order_${0..1}'),DATABASE_STRATEGY(TYPE='standard',sharding_column
=
order_id,sharding_algorithm(TYPE(NAME='INLINE',PROPERTIES('algorithm-expression'='ms_group_${order_id
% 2}')))),TABLE_STRATEGY(TYPE='standard',sharding_column =
user_id,sharding_algorithm(type(name='INLINE',PROPERTIES('algorithm-expression'='t_order_${user_id
% 2}')))),KEY_ [...]
<distsql-case id="create-default-shadow-algorithm" value="CREATE DEFAULT
SHADOW ALGORITHM TYPE(NAME='HINT', PROPERTIES('shadow'='true', 'foo'='bar'))" />
<distsql-case id="create-default-single-table" value="SET DEFAULT SINGLE
TABLE STORAGE UNIT = ds_0" />
<distsql-case id="add-resource-with-quota" value="REGISTER STORAGE UNIT
`ds_0`(HOST='127.0.0.1',PORT=3306,DB='test0',USER='ROOT');" />