You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by tu...@apache.org on 2023/01/10 06:55:30 UTC

[shardingsphere] branch master updated: Add mask, encrypt and sharding integration test (#23456)

This is an automated email from the ASF dual-hosted git repository.

tuichenchuxin 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 10bd6d99cce Add mask, encrypt and sharding integration test (#23456)
10bd6d99cce is described below

commit 10bd6d99cceb765389a8225b19bc1541c4c33bf7
Author: gxxiong <xi...@foxmail.com>
AuthorDate: Tue Jan 10 14:55:23 2023 +0800

    Add mask, encrypt and sharding integration test (#23456)
---
 .github/workflows/e2e.yml                          |   2 +-
 .../cases/dql/dql-integration-test-cases.xml       |   8 +-
 .../suite/src/test/resources/env/it-env.properties |   4 +-
 .../scenario/mask_encrypt_sharding/authority.xml   |  79 ++++++++++
 .../data/actual/databases.xml                      |  30 ++++
 .../mask_encrypt_sharding/data/actual/dataset.xml  |  49 ++++++
 .../data/actual/init-sql/h2/01-actual-init.sql     |  19 +++
 .../data/actual/init-sql/mysql/01-actual-init.sql  |  52 ++++++
 .../actual/init-sql/opengauss/01-actual-init.sql   |  98 ++++++++++++
 .../data/actual/init-sql/oracle/01-actual-init.sql |  49 ++++++
 .../actual/init-sql/postgresql/01-actual-init.sql  |  98 ++++++++++++
 .../actual/init-sql/sqlserver/01-actual-init.sql   |  49 ++++++
 .../data/expected/databases.xml                    |  21 +++
 .../data/expected/dataset.xml                      |  47 ++++++
 .../data/expected/init-sql/h2/01-expected-init.sql |  20 +++
 .../expected/init-sql/mysql/01-expected-init.sql   |  24 +++
 .../init-sql/opengauss/01-expected-init.sql        |  27 ++++
 .../expected/init-sql/oracle/01-expected-init.sql  |  21 +++
 .../init-sql/postgresql/01-expected-init.sql       |  27 ++++
 .../init-sql/sqlserver/01-expected-init.sql        |  22 +++
 .../conf/mysql/config-mask-encrypt-sharding.yaml   | 174 +++++++++++++++++++++
 .../opengauss/config-mask-encrypt-sharding.yaml    | 174 +++++++++++++++++++++
 .../postgresql/config-mask-encrypt-sharding.yaml   | 174 +++++++++++++++++++++
 .../env/scenario/mask_encrypt_sharding/rules.yaml  |  80 ++++++++++
 24 files changed, 1341 insertions(+), 7 deletions(-)

diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml
index 34809d8bd71..ce262534514 100644
--- a/.github/workflows/e2e.yml
+++ b/.github/workflows/e2e.yml
@@ -175,7 +175,7 @@ jobs:
         adapter: [ proxy, jdbc ]
         mode: [ Standalone, Cluster ]
         database: [ MySQL, PostgreSQL, openGauss ]
-        scenario: [ dbtbl_with_readwrite_splitting, dbtbl_with_readwrite_splitting_and_encrypt, sharding_and_encrypt, encrypt_and_readwrite_splitting, encrypt_shadow, readwrite_splitting_and_shadow, sharding_and_shadow, sharding_encrypt_shadow, mask_encrypt, mask_sharding ]
+        scenario: [ dbtbl_with_readwrite_splitting, dbtbl_with_readwrite_splitting_and_encrypt, sharding_and_encrypt, encrypt_and_readwrite_splitting, encrypt_shadow, readwrite_splitting_and_shadow, sharding_and_shadow, sharding_encrypt_shadow, mask_encrypt, mask_sharding, mask_encrypt_sharding ]
         exclude:
           - adapter: jdbc
             mode: Cluster
diff --git a/test/e2e/suite/src/test/resources/cases/dql/dql-integration-test-cases.xml b/test/e2e/suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
index 2ff53fadb27..a7602f54530 100644
--- a/test/e2e/suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
+++ b/test/e2e/suite/src/test/resources/cases/dql/dql-integration-test-cases.xml
@@ -1291,19 +1291,19 @@
         <assertion parameters="foo:String" expected-data-source-name="expected_dataset" />
     </test-case>
     
-    <test-case sql="SELECT * FROM t_user ORDER BY user_id" db-types="MySQL,PostgreSQL,openGauss" scenario-types="mask,mask_encrypt,mask_sharding">
+    <test-case sql="SELECT * FROM t_user ORDER BY user_id" db-types="MySQL,PostgreSQL,openGauss" scenario-types="mask,mask_encrypt,mask_sharding,mask_encrypt_sharding">
         <assertion expected-data-source-name="expected_dataset" />
     </test-case>
     
-    <test-case sql="SELECT u1.* FROM t_user u1 INNER JOIN t_user u2 ON u1.user_id = u2.user_id ORDER BY user_id" db-types="MySQL,PostgreSQL,openGauss" scenario-types="mask,mask_encrypt,mask_sharding">
+    <test-case sql="SELECT u1.* FROM t_user u1 INNER JOIN t_user u2 ON u1.user_id = u2.user_id ORDER BY user_id" db-types="MySQL,PostgreSQL,openGauss" scenario-types="mask,mask_encrypt,mask_sharding,mask_encrypt_sharding">
         <assertion expected-data-source-name="expected_dataset" />
     </test-case>
     
-    <test-case sql="SELECT * FROM (SELECT * FROM t_user) temp ORDER BY user_id" db-types="MySQL,PostgreSQL,openGauss" scenario-types="mask,mask_encrypt,mask_sharding">
+    <test-case sql="SELECT * FROM (SELECT * FROM t_user) temp ORDER BY user_id" db-types="MySQL,PostgreSQL,openGauss" scenario-types="mask,mask_encrypt,mask_sharding,mask_encrypt_sharding">
         <assertion expected-data-source-name="expected_dataset" />
     </test-case>
     
-    <test-case sql="SELECT * FROM (SELECT u1.* FROM t_user u1 INNER JOIN t_user u2 ON u1.user_id = u2.user_id) temp ORDER BY user_id" db-types="MySQL,PostgreSQL,openGauss" scenario-types="mask,mask_encrypt,mask_sharding">
+    <test-case sql="SELECT * FROM (SELECT u1.* FROM t_user u1 INNER JOIN t_user u2 ON u1.user_id = u2.user_id) temp ORDER BY user_id" db-types="MySQL,PostgreSQL,openGauss" scenario-types="mask,mask_encrypt,mask_sharding,mask_encrypt_sharding">
         <assertion expected-data-source-name="expected_dataset" />
     </test-case>
 </integration-test-cases>
diff --git a/test/e2e/suite/src/test/resources/env/it-env.properties b/test/e2e/suite/src/test/resources/env/it-env.properties
index 38c4e0432cd..1318d6c31a4 100644
--- a/test/e2e/suite/src/test/resources/env/it-env.properties
+++ b/test/e2e/suite/src/test/resources/env/it-env.properties
@@ -19,8 +19,8 @@
 it.run.modes=
 it.run.additional.cases=false
 
-#it.scenarios=db,tbl,readwrite_splitting,encrypt,shadow,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,rdl_empty_rules,empty_rules,sharding_and_encrypt,encrypt_and_readwrite_splitting,encrypt_shadow,readwrite_splitting_and_shadow,sharding_and_shadow,sharding_encrypt_shadow,mask,mask_encrypt,mask_sharding
-it.scenarios=db,tbl,readwrite_splitting,encrypt,shadow,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,rdl_empty_rules,empty_rules,sharding_and_encrypt,encrypt_and_readwrite_splitting,encrypt_shadow,readwrite_splitting_and_shadow,sharding_and_shadow,sharding_encrypt_shadow,mask,mask_encrypt,mask_sharding
+#it.scenarios=db,tbl,readwrite_splitting,encrypt,shadow,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,rdl_empty_rules,empty_rules,sharding_and_encrypt,encrypt_and_readwrite_splitting,encrypt_shadow,readwrite_splitting_and_shadow,sharding_and_shadow,sharding_encrypt_shadow,mask,mask_encrypt,mask_sharding,mask_encrypt_sharding
+it.scenarios=db,tbl,readwrite_splitting,encrypt,shadow,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,rdl_empty_rules,empty_rules,sharding_and_encrypt,encrypt_and_readwrite_splitting,encrypt_shadow,readwrite_splitting_and_shadow,sharding_and_shadow,sharding_encrypt_shadow,mask,mask_encrypt,mask_sharding,mask_encrypt_sharding
 
 # it.cluster.env.type=DOCKER,NATIVE
 it.cluster.env.type=DOCKER
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/authority.xml b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/authority.xml
new file mode 100644
index 00000000000..1d4fecab638
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/authority.xml
@@ -0,0 +1,79 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<authority>
+    <sqlset db-types="Oracle,SQLServer,PostgreSQL,openGauss">
+        <user-create>
+            <sql>CREATE USER default_user</sql>
+            <sql>CREATE ROLE default_role</sql>
+            <sql>CREATE ROLE role2</sql>
+            <sql>CREATE ROLE role3</sql>
+            <sql>CREATE ROLE role4</sql>
+        </user-create>
+        <user-drop>
+            <sql>DROP ROLE IF EXISTS default_role</sql>
+            <sql>DROP ROLE IF EXISTS role_dev</sql>
+            <sql>DROP ROLE IF EXISTS role_dev_new</sql>
+            <sql>DROP ROLE IF EXISTS role2</sql>
+            <sql>DROP ROLE IF EXISTS role3</sql>
+            <sql>DROP ROLE IF EXISTS role4</sql>
+            <sql>DROP USER IF EXISTS user_dev</sql>
+            <sql>DROP USER IF EXISTS user_dev_new</sql>
+            <sql>DROP USER IF EXISTS default_user</sql>
+        </user-drop>
+    </sqlset>
+    <sqlset db-types="SQLServer">
+        <user-create>
+            <sql>CREATE LOGIN login_dev</sql>
+            <sql>CREATE USER user_dev FOR LOGIN login_dev</sql>
+        </user-create>
+        <user-drop>
+            <sql>DROP LOGIN IF EXISTS login_dev</sql>
+            <sql>DROP LOGIN IF EXISTS login_dev_new</sql>
+        </user-drop>
+    </sqlset>
+    <sqlset db-types="MySQL">
+        <user-create>
+            <sql>CREATE ROLE default_role</sql>
+            <sql>CREATE USER user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on mask_encrypt_ds_0.* to user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on mask_encrypt_ds_1.* to user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on mask_encrypt_ds_2.* to user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on mask_encrypt_ds_3.* to user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on mask_encrypt_ds_4.* to user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on mask_encrypt_ds_5.* to user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on mask_encrypt_ds_6.* to user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on mask_encrypt_ds_7.* to user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on mask_encrypt_ds_8.* to user_dev@localhost</sql>
+            <sql>GRANT select,update,insert,delete on mask_encrypt_ds_9.* to user_dev@localhost</sql>
+        </user-create>
+        <user-drop>
+            <sql>DROP USER IF EXISTS user_dev@localhost</sql>
+            <sql>DROP USER IF EXISTS user_dev_new@localhost</sql>
+            <sql>DROP USER IF EXISTS user_dev@127.0.0.1</sql>
+            <sql>DROP ROLE IF EXISTS default_role</sql>
+            <sql>DROP ROLE IF EXISTS role_dev</sql>
+            <sql>DROP ROLE IF EXISTS role_dev_new</sql>
+            <sql>FLUSH PRIVILEGES</sql>
+        </user-drop>
+    </sqlset>
+    <sqlset db-types="Oracle">
+        <user-create>
+            <sql>CREATE USER user_dev identified by passwd_dev</sql>
+        </user-create>
+    </sqlset>
+</authority>
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/databases.xml b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/databases.xml
new file mode 100644
index 00000000000..f0f27947e38
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/databases.xml
@@ -0,0 +1,30 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<databases>
+    <database>mask_encrypt_ds_0</database>
+    <database>mask_encrypt_ds_1</database>
+    <database>mask_encrypt_ds_2</database>
+    <database>mask_encrypt_ds_3</database>
+    <database>mask_encrypt_ds_4</database>
+    <database>mask_encrypt_ds_5</database>
+    <database>mask_encrypt_ds_6</database>
+    <database>mask_encrypt_ds_7</database>
+    <database>mask_encrypt_ds_8</database>
+    <database>mask_encrypt_ds_9</database>
+</databases>
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/dataset.xml b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/dataset.xml
new file mode 100644
index 00000000000..89f66395833
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/dataset.xml
@@ -0,0 +1,49 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<dataset>
+    <metadata data-nodes="mask_encrypt_ds_${0..9}.t_user">
+        <column name="user_id" type="numeric" />
+        <column name="user_name_cipher" type="varchar" />
+        <column name="user_name_plain" type="varchar" />
+        <column name="password_cipher" type="varchar" />
+        <column name="email_cipher" type="varchar" />
+        <column name="telephone_cipher" type="varchar" />
+        <column name="telephone_plain" type="varchar" />
+        <column name="creation_date" type="datetime" />
+    </metadata>
+    <row data-node="mask_encrypt_ds_0.t_user" values="10, sVq8Lmm+j6bZE5EKSilJEQ==, zhangsan, aQol0b6th65d0aXe+zFPsQ==, WM0fHOH91JNWnHTkiqBdyNmzk4uJ7CCz4mB1va9Ya1M=, kLjLJIMnfyHT2nA+viaoaQ==, 12345678900,  2017-08-08" />
+    <row data-node="mask_encrypt_ds_1.t_user" values="11, fQ7IzBxKVuNHtUF6h6WSBg==, lisi, wuhmEKgdgrWQYt+Ev0hgGA==, svATu3uWv9KfiloWJeWx3A==, 0kDFxndQdzauFwL/wyCsNQ==, 12345678901,  2017-08-08" />
+    <row data-node="mask_encrypt_ds_2.t_user" values="12, AQRWSlufQPog/b64YRhu6Q==, wangwu, x7A+2jq9B6DSOSFtSOibdA==, nHJv9e6NiClIuGHOjHLvCAq2ZLhWcqfQ8/EQnIqMx+g=, a/SzSJLapt5iBXvF2c9ycw==, 12345678902,  2017-08-08" />
+    <row data-node="mask_encrypt_ds_3.t_user" values="13, 5NqS4YvpT+mHBFqZOZ3QDA==, zhaoliu, zi6b4xYRjjV+bBk2R4wB+w==, MLBZczLjriUXvg3aM5QPTxMJbLjNh8yeNrSNBek/VTw=, b6VVhG+F6ujG8IMUZJAIFg==, 12345678903,  2017-08-08" />
+    <row data-node="mask_encrypt_ds_4.t_user" values="14, qeIY9od3u1KwhjihzLQUTQ==, zhuqi, 51UmlLAC+tUvdOAj8CjWfQ==, JCmeNdPyrKO5BW5zvhAA+g==, f995xinpZdKMVU5J5/yv3w==, 12345678904,  2017-08-08" />
+    <row data-node="mask_encrypt_ds_5.t_user" values="15, VbNUtguwtpeGhHGnPJ3aXg==, liba, +3/5CVbqoKhg3sqznKTFFQ==, T+X+e3Q3+ZNIXXmg/80uxg==, GETj+S6DrO042E7NuBXLBQ==, 12345678905,  2017-08-08" />
+    <row data-node="mask_encrypt_ds_6.t_user" values="16, U0/Ao/w1u7L5avR3fAH2Og==, wangjiu, jFfFMYxv02DjaFRuAoCDGw==, RNW/KRq5HeL2YTfAdXSyARMJbLjNh8yeNrSNBek/VTw=, +lbvjJwO7VO4HUKc0Mw0NA==, 12345678906,  2017-08-08" />
+    <row data-node="mask_encrypt_ds_7.t_user" values="17, zb1sgBigoMi7JPSoY4bAVw==, zhuda, VFIjocgjujJCJc6waWXqJA==, 1vF/ET3nBxt7T7vVfAndZQ==, wFvs5BH6OikgveBeTEBwsQ==, 12345678907,  2017-08-08" />
+    <row data-node="mask_encrypt_ds_8.t_user" values="18, rJzNIrFEnx296kW+N1YmMw==, suner, LaODSKGyR7vZ1IvmBOe9vA==, 5u4GIQkJsWRmnJHWaHNSjg==, uwqm2O1Lv2tNTraJX1ym7Q==, 12345678908,  2017-08-08" />
+    <row data-node="mask_encrypt_ds_9.t_user" values="19, qHwpQ9kteL8VX6iTUhNdbQ==, zhousan, MyOShk4kjRnds7CZfU5NCw==, HmYCo7QBfJ2E0EvaGHBCOBMJbLjNh8yeNrSNBek/VTw=, YLNQuuUPMGA21nhKWPzzsg==, 12345678909,  2017-08-08" />
+    <row data-node="mask_encrypt_ds_0.t_user" values="20, qCCmvf7OWRxbVbtLb0az1g==, tom, fzdTMkzpBvgNYmKSQAp8Fg==, gOoP4Mf0P4ISOJp6A4sRmg==, l4xa4HwOfs/jusoJon9Wzw==, 12345678910,  2017-08-08" />
+    <row data-node="mask_encrypt_ds_1.t_user" values="21, IYJ1COaRQ0gSjWMC/UAeMg==, kobe, 1uEDMeYh2jstbOf6kx/cqw==, tikMAFiQ37u2VgWqUT38Eg==, rGpr30UXfczXjCjdvPN+BA==, 12345678911,  2017-08-08" />
+    <row data-node="mask_encrypt_ds_2.t_user" values="22, 7wvZZ7NVHgk6m1vB/sTC1Q==, jerry, OirN3gvz9uBnrq88nfa1wQ==, T7K/Uz1O2m+3xvB0+c4nGQ==, 7+fCU+VbQZKgLJXZPTTegA==, 12345678912,  2017-08-08" />
+    <row data-node="mask_encrypt_ds_3.t_user" values="23, SbVQWl8JbnxflCfGJ7KZdA==, james, hWVVYdkdTUTgm08haeq+tw==, Uk3ju6GteCD1qEHns5ZhKA==, DpnV86FZefwBRmIAVBh2gg==, 12345678913,  2017-08-08" />
+    <row data-node="mask_encrypt_ds_4.t_user" values="24, fx7OfSAYqVpjNa7LoKhXvw==, wade, N2W9ijAXNkBxhkvJiIwp0A==, lAAGItVLmb1H69++1MDrIA==, QrE62wAb8B+2cEPcs4Lm1Q==, 12345678914,  2017-08-08" />
+    <row data-node="mask_encrypt_ds_5.t_user" values="25, wH3/LdWShD9aCb8eCIm3Tg==, rose, GDixtt6NzPOVv6H0dmov5g==, T1yfJSyVxumZUfkDnmUQxA==, iU+AsGczboCRfU+Zr7mcpw==, 12345678915,  2017-08-08" />
+    <row data-node="mask_encrypt_ds_6.t_user" values="26, GgJQTndbxyBZ2tECS8SmqQ==, bosh, gLgVFLFIyyKwdQCXaw78Ag==, O+JIn9XZ3yq6RnKElHuqlA==, kwYlbu9aF7ndvMTcj8QBSg==, 12345678916,  2017-08-08" />
+    <row data-node="mask_encrypt_ds_7.t_user" values="27, lv8w8g32kuTXNvSUUypOig==, jack, 8i0YH2mn6kXSyvBjM5p+Yg==, gqRoJF5S66SvBalc2RCo1A==, 2ob/3UYqRsZA5VdScnaWxQ==, 12345678917,  2017-08-08" />
+    <row data-node="mask_encrypt_ds_8.t_user" values="28, P9YCbFvWCIhcS99KyKH2zA==, jordan, PRrI4z4FrWwLvcHPx9g4og==, y8q31Jj4PFSyZHiLVIxKEQq2ZLhWcqfQ8/EQnIqMx+g=, kDF2za26uOerlNYWYHRT2Q==, 12345678918,  2017-08-08" />
+    <row data-node="mask_encrypt_ds_9.t_user" values="29, 5wu9XvlJAVtjKijhxt6SQQ==, julie, O4pgkLgz34N+C4bIUOQVnA==, UH7ihg16J61Np/EYMQnXIA==, z2hbJQD4dRkVVITNxAac5Q==, 12345678919,  2017-08-08" />
+</dataset>
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/init-sql/h2/01-actual-init.sql b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/init-sql/h2/01-actual-init.sql
new file mode 100644
index 00000000000..74e4060837d
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/init-sql/h2/01-actual-init.sql
@@ -0,0 +1,19 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/init-sql/mysql/01-actual-init.sql b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/init-sql/mysql/01-actual-init.sql
new file mode 100644
index 00000000000..35172188b98
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/init-sql/mysql/01-actual-init.sql
@@ -0,0 +1,52 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+SET character_set_database='utf8';
+SET character_set_server='utf8';
+
+DROP DATABASE IF EXISTS mask_encrypt_ds_0;
+DROP DATABASE IF EXISTS mask_encrypt_ds_1;
+DROP DATABASE IF EXISTS mask_encrypt_ds_2;
+DROP DATABASE IF EXISTS mask_encrypt_ds_3;
+DROP DATABASE IF EXISTS mask_encrypt_ds_4;
+DROP DATABASE IF EXISTS mask_encrypt_ds_5;
+DROP DATABASE IF EXISTS mask_encrypt_ds_6;
+DROP DATABASE IF EXISTS mask_encrypt_ds_7;
+DROP DATABASE IF EXISTS mask_encrypt_ds_8;
+DROP DATABASE IF EXISTS mask_encrypt_ds_9;
+
+CREATE DATABASE mask_encrypt_ds_0;
+CREATE DATABASE mask_encrypt_ds_1;
+CREATE DATABASE mask_encrypt_ds_2;
+CREATE DATABASE mask_encrypt_ds_3;
+CREATE DATABASE mask_encrypt_ds_4;
+CREATE DATABASE mask_encrypt_ds_5;
+CREATE DATABASE mask_encrypt_ds_6;
+CREATE DATABASE mask_encrypt_ds_7;
+CREATE DATABASE mask_encrypt_ds_8;
+CREATE DATABASE mask_encrypt_ds_9;
+
+CREATE TABLE mask_encrypt_ds_0.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_1.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_2.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_3.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_4.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_5.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_6.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_7.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_8.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_9.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/init-sql/opengauss/01-actual-init.sql b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/init-sql/opengauss/01-actual-init.sql
new file mode 100644
index 00000000000..363ecef08fd
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/init-sql/opengauss/01-actual-init.sql
@@ -0,0 +1,98 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+CREATE DATABASE mask_encrypt_ds_0;
+CREATE DATABASE mask_encrypt_ds_1;
+CREATE DATABASE mask_encrypt_ds_2;
+CREATE DATABASE mask_encrypt_ds_3;
+CREATE DATABASE mask_encrypt_ds_4;
+CREATE DATABASE mask_encrypt_ds_5;
+CREATE DATABASE mask_encrypt_ds_6;
+CREATE DATABASE mask_encrypt_ds_7;
+CREATE DATABASE mask_encrypt_ds_8;
+CREATE DATABASE mask_encrypt_ds_9;
+
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt_ds_0 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt_ds_1 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt_ds_2 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt_ds_3 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt_ds_4 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt_ds_5 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt_ds_6 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt_ds_7 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt_ds_8 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt_ds_9 TO test_user;
+
+\c mask_encrypt_ds_0
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+
+\c mask_encrypt_ds_1
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+
+\c mask_encrypt_ds_2
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+
+\c mask_encrypt_ds_3
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+
+\c mask_encrypt_ds_4
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+
+\c mask_encrypt_ds_5
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+
+\c mask_encrypt_ds_6
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+
+\c mask_encrypt_ds_7
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+
+\c mask_encrypt_ds_8
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+
+\c mask_encrypt_ds_9
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/init-sql/oracle/01-actual-init.sql b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/init-sql/oracle/01-actual-init.sql
new file mode 100644
index 00000000000..8dc647b4654
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/init-sql/oracle/01-actual-init.sql
@@ -0,0 +1,49 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+DROP SCHEMA mask_encrypt_ds_0;
+DROP SCHEMA mask_encrypt_ds_1;
+DROP SCHEMA mask_encrypt_ds_2;
+DROP SCHEMA mask_encrypt_ds_3;
+DROP SCHEMA mask_encrypt_ds_4;
+DROP SCHEMA mask_encrypt_ds_5;
+DROP SCHEMA mask_encrypt_ds_6;
+DROP SCHEMA mask_encrypt_ds_7;
+DROP SCHEMA mask_encrypt_ds_8;
+DROP SCHEMA mask_encrypt_ds_9;
+
+CREATE SCHEMA mask_encrypt_ds_0;
+CREATE SCHEMA mask_encrypt_ds_1;
+CREATE SCHEMA mask_encrypt_ds_2;
+CREATE SCHEMA mask_encrypt_ds_3;
+CREATE SCHEMA mask_encrypt_ds_4;
+CREATE SCHEMA mask_encrypt_ds_5;
+CREATE SCHEMA mask_encrypt_ds_6;
+CREATE SCHEMA mask_encrypt_ds_7;
+CREATE SCHEMA mask_encrypt_ds_8;
+CREATE SCHEMA mask_encrypt_ds_9;
+
+CREATE TABLE mask_encrypt_ds_0.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_1.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_2.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_3.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_4.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_5.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_6.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_7.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_8.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_9.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/init-sql/postgresql/01-actual-init.sql b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/init-sql/postgresql/01-actual-init.sql
new file mode 100644
index 00000000000..363ecef08fd
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/init-sql/postgresql/01-actual-init.sql
@@ -0,0 +1,98 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+CREATE DATABASE mask_encrypt_ds_0;
+CREATE DATABASE mask_encrypt_ds_1;
+CREATE DATABASE mask_encrypt_ds_2;
+CREATE DATABASE mask_encrypt_ds_3;
+CREATE DATABASE mask_encrypt_ds_4;
+CREATE DATABASE mask_encrypt_ds_5;
+CREATE DATABASE mask_encrypt_ds_6;
+CREATE DATABASE mask_encrypt_ds_7;
+CREATE DATABASE mask_encrypt_ds_8;
+CREATE DATABASE mask_encrypt_ds_9;
+
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt_ds_0 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt_ds_1 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt_ds_2 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt_ds_3 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt_ds_4 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt_ds_5 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt_ds_6 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt_ds_7 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt_ds_8 TO test_user;
+GRANT ALL PRIVILEGES ON DATABASE mask_encrypt_ds_9 TO test_user;
+
+\c mask_encrypt_ds_0
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+
+\c mask_encrypt_ds_1
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+
+\c mask_encrypt_ds_2
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+
+\c mask_encrypt_ds_3
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+
+\c mask_encrypt_ds_4
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+
+\c mask_encrypt_ds_5
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+
+\c mask_encrypt_ds_6
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+
+\c mask_encrypt_ds_7
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+
+\c mask_encrypt_ds_8
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+
+\c mask_encrypt_ds_9
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/init-sql/sqlserver/01-actual-init.sql b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/init-sql/sqlserver/01-actual-init.sql
new file mode 100644
index 00000000000..2f51ab5335b
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/actual/init-sql/sqlserver/01-actual-init.sql
@@ -0,0 +1,49 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+DROP DATABASE IF EXISTS mask_encrypt_ds_0;
+DROP DATABASE IF EXISTS mask_encrypt_ds_1;
+DROP DATABASE IF EXISTS mask_encrypt_ds_2;
+DROP DATABASE IF EXISTS mask_encrypt_ds_3;
+DROP DATABASE IF EXISTS mask_encrypt_ds_4;
+DROP DATABASE IF EXISTS mask_encrypt_ds_5;
+DROP DATABASE IF EXISTS mask_encrypt_ds_6;
+DROP DATABASE IF EXISTS mask_encrypt_ds_7;
+DROP DATABASE IF EXISTS mask_encrypt_ds_8;
+DROP DATABASE IF EXISTS mask_encrypt_ds_9;
+
+CREATE DATABASE mask_encrypt_ds_0;
+CREATE DATABASE mask_encrypt_ds_1;
+CREATE DATABASE mask_encrypt_ds_2;
+CREATE DATABASE mask_encrypt_ds_3;
+CREATE DATABASE mask_encrypt_ds_4;
+CREATE DATABASE mask_encrypt_ds_5;
+CREATE DATABASE mask_encrypt_ds_6;
+CREATE DATABASE mask_encrypt_ds_7;
+CREATE DATABASE mask_encrypt_ds_8;
+CREATE DATABASE mask_encrypt_ds_9;
+
+CREATE TABLE mask_encrypt_ds_0.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_1.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_2.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_3.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_4.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_5.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_6.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_7.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_8.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
+CREATE TABLE mask_encrypt_ds_9.t_user (user_id INT PRIMARY KEY, user_name_cipher VARCHAR(50) NOT NULL, user_name_plain VARCHAR(50) NOT NULL, password_cipher VARCHAR(50) NOT NULL, email_cipher VARCHAR(50) NOT NULL, telephone_cipher CHAR(50) NOT NULL, telephone_plain CHAR(11) NOT NULL, creation_date DATE NOT NULL);
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/databases.xml b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/databases.xml
new file mode 100644
index 00000000000..9e98dc8baea
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/databases.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<databases>
+    <database>expected_dataset</database>
+</databases>
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/dataset.xml b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/dataset.xml
new file mode 100644
index 00000000000..1901d4dcb81
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/dataset.xml
@@ -0,0 +1,47 @@
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<dataset>
+    <metadata data-nodes="expected_dataset.t_user">
+        <column name="user_id" type="numeric" />
+        <column name="user_name" type="varchar" />
+        <column name="password" type="varchar" />
+        <column name="email" type="varchar" />
+        <column name="telephone" type="varchar" />
+        <column name="creation_date" type="datetime" />
+    </metadata>
+    <row data-node="expected_dataset.t_user" values="10, zhangsan, 96e79218965eb72c92a549dd5a330112, ********@gmail.com, 123****8900, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="11, lisi, e3ceb5881a0a1fdaad01296d7554868d, ****@gmail.com, 123****8901, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="12, wangwu, 1a100d2c0dab19c4430e7d73762b3423, ******@gmail.com, 123****8902, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="13, zhaoliu, 73882ab1fa529d7273da0db6b49cc4f3, *******@gmail.com, 123****8903, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="14, zhuqi, 5b1b68a9abf4d2cd155c81a9225fd158, *****@gmail.com, 123****8904, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="15, liba, f379eaf3c831b04de153469d1bec345e, ****@gmail.com, 123****8905, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="16, wangjiu, f63f4fbc9f8c85d409f2f59f2b9e12d5, *******@gmail.com, 123****8906, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="17, zhuda, 21218cca77804d2ba1922c33e0151105, *****@gmail.com, 123****8907, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="18, suner, 52c69e3a57331081823331c4e69d3f2e, *****@gmail.com, 123****8908, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="19, zhousan, e10adc3949ba59abbe56e057f20f883e, *******@gmail.com, 123****8909, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="20, tom, 508df4cb2f4d8f80519256258cfb975f, ***@gmail.com, 123****8910, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="21, kobe, 5bd2026f128662763c532f2f4b6f2476, ****@gmail.com, 123****8911, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="22, jerry, e35cf7b66449df565f93c607d5a81d09, *****@gmail.com, 123****8912, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="23, james, ba00819f263287af1ff0100c5a323355, *****@gmail.com, 123****8913, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="24, wade, d6a9a933c8aafc51e55ac0662b6e4d4a, ****@gmail.com, 123****8914, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="25, rose, 670b14728ad9902aecba32e22fa4f6bd, ****@gmail.com, 123****8915, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="26, bosh, 00b7691d86d96aebd21dd9e138f90840, ****@gmail.com, 123****8916, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="27, jack, 731982a033a5cc815ac03c8504abb748, ****@gmail.com, 123****8917, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="28, jordan, abf156f3cf64496f9da2cabca68d95fe, ******@gmail.com, 123****8918, 2017-08-08" />
+    <row data-node="expected_dataset.t_user" values="29, julie, 01c401bb1b2ba502df5a854be02ea4e9, *****@gmail.com, 123****8919, 2017-08-08" />
+</dataset>
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/init-sql/h2/01-expected-init.sql b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/init-sql/h2/01-expected-init.sql
new file mode 100644
index 00000000000..7472146bbf1
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/init-sql/h2/01-expected-init.sql
@@ -0,0 +1,20 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name VARCHAR(50) NOT NULL, password VARCHAR(50) NOT NULL, email VARCHAR(50) NOT NULL, telephone CHAR(11) NOT NULL, creation_date DATE NOT NULL);
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/init-sql/mysql/01-expected-init.sql b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/init-sql/mysql/01-expected-init.sql
new file mode 100644
index 00000000000..94097717509
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/init-sql/mysql/01-expected-init.sql
@@ -0,0 +1,24 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+SET character_set_database='utf8';
+SET character_set_server='utf8';
+
+DROP DATABASE IF EXISTS expected_dataset;
+CREATE DATABASE expected_dataset;
+
+CREATE TABLE expected_dataset.t_user (user_id INT PRIMARY KEY, user_name VARCHAR(50) NOT NULL, password VARCHAR(50) NOT NULL, email VARCHAR(50) NOT NULL, telephone CHAR(11) NOT NULL, creation_date DATE NOT NULL);
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/init-sql/opengauss/01-expected-init.sql b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/init-sql/opengauss/01-expected-init.sql
new file mode 100644
index 00000000000..0ee0a77b33d
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/init-sql/opengauss/01-expected-init.sql
@@ -0,0 +1,27 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+DROP DATABASE IF EXISTS expected_dataset;
+CREATE DATABASE expected_dataset;
+
+GRANT ALL PRIVILEGES ON DATABASE expected_dataset TO test_user;
+
+\c expected_dataset;
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name VARCHAR(50) NOT NULL, password VARCHAR(50) NOT NULL, email VARCHAR(50) NOT NULL, telephone CHAR(11) NOT NULL, creation_date DATE NOT NULL);
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/init-sql/oracle/01-expected-init.sql b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/init-sql/oracle/01-expected-init.sql
new file mode 100644
index 00000000000..15ffd3ab47a
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/init-sql/oracle/01-expected-init.sql
@@ -0,0 +1,21 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+DROP SCHEMA expected_dataset;
+CREATE SCHEMA expected_dataset;
+
+CREATE TABLE expected_dataset.t_user (user_id INT PRIMARY KEY, user_name VARCHAR(50) NOT NULL, password VARCHAR(50) NOT NULL, email VARCHAR(50) NOT NULL, telephone CHAR(11) NOT NULL, creation_date DATE NOT NULL);
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/init-sql/postgresql/01-expected-init.sql b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/init-sql/postgresql/01-expected-init.sql
new file mode 100644
index 00000000000..0ee0a77b33d
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/init-sql/postgresql/01-expected-init.sql
@@ -0,0 +1,27 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+DROP DATABASE IF EXISTS expected_dataset;
+CREATE DATABASE expected_dataset;
+
+GRANT ALL PRIVILEGES ON DATABASE expected_dataset TO test_user;
+
+\c expected_dataset;
+
+DROP TABLE IF EXISTS t_user;
+
+CREATE TABLE t_user (user_id INT PRIMARY KEY, user_name VARCHAR(50) NOT NULL, password VARCHAR(50) NOT NULL, email VARCHAR(50) NOT NULL, telephone CHAR(11) NOT NULL, creation_date DATE NOT NULL);
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/init-sql/sqlserver/01-expected-init.sql b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/init-sql/sqlserver/01-expected-init.sql
new file mode 100644
index 00000000000..8cbad8ae180
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/data/expected/init-sql/sqlserver/01-expected-init.sql
@@ -0,0 +1,22 @@
+--
+-- Licensed to the Apache Software Foundation (ASF) under one or more
+-- contributor license agreements.  See the NOTICE file distributed with
+-- this work for additional information regarding copyright ownership.
+-- The ASF licenses this file to You under the Apache License, Version 2.0
+-- (the "License"); you may not use this file except in compliance with
+-- the License.  You may obtain a copy of the License at
+--
+--     http://www.apache.org/licenses/LICENSE-2.0
+--
+-- Unless required by applicable law or agreed to in writing, software
+-- distributed under the License is distributed on an "AS IS" BASIS,
+-- WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+-- See the License for the specific language governing permissions and
+-- limitations under the License.
+--
+
+DROP DATABASE IF EXISTS expected_dataset;
+
+CREATE DATABASE expected_dataset;
+
+CREATE TABLE expected_dataset.t_user (user_id INT PRIMARY KEY, user_name VARCHAR(50) NOT NULL, password VARCHAR(50) NOT NULL, email VARCHAR(50) NOT NULL, telephone CHAR(11) NOT NULL, creation_date DATE NOT NULL);
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/mysql/config-mask-encrypt-sharding.yaml b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/mysql/config-mask-encrypt-sharding.yaml
new file mode 100644
index 00000000000..4263858fc6a
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/mysql/config-mask-encrypt-sharding.yaml
@@ -0,0 +1,174 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+databaseName: mask_encrypt_sharding
+
+dataSources:
+  mask_encrypt_ds_0:
+    url: jdbc:mysql://mysql.mask_encrypt_sharding.host:3306/mask_encrypt_ds_0?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_1:
+    url: jdbc:mysql://mysql.mask_encrypt_sharding.host:3306/mask_encrypt_ds_1?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_2:
+    url: jdbc:mysql://mysql.mask_encrypt_sharding.host:3306/mask_encrypt_ds_2?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_3:
+    url: jdbc:mysql://mysql.mask_encrypt_sharding.host:3306/mask_encrypt_ds_3?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_4:
+    url: jdbc:mysql://mysql.mask_encrypt_sharding.host:3306/mask_encrypt_ds_4?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_5:
+    url: jdbc:mysql://mysql.mask_encrypt_sharding.host:3306/mask_encrypt_ds_5?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_6:
+    url: jdbc:mysql://mysql.mask_encrypt_sharding.host:3306/mask_encrypt_ds_6?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_7:
+    url: jdbc:mysql://mysql.mask_encrypt_sharding.host:3306/mask_encrypt_ds_7?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_8:
+    url: jdbc:mysql://mysql.mask_encrypt_sharding.host:3306/mask_encrypt_ds_8?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_9:
+    url: jdbc:mysql://mysql.mask_encrypt_sharding.host:3306/mask_encrypt_ds_9?serverTimezone=UTC&useSSL=false&characterEncoding=utf-8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+
+rules:
+- !MASK
+  maskAlgorithms:
+    md5_mask:
+      type: MD5
+    mask_before_special_chars_mask:
+      type: MASK_BEFORE_SPECIAL_CHARS
+      props:
+        special-chars: '@'
+        replace-char: '*'
+    keep_first_n_last_m_mask:
+      type: KEEP_FIRST_N_LAST_M
+      props:
+        first-n: 3
+        last-m: 4
+        replace-char: '*'
+  tables:
+    t_user:
+      columns:
+        password:
+          maskAlgorithm: md5_mask
+        email:
+          maskAlgorithm: mask_before_special_chars_mask
+        telephone:
+          maskAlgorithm: keep_first_n_last_m_mask
+- !ENCRYPT
+  encryptors:
+    aes_encryptor:
+      type: AES
+      props:
+        aes-key-value: 123456abc
+  tables:
+    t_user:
+      columns:
+        user_name:
+          plainColumn: user_name_plain
+          cipherColumn: user_name_cipher
+          encryptorName: aes_encryptor
+        password:
+          cipherColumn: password_cipher
+          encryptorName: aes_encryptor
+        email:
+          cipherColumn: email_cipher
+          encryptorName: aes_encryptor
+        telephone:
+          plainColumn: telephone_plain
+          cipherColumn: telephone_cipher
+          encryptorName: aes_encryptor
+- !SHARDING
+  tables:
+    t_user:
+      actualDataNodes: mask_encrypt_ds_${0..9}.t_user
+  defaultDatabaseStrategy:
+    standard:
+      shardingColumn: user_id
+      shardingAlgorithmName: database_inline
+  defaultTableStrategy:
+    none:
+  shardingAlgorithms:
+    database_inline:
+      type: INLINE
+      props:
+        algorithm-expression: mask_encrypt_ds_${user_id % 10}
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/opengauss/config-mask-encrypt-sharding.yaml b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/opengauss/config-mask-encrypt-sharding.yaml
new file mode 100644
index 00000000000..fbad2a14843
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/opengauss/config-mask-encrypt-sharding.yaml
@@ -0,0 +1,174 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+databaseName: mask_encrypt_sharding
+
+dataSources:
+  mask_encrypt_ds_0:
+    url: jdbc:opengauss://opengauss.mask_encrypt_sharding.host:5432/mask_encrypt_ds_0
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_1:
+    url: jdbc:opengauss://opengauss.mask_encrypt_sharding.host:5432/mask_encrypt_ds_1
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_2:
+    url: jdbc:opengauss://opengauss.mask_encrypt_sharding.host:5432/mask_encrypt_ds_2
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_3:
+    url: jdbc:opengauss://opengauss.mask_encrypt_sharding.host:5432/mask_encrypt_ds_3
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_4:
+    url: jdbc:opengauss://opengauss.mask_encrypt_sharding.host:5432/mask_encrypt_ds_4
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_5:
+    url: jdbc:opengauss://opengauss.mask_encrypt_sharding.host:5432/mask_encrypt_ds_5
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_6:
+    url: jdbc:opengauss://opengauss.mask_encrypt_sharding.host:5432/mask_encrypt_ds_6
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_7:
+    url: jdbc:opengauss://opengauss.mask_encrypt_sharding.host:5432/mask_encrypt_ds_7
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_8:
+    url: jdbc:opengauss://opengauss.mask_encrypt_sharding.host:5432/mask_encrypt_ds_8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_9:
+    url: jdbc:opengauss://opengauss.mask_encrypt_sharding.host:5432/mask_encrypt_ds_9
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+
+rules:
+- !MASK
+  maskAlgorithms:
+    md5_mask:
+      type: MD5
+    mask_before_special_chars_mask:
+      type: MASK_BEFORE_SPECIAL_CHARS
+      props:
+        special-chars: '@'
+        replace-char: '*'
+    keep_first_n_last_m_mask:
+      type: KEEP_FIRST_N_LAST_M
+      props:
+        first-n: 3
+        last-m: 4
+        replace-char: '*'
+  tables:
+    t_user:
+      columns:
+        password:
+          maskAlgorithm: md5_mask
+        email:
+          maskAlgorithm: mask_before_special_chars_mask
+        telephone:
+          maskAlgorithm: keep_first_n_last_m_mask
+- !ENCRYPT
+  encryptors:
+    aes_encryptor:
+      type: AES
+      props:
+        aes-key-value: 123456abc
+  tables:
+    t_user:
+      columns:
+        user_name:
+          plainColumn: user_name_plain
+          cipherColumn: user_name_cipher
+          encryptorName: aes_encryptor
+        password:
+          cipherColumn: password_cipher
+          encryptorName: aes_encryptor
+        email:
+          cipherColumn: email_cipher
+          encryptorName: aes_encryptor
+        telephone:
+          plainColumn: telephone_plain
+          cipherColumn: telephone_cipher
+          encryptorName: aes_encryptor
+- !SHARDING
+  tables:
+    t_user:
+      actualDataNodes: mask_encrypt_ds_${0..9}.t_user
+  defaultDatabaseStrategy:
+    standard:
+      shardingColumn: user_id
+      shardingAlgorithmName: database_inline
+  defaultTableStrategy:
+    none:
+  shardingAlgorithms:
+    database_inline:
+      type: INLINE
+      props:
+        algorithm-expression: mask_encrypt_ds_${user_id % 10}
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/postgresql/config-mask-encrypt-sharding.yaml b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/postgresql/config-mask-encrypt-sharding.yaml
new file mode 100644
index 00000000000..b73f8c1c283
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/proxy/conf/postgresql/config-mask-encrypt-sharding.yaml
@@ -0,0 +1,174 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+databaseName: mask_encrypt_sharding
+
+dataSources:
+  mask_encrypt_ds_0:
+    url: jdbc:postgresql://postgresql.mask_encrypt_sharding.host:5432/mask_encrypt_ds_0
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_1:
+    url: jdbc:postgresql://postgresql.mask_encrypt_sharding.host:5432/mask_encrypt_ds_1
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_2:
+    url: jdbc:postgresql://postgresql.mask_encrypt_sharding.host:5432/mask_encrypt_ds_2
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_3:
+    url: jdbc:postgresql://postgresql.mask_encrypt_sharding.host:5432/mask_encrypt_ds_3
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_4:
+    url: jdbc:postgresql://postgresql.mask_encrypt_sharding.host:5432/mask_encrypt_ds_4
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_5:
+    url: jdbc:postgresql://postgresql.mask_encrypt_sharding.host:5432/mask_encrypt_ds_5
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_6:
+    url: jdbc:postgresql://postgresql.mask_encrypt_sharding.host:5432/mask_encrypt_ds_6
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_7:
+    url: jdbc:postgresql://postgresql.mask_encrypt_sharding.host:5432/mask_encrypt_ds_7
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_8:
+    url: jdbc:postgresql://postgresql.mask_encrypt_sharding.host:5432/mask_encrypt_ds_8
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+  mask_encrypt_ds_9:
+    url: jdbc:postgresql://postgresql.mask_encrypt_sharding.host:5432/mask_encrypt_ds_9
+    username: test_user
+    password: Test@123
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 2
+    minPoolSize: 2
+
+rules:
+- !MASK
+  maskAlgorithms:
+    md5_mask:
+      type: MD5
+    mask_before_special_chars_mask:
+      type: MASK_BEFORE_SPECIAL_CHARS
+      props:
+        special-chars: '@'
+        replace-char: '*'
+    keep_first_n_last_m_mask:
+      type: KEEP_FIRST_N_LAST_M
+      props:
+        first-n: 3
+        last-m: 4
+        replace-char: '*'
+  tables:
+    t_user:
+      columns:
+        password:
+          maskAlgorithm: md5_mask
+        email:
+          maskAlgorithm: mask_before_special_chars_mask
+        telephone:
+          maskAlgorithm: keep_first_n_last_m_mask
+- !ENCRYPT
+  encryptors:
+    aes_encryptor:
+      type: AES
+      props:
+        aes-key-value: 123456abc
+  tables:
+    t_user:
+      columns:
+        user_name:
+          plainColumn: user_name_plain
+          cipherColumn: user_name_cipher
+          encryptorName: aes_encryptor
+        password:
+          cipherColumn: password_cipher
+          encryptorName: aes_encryptor
+        email:
+          cipherColumn: email_cipher
+          encryptorName: aes_encryptor
+        telephone:
+          plainColumn: telephone_plain
+          cipherColumn: telephone_cipher
+          encryptorName: aes_encryptor
+- !SHARDING
+  tables:
+    t_user:
+      actualDataNodes: mask_encrypt_ds_${0..9}.t_user
+  defaultDatabaseStrategy:
+    standard:
+      shardingColumn: user_id
+      shardingAlgorithmName: database_inline
+  defaultTableStrategy:
+    none:
+  shardingAlgorithms:
+    database_inline:
+      type: INLINE
+      props:
+        algorithm-expression: mask_encrypt_ds_${user_id % 10}
diff --git a/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/rules.yaml b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/rules.yaml
new file mode 100644
index 00000000000..cdff571c586
--- /dev/null
+++ b/test/e2e/suite/src/test/resources/env/scenario/mask_encrypt_sharding/rules.yaml
@@ -0,0 +1,80 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+rules:
+- !MASK
+  maskAlgorithms:
+    md5_mask:
+      type: MD5
+    mask_before_special_chars_mask:
+      type: MASK_BEFORE_SPECIAL_CHARS
+      props:
+        special-chars: '@'
+        replace-char: '*'
+    keep_first_n_last_m_mask:
+      type: KEEP_FIRST_N_LAST_M
+      props:
+        first-n: 3
+        last-m: 4
+        replace-char: '*'
+  tables:
+    t_user:
+      columns:
+        password:
+          maskAlgorithm: md5_mask
+        email:
+          maskAlgorithm: mask_before_special_chars_mask
+        telephone:
+          maskAlgorithm: keep_first_n_last_m_mask
+- !ENCRYPT
+  encryptors:
+    aes_encryptor:
+      type: AES
+      props:
+        aes-key-value: 123456abc
+  tables:
+    t_user:
+      columns:
+        user_name:
+          plainColumn: user_name_plain
+          cipherColumn: user_name_cipher
+          encryptorName: aes_encryptor
+        password:
+          cipherColumn: password_cipher
+          encryptorName: aes_encryptor
+        email:
+          cipherColumn: email_cipher
+          encryptorName: aes_encryptor
+        telephone:
+          plainColumn: telephone_plain
+          cipherColumn: telephone_cipher
+          encryptorName: aes_encryptor
+- !SHARDING
+  tables:
+    t_user:
+      actualDataNodes: mask_encrypt_ds_${0..9}.t_user
+  defaultDatabaseStrategy:
+    standard:
+      shardingColumn: user_id
+      shardingAlgorithmName: database_inline
+  defaultTableStrategy:
+    none:
+  shardingAlgorithms:
+    database_inline:
+      type: INLINE
+      props:
+        algorithm-expression: mask_encrypt_ds_${user_id % 10}