You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ji...@apache.org on 2022/11/28 05:37:12 UTC

[shardingsphere] branch master updated: ConvertYamlConfigurationHandler supports auto-tables rules. (#22462)

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

jianglongtao 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 38f7e459c83 ConvertYamlConfigurationHandler supports auto-tables rules. (#22462)
38f7e459c83 is described below

commit 38f7e459c83144a8c0c72e5e885ec1d32df693ce
Author: yx9o <ya...@163.com>
AuthorDate: Mon Nov 28 13:37:05 2022 +0800

    ConvertYamlConfigurationHandler supports auto-tables rules. (#22462)
    
    * ConvertYamlConfigurationHandler supports auto-tables rules.
    
    * Update.
---
 .../common/constant/DistSQLScriptConstants.java    | 26 +++---
 .../queryable/ConvertYamlConfigurationHandler.java | 93 ++++++++++++++++------
 .../ConvertYamlConfigurationHandlerTest.java       |  9 +++
 .../resources/conf/convert/config-resource.yaml    | 56 -------------
 .../conf/convert/config-sharding-auto-tables.yaml  | 78 ++++++++++++++++++
 .../expected/convert-sharding-auto-tables.yaml     | 47 +++++++++++
 .../ConvertYamlConfigurationStatementAssert.java   |  3 +-
 .../src/main/resources/case/ral/queryable.xml      |  2 +-
 .../main/resources/sql/supported/ral/queryable.xml |  2 +-
 9 files changed, 222 insertions(+), 94 deletions(-)

diff --git a/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/constant/DistSQLScriptConstants.java b/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/constant/DistSQLScriptConstants.java
index ab030cbe6b2..0e9a51796df 100644
--- a/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/constant/DistSQLScriptConstants.java
+++ b/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/common/constant/DistSQLScriptConstants.java
@@ -75,12 +75,22 @@ public final class DistSQLScriptConstants {
     
     public static final String SHARDING_TABLE = " %s ("
             + System.lineSeparator()
-            + "DATANODES('%s'),"
+            + "DATANODES('%s')%s"
+            + System.lineSeparator()
+            + ")";
+    
+    public static final String SHARDING_AUTO_TABLE = " %s ("
+            + System.lineSeparator()
+            + "STORAGE_UNITS(%s),"
             + System.lineSeparator()
             + "%s"
             + System.lineSeparator()
             + ")";
     
+    public static final String AUTO_TABLE_STRATEGY = "SHARDING_COLUMN=%s,"
+            + System.lineSeparator()
+            + "%s";
+    
     public static final String DATABASE_STRATEGY = "DATABASE_STRATEGY";
     
     public static final String TABLE_STRATEGY = "TABLE_STRATEGY";
@@ -91,19 +101,13 @@ public final class DistSQLScriptConstants {
     
     public static final String STRATEGY_HINT = "TYPE='%s', SHARDING_ALGORITHM(%s)";
     
-    public static final String SHARDING_STRATEGY_STANDARD = "%s(" + STRATEGY_STANDARD + ")," + System.lineSeparator();
-    
-    public static final String SHARDING_STRATEGY_COMPLEX = "%s(" + STRATEGY_COMPLEX + ")," + System.lineSeparator();
+    public static final String SHARDING_STRATEGY_STANDARD = "%s(" + STRATEGY_STANDARD + ")";
     
-    public static final String SHARDING_STRATEGY_HINT = "%s(" + STRATEGY_HINT + ")," + System.lineSeparator();
+    public static final String SHARDING_STRATEGY_COMPLEX = "%s(" + STRATEGY_COMPLEX + ")";
     
-    public static final String KEY_GENERATOR_STRATEGY = "KEY_GENERATE_STRATEGY(COLUMN=%s, %s)," + System.lineSeparator();
+    public static final String SHARDING_STRATEGY_HINT = "%s(" + STRATEGY_HINT + ")";
     
-    public static final String KEY_GENERATOR = " %s ("
-            + System.lineSeparator()
-            + "%s"
-            + System.lineSeparator()
-            + ")";
+    public static final String KEY_GENERATOR_STRATEGY = "KEY_GENERATE_STRATEGY(COLUMN=%s, %s)";
     
     public static final String SHARDING_BINDING_TABLE_RULES = "CREATE SHARDING TABLE REFERENCE RULE";
     
diff --git a/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationHandler.java b/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationHandler.java
index abdab29b287..cafb59507f6 100644
--- a/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationHandler.java
+++ b/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationHandler.java
@@ -58,6 +58,7 @@ import org.apache.shardingsphere.shadow.api.config.table.ShadowTableConfiguratio
 import org.apache.shardingsphere.shadow.yaml.config.YamlShadowRuleConfiguration;
 import org.apache.shardingsphere.shadow.yaml.swapper.YamlShadowRuleConfigurationSwapper;
 import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
+import org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
 import org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
 import org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration;
 import org.apache.shardingsphere.sharding.api.config.strategy.sharding.ComplexShardingStrategyConfiguration;
@@ -211,48 +212,94 @@ public final class ConvertYamlConfigurationHandler extends QueryableRALBackendHa
     
     private void appendShardingDistSQL(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
         appendShardingTableRules(ruleConfig, result);
-        // TODO append autoTables
         appendShardingBindingTableRules(ruleConfig, result);
         appendShardingBroadcastTableRules(ruleConfig, result);
         // TODO append defaultStrategy
     }
     
     private void appendShardingTableRules(final ShardingRuleConfiguration ruleConfig, final StringBuilder result) {
-        if (ruleConfig.getTables().isEmpty()) {
+        if (ruleConfig.getTables().isEmpty() && ruleConfig.getAutoTables().isEmpty()) {
             return;
         }
-        result.append(DistSQLScriptConstants.CREATE_SHARDING_TABLE);
-        Iterator<ShardingTableRuleConfiguration> iterator = ruleConfig.getTables().iterator();
-        while (iterator.hasNext()) {
-            ShardingTableRuleConfiguration tableRuleConfig = iterator.next();
-            result.append(String.format(DistSQLScriptConstants.SHARDING_TABLE, tableRuleConfig.getLogicTable(), tableRuleConfig.getActualDataNodes(),
-                    appendTableStrategy(tableRuleConfig, ruleConfig.getShardingAlgorithms(), ruleConfig.getKeyGenerators())));
-            if (iterator.hasNext()) {
-                result.append(DistSQLScriptConstants.COMMA);
+        String tableRules = getTableRules(ruleConfig.getTables(), ruleConfig.getShardingAlgorithms(), ruleConfig.getKeyGenerators());
+        String autoTableRules = getAutoTableRules(ruleConfig.getAutoTables(), ruleConfig.getShardingAlgorithms(), ruleConfig.getKeyGenerators(), ruleConfig.getDefaultShardingColumn());
+        result.append(DistSQLScriptConstants.CREATE_SHARDING_TABLE).append(tableRules);
+        if (!Strings.isNullOrEmpty(tableRules) && !Strings.isNullOrEmpty(autoTableRules)) {
+            result.append(DistSQLScriptConstants.COMMA).append(System.lineSeparator());
+        }
+        result.append(autoTableRules).append(DistSQLScriptConstants.SEMI).append(System.lineSeparator()).append(System.lineSeparator());
+    }
+    
+    private String getAutoTableRules(final Collection<ShardingAutoTableRuleConfiguration> autoTables, final Map<String, AlgorithmConfiguration> shardingAlgorithms,
+                                     final Map<String, AlgorithmConfiguration> keyGenerators, final String defaultShardingColumn) {
+        StringBuilder result = new StringBuilder();
+        if (!autoTables.isEmpty()) {
+            Iterator<ShardingAutoTableRuleConfiguration> iterator = autoTables.iterator();
+            while (iterator.hasNext()) {
+                ShardingAutoTableRuleConfiguration tableRuleConfig = iterator.next();
+                result.append(String.format(DistSQLScriptConstants.SHARDING_AUTO_TABLE, tableRuleConfig.getLogicTable(), tableRuleConfig.getActualDataSources(),
+                        appendAutoTableStrategy(tableRuleConfig, shardingAlgorithms, keyGenerators, defaultShardingColumn)));
+                if (iterator.hasNext()) {
+                    result.append(DistSQLScriptConstants.COMMA);
+                }
             }
         }
-        result.append(DistSQLScriptConstants.SEMI).append(System.lineSeparator()).append(System.lineSeparator());
+        return result.toString();
+    }
+    
+    private String getTableRules(final Collection<ShardingTableRuleConfiguration> tables, final Map<String, AlgorithmConfiguration> shardingAlgorithms,
+                                 final Map<String, AlgorithmConfiguration> keyGenerators) {
+        StringBuilder result = new StringBuilder();
+        if (!tables.isEmpty()) {
+            Iterator<ShardingTableRuleConfiguration> iterator = tables.iterator();
+            while (iterator.hasNext()) {
+                ShardingTableRuleConfiguration tableRuleConfig = iterator.next();
+                result.append(String.format(DistSQLScriptConstants.SHARDING_TABLE, tableRuleConfig.getLogicTable(), tableRuleConfig.getActualDataNodes(),
+                        appendTableStrategy(tableRuleConfig, shardingAlgorithms, keyGenerators)));
+                if (iterator.hasNext()) {
+                    result.append(DistSQLScriptConstants.COMMA);
+                }
+            }
+        }
+        return result.toString();
+    }
+    
+    private String appendAutoTableStrategy(final ShardingAutoTableRuleConfiguration ruleConfig, final Map<String, AlgorithmConfiguration> shardingAlgorithms,
+                                           final Map<String, AlgorithmConfiguration> keyGenerators, final String defaultShardingColumn) {
+        StringBuilder result = new StringBuilder();
+        StandardShardingStrategyConfiguration strategyConfig = (StandardShardingStrategyConfiguration) ruleConfig.getShardingStrategy();
+        String shardingColumn = !Strings.isNullOrEmpty(strategyConfig.getShardingColumn()) ? strategyConfig.getShardingColumn() : defaultShardingColumn;
+        result.append(String.format(DistSQLScriptConstants.AUTO_TABLE_STRATEGY, shardingColumn, getAlgorithmType(shardingAlgorithms.get(strategyConfig.getShardingAlgorithmName()))));
+        appendKeyGenerateStrategy(keyGenerators, ruleConfig.getKeyGenerateStrategy(), result);
+        // TODO auditStrategy
+        return result.toString();
     }
     
     private String appendTableStrategy(final ShardingTableRuleConfiguration ruleConfig,
                                        final Map<String, AlgorithmConfiguration> shardingAlgorithms, final Map<String, AlgorithmConfiguration> keyGenerators) {
         StringBuilder result = new StringBuilder();
-        if (null != ruleConfig.getDatabaseShardingStrategy()) {
-            appendStrategy(ruleConfig.getDatabaseShardingStrategy(), DistSQLScriptConstants.DATABASE_STRATEGY, result, shardingAlgorithms);
-        }
-        if (null != ruleConfig.getTableShardingStrategy()) {
-            appendStrategy(ruleConfig.getTableShardingStrategy(), DistSQLScriptConstants.TABLE_STRATEGY, result, shardingAlgorithms);
-        }
-        if (null != ruleConfig.getKeyGenerateStrategy()) {
-            KeyGenerateStrategyConfiguration keyGenerateStrategyConfig = ruleConfig.getKeyGenerateStrategy();
-            String algorithmDefinition = getAlgorithmType(keyGenerators.get(keyGenerateStrategyConfig.getKeyGeneratorName()));
-            result.append(String.format(DistSQLScriptConstants.KEY_GENERATOR_STRATEGY, keyGenerateStrategyConfig.getColumn(), algorithmDefinition));
+        appendStrategy(ruleConfig.getDatabaseShardingStrategy(), DistSQLScriptConstants.DATABASE_STRATEGY, result, shardingAlgorithms);
+        appendStrategy(ruleConfig.getTableShardingStrategy(), DistSQLScriptConstants.TABLE_STRATEGY, result, shardingAlgorithms);
+        appendKeyGenerateStrategy(keyGenerators, ruleConfig.getKeyGenerateStrategy(), result);
+        // TODO auditStrategy
+        return result.toString();
+    }
+    
+    private void appendKeyGenerateStrategy(final Map<String, AlgorithmConfiguration> keyGenerators, final KeyGenerateStrategyConfiguration keyGenerateStrategyConfig, final StringBuilder result) {
+        if (null == keyGenerateStrategyConfig) {
+            return;
         }
-        return result.substring(0, result.lastIndexOf(","));
+        result.append(DistSQLScriptConstants.COMMA).append(System.lineSeparator());
+        String algorithmDefinition = getAlgorithmType(keyGenerators.get(keyGenerateStrategyConfig.getKeyGeneratorName()));
+        result.append(String.format(DistSQLScriptConstants.KEY_GENERATOR_STRATEGY, keyGenerateStrategyConfig.getColumn(), algorithmDefinition));
     }
     
     private void appendStrategy(final ShardingStrategyConfiguration strategyConfig, final String strategyType,
                                 final StringBuilder result, final Map<String, AlgorithmConfiguration> shardingAlgorithms) {
+        if (null == strategyConfig) {
+            return;
+        }
+        result.append(DistSQLScriptConstants.COMMA).append(System.lineSeparator());
         String type = strategyConfig.getType().toLowerCase();
         String algorithmDefinition = getAlgorithmType(shardingAlgorithms.get(strategyConfig.getShardingAlgorithmName()));
         switch (type) {
@@ -496,7 +543,7 @@ public final class ConvertYamlConfigurationHandler extends QueryableRALBackendHa
         Iterator<String> iterator = new TreeMap(props).keySet().iterator();
         while (iterator.hasNext()) {
             String key = iterator.next();
-            String value = props.getProperty(key);
+            Object value = props.get(key);
             if (null == value) {
                 continue;
             }
diff --git a/proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationHandlerTest.java b/proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationHandlerTest.java
index a60a447837d..633694376c6 100644
--- a/proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationHandlerTest.java
+++ b/proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ConvertYamlConfigurationHandlerTest.java
@@ -47,6 +47,8 @@ public final class ConvertYamlConfigurationHandlerTest {
     
     private final String shardingConfigFilePath = "/conf/convert/config-sharding.yaml";
     
+    private final String shardingAutoTablesConfigFilePath = "/conf/convert/config-sharding-auto-tables.yaml";
+    
     private final String readWriteSplittingConfigFilePath = "/conf/convert/config-readwrite-splitting.yaml";
     
     private final String databaseDiscoveryConfigFilePath = "/conf/convert/config-database-discovery.yaml";
@@ -59,6 +61,8 @@ public final class ConvertYamlConfigurationHandlerTest {
     
     private final String shardingExpectedFilePath = "/expected/convert-sharding.yaml";
     
+    private final String shardingAutoTablesExpectedFilePath = "/expected/convert-sharding-auto-tables.yaml";
+    
     private final String readWriteSplittingExpectedFilePath = "/expected/convert-readwrite-splitting.yaml";
     
     private final String databaseDiscoveryExpectedFilePath = "/expected/convert-database-discovery.yaml";
@@ -76,6 +80,11 @@ public final class ConvertYamlConfigurationHandlerTest {
         assertExecute(shardingConfigFilePath, shardingExpectedFilePath);
     }
     
+    @Test
+    public void assertExecuteWithShardingAutoTables() throws SQLException {
+        assertExecute(shardingAutoTablesConfigFilePath, shardingAutoTablesExpectedFilePath);
+    }
+    
     @Test
     public void assertExecuteWithReadWriteSplitting() throws SQLException {
         assertExecute(readWriteSplittingConfigFilePath, readWriteSplittingExpectedFilePath);
diff --git a/proxy/backend/src/test/resources/conf/convert/config-resource.yaml b/proxy/backend/src/test/resources/conf/convert/config-resource.yaml
deleted file mode 100644
index a7dc1df648b..00000000000
--- a/proxy/backend/src/test/resources/conf/convert/config-resource.yaml
+++ /dev/null
@@ -1,56 +0,0 @@
-#
-# 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: resource_db
-
-dataSources:
- ds_0:
-   url: jdbc:mysql://127.0.0.1:3306/demo_resource_ds_0?serverTimezone=UTC&useSSL=false
-   username: root
-   password: 12345678
-   connectionTimeoutMilliseconds: 3000
-   idleTimeoutMilliseconds: 60000
-   maxLifetimeMilliseconds: 1800000
-   maxPoolSize: 50
-   minPoolSize: 1
-   customPoolProps:
-      poolName: datasource-two
-      autoCommit: false
- ds_1:
-   url: jdbc:mysql://127.0.0.1:3306/demo_resource_ds_1?serverTimezone=UTC&useSSL=false
-   username: root
-   password: 12345678
-   connectionTimeoutMilliseconds: 3000
-   idleTimeoutMilliseconds: 60000
-   maxLifetimeMilliseconds: 1800000
-   maxPoolSize: 50
-   minPoolSize: 1
-   customPoolProps:
-      poolName: datasource-two
-      autoCommit: false
- ds_2:
-   url: jdbc:mysql://127.0.0.1:3306/demo_resource_ds_2?serverTimezone=UTC&useSSL=false
-   username: root
-   password: 12345678
-   connectionTimeoutMilliseconds: 3000
-   idleTimeoutMilliseconds: 60000
-   maxLifetimeMilliseconds: 1800000
-   maxPoolSize: 50
-   minPoolSize: 1
-   customPoolProps:
-      poolName: datasource-two
-      autoCommit: false
diff --git a/proxy/backend/src/test/resources/conf/convert/config-sharding-auto-tables.yaml b/proxy/backend/src/test/resources/conf/convert/config-sharding-auto-tables.yaml
new file mode 100644
index 00000000000..8a0bfef2885
--- /dev/null
+++ b/proxy/backend/src/test/resources/conf/convert/config-sharding-auto-tables.yaml
@@ -0,0 +1,78 @@
+#
+# 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: sharding_db
+
+dataSources:
+  ds_0:
+    url: jdbc:mysql://127.0.0.1:3306/demo_sharding_ds_0?serverTimezone=UTC&useSSL=false
+    username: root
+    password: 12345678
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 50
+    minPoolSize: 1
+  ds_1:
+    url: jdbc:mysql://127.0.0.1:3306/demo_sharding_ds_1?serverTimezone=UTC&useSSL=false
+    username: root
+    password: 12345678
+    connectionTimeoutMilliseconds: 30000
+    idleTimeoutMilliseconds: 60000
+    maxLifetimeMilliseconds: 1800000
+    maxPoolSize: 50
+    minPoolSize: 1
+
+rules:
+  - !SHARDING
+    autoTables:
+      t_order:
+        actualDataSources: ds_0,ds_1
+        shardingStrategy:
+          standard:
+            shardingColumn: order_id
+            shardingAlgorithmName: auto-mod
+        keyGenerateStrategy:
+          column: order_id
+          keyGeneratorName: snowflake
+      t_order_item:
+        actualDataSources: ds_0,ds_1
+        shardingStrategy:
+          standard:
+            shardingColumn: order_id
+            shardingAlgorithmName: auto-mod
+        keyGenerateStrategy:
+          column: order_item_id
+          keyGeneratorName: snowflake
+      t_account:
+        actualDataSources: ds_0,ds_1
+        shardingStrategy:
+          standard:
+            shardingAlgorithmName: auto-mod
+        keyGenerateStrategy:
+          column: account_id
+          keyGeneratorName: snowflake
+    defaultShardingColumn: account_id
+    shardingAlgorithms:
+      auto-mod:
+        type: MOD
+        props:
+          sharding-count: 4
+
+    keyGenerators:
+      snowflake:
+        type: SNOWFLAKE
diff --git a/proxy/backend/src/test/resources/expected/convert-sharding-auto-tables.yaml b/proxy/backend/src/test/resources/expected/convert-sharding-auto-tables.yaml
new file mode 100644
index 00000000000..d914c6e5475
--- /dev/null
+++ b/proxy/backend/src/test/resources/expected/convert-sharding-auto-tables.yaml
@@ -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.
+#
+CREATE DATABASE sharding_db;
+USE sharding_db;
+
+REGISTER STORAGE UNIT ds_0 (
+URL='jdbc:mysql://127.0.0.1:3306/demo_sharding_ds_0?serverTimezone=UTC&useSSL=false',
+USER='root',
+PASSWORD='12345678',
+PROPERTIES('minPoolSize'='1', 'connectionTimeoutMilliseconds'='30000', 'maxLifetimeMilliseconds'='1800000', 'idleTimeoutMilliseconds'='60000', 'maxPoolSize'='50')
+), ds_1 (
+URL='jdbc:mysql://127.0.0.1:3306/demo_sharding_ds_1?serverTimezone=UTC&useSSL=false',
+USER='root',
+PASSWORD='12345678',
+PROPERTIES('minPoolSize'='1', 'connectionTimeoutMilliseconds'='30000', 'maxLifetimeMilliseconds'='1800000', 'idleTimeoutMilliseconds'='60000', 'maxPoolSize'='50')
+);
+
+CREATE SHARDING TABLE RULE t_order (
+STORAGE_UNITS(ds_0,ds_1),
+SHARDING_COLUMN=order_id,
+TYPE(NAME='mod', PROPERTIES('sharding-count'='4')),
+KEY_GENERATE_STRATEGY(COLUMN=order_id, TYPE(NAME='snowflake'))
+), t_order_item (
+STORAGE_UNITS(ds_0,ds_1),
+SHARDING_COLUMN=order_id,
+TYPE(NAME='mod', PROPERTIES('sharding-count'='4')),
+KEY_GENERATE_STRATEGY(COLUMN=order_item_id, TYPE(NAME='snowflake'))
+), t_account (
+STORAGE_UNITS(ds_0,ds_1),
+SHARDING_COLUMN=account_id,
+TYPE(NAME='mod', PROPERTIES('sharding-count'='4')),
+KEY_GENERATE_STRATEGY(COLUMN=account_id, TYPE(NAME='snowflake'))
+);
diff --git a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/internal/asserts/statement/ral/impl/queryable/ConvertYamlConfigurationStatementAssert.java b/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/internal/asserts/statement/ral/impl/queryable/ConvertYamlConfigurationStatementAssert.java
index 057a96047f0..e706fe87470 100644
--- a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/internal/asserts/statement/ral/impl/queryable/ConvertYamlConfigurationStatementAssert.java
+++ b/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/internal/asserts/statement/ral/impl/queryable/ConvertYamlConfigurationStatementAssert.java
@@ -37,8 +37,7 @@ public final class ConvertYamlConfigurationStatementAssert {
      * @param actual actual convert yaml configuration statement
      * @param expected expected convert yaml configuration statement test case
      */
-    public static void assertIs(final SQLCaseAssertContext assertContext, final ConvertYamlConfigurationStatement actual,
-                                final ConvertYamlConfigurationStatementTestCase expected) {
+    public static void assertIs(final SQLCaseAssertContext assertContext, final ConvertYamlConfigurationStatement actual, final ConvertYamlConfigurationStatementTestCase expected) {
         if (null == expected) {
             assertNull(assertContext.getText("Actual statement should no exist."), actual);
         } else {
diff --git a/test/parser/src/main/resources/case/ral/queryable.xml b/test/parser/src/main/resources/case/ral/queryable.xml
index b93a1b3dc8e..5a2418c1c16 100644
--- a/test/parser/src/main/resources/case/ral/queryable.xml
+++ b/test/parser/src/main/resources/case/ral/queryable.xml
@@ -41,6 +41,6 @@
         <database name="database_name" start-index="28" stop-index="40" />
     </export-database-config>
     <convert-yaml-config sql-case-id="convert-yaml-config">
-        <file-path>/yaml/config-resource.yaml</file-path>
+        <file-path>/yaml/config-sharding.yaml</file-path>
     </convert-yaml-config>
 </sql-parser-test-cases>
diff --git a/test/parser/src/main/resources/sql/supported/ral/queryable.xml b/test/parser/src/main/resources/sql/supported/ral/queryable.xml
index 8f9f1f9a610..f3f43170d2e 100644
--- a/test/parser/src/main/resources/sql/supported/ral/queryable.xml
+++ b/test/parser/src/main/resources/sql/supported/ral/queryable.xml
@@ -35,5 +35,5 @@
     <sql-case id="show-compute-node-mode" value="SHOW COMPUTE NODE MODE" db-types="ShardingSphere" />
     
     <sql-case id="export-database-config" value="EXPORT DATABASE CONFIGURATION FROM database_name" db-types="ShardingSphere" />
-    <sql-case id="convert-yaml-config" value="CONVERT YAML CONFIGURATION FROM FILE '/yaml/config-resource.yaml'" db-types="ShardingSphere" />
+    <sql-case id="convert-yaml-config" value="CONVERT YAML CONFIGURATION FROM FILE '/yaml/config-sharding.yaml'" db-types="ShardingSphere" />
 </sql-cases>