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

panjuan 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 ed1da8e  aggregate datasource for single table rule (#11456)
ed1da8e is described below

commit ed1da8e16b69f8d961b960f291b2962860deee3e
Author: Zhengqiang Duan <[email protected]>
AuthorDate: Thu Jul 22 21:13:29 2021 +0800

    aggregate datasource for single table rule (#11456)
    
    * aggregate datasource for single table rule
    
    * Adjust rule load order
    
    * fix test case
    
    * fix federate statement test error
    
    * fix governance test
    
    * fix test case
    
    * fix test case
    
    * fix integrate test with single table conflict
---
 .../constant/DatabaseDiscoveryOrder.java           |  2 +-
 ...orithmProvidedDatabaseDiscoveryRuleBuilder.java |  3 +-
 .../rule/builder/DatabaseDiscoveryRuleBuilder.java |  3 +-
 .../AlgorithmProvidedEncryptRuleBuilder.java       |  3 +-
 .../encrypt/rule/builder/EncryptRuleBuilder.java   |  3 +-
 .../constant/ReadwriteSplittingOrder.java          |  2 +-
 ...rithmProvidedReadwriteSplittingRuleBuilder.java |  3 +-
 .../builder/ReadwriteSplittingRuleBuilder.java     |  3 +-
 .../shadow/route/ShadowSQLRouter.java              |  4 +--
 .../shardingsphere/shadow/rule/ShadowRule.java     | 14 +++++++-
 .../shadow/rule/builder/ShadowRuleBuilder.java     |  3 +-
 .../shardingsphere/sharding/rule/ShardingRule.java |  6 ++--
 .../AlgorithmProvidedShardingRuleBuilder.java      |  5 +--
 .../sharding/rule/builder/ShardingRuleBuilder.java |  5 +--
 .../dal/show/ShowCreateTableMergedResultTest.java  |  3 +-
 .../merge/dal/show/ShowTablesMergedResultTest.java |  3 +-
 .../engine/fixture/AbstractRoutingEngineTest.java  | 24 ++++++-------
 ...ShardingDatabaseBroadcastRoutingEngineTest.java |  3 +-
 .../ShardingTableBroadcastRoutingEngineTest.java   |  2 +-
 .../engine/type/standard/AbstractSQLRouteTest.java |  4 +--
 .../unicast/ShardingUnicastRoutingEngineTest.java  |  3 +-
 .../sharding/rule/ShardingRuleTest.java            | 23 ++++++-------
 .../infra/constant/SingleTableOrder.java           |  7 +++-
 .../rule/builder/ShardingSphereRulesBuilder.java   | 12 ++++---
 .../rule/builder/scope/SchemaRuleBuilder.java      |  5 +--
 .../builder/single/SingleTableRuleBuilder.java     |  7 ++--
 .../SingleTableRuleConfigurationChecker.java       |  2 +-
 .../rule/single/SingleTableDataNodeLoader.java     |  4 +--
 .../infra/rule/single/SingleTableRule.java         | 39 ++++++++++++++++++++--
 .../infra/spi/ordered/OrderedSPIRegistry.java      | 33 ++++++++++++++++--
 .../fixture/TestShardingSphereRuleBuilder.java     |  3 +-
 .../rule/single/SingleTableDataNodeLoaderTest.java |  2 +-
 .../infra/context/fixture/FixtureRuleBuilder.java  |  3 +-
 .../infra/route/SingleTableSQLRouter.java          |  2 +-
 .../ShardingSphereDatabaseMetaDataTest.java        |  3 +-
 .../GovernanceShardingSphereDataSourceTest.java    | 10 +++---
 ...GovernanceSpringBootReadwriteSplittingTest.java | 15 +++------
 .../GovernanceReadwriteSplittingNamespaceTest.java | 31 +++++++++--------
 ...nceShardingReadwriteSplittingNamespaceTest.java | 16 ++++-----
 .../scaling/core/util/JobConfigurationUtil.java    |  4 +--
 .../resources/env/db/init-sql/h2/init-db_0.sql     |  2 ++
 .../src/test/resources/env/db/init-sql/h2/init.sql |  2 --
 .../init-sql/h2/init-read_ds_0.sql                 |  2 ++
 .../init-sql/h2/init-write_ds_0.sql                |  2 ++
 .../init-sql/h2/init.sql                           |  2 --
 .../init-sql/h2/init-encrypt_read_ds_0.sql         |  2 ++
 .../init-sql/h2/init-encrypt_write_ds_0.sql        |  2 ++
 .../init-sql/h2/init.sql                           |  2 --
 48 files changed, 212 insertions(+), 126 deletions(-)

diff --git 
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/constant/DatabaseDiscoveryOrder.java
 
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/constant/DatabaseDiscoveryOrder.java
index 53b90b8..b97c9fb 100644
--- 
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/constant/DatabaseDiscoveryOrder.java
+++ 
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/constant/DatabaseDiscoveryOrder.java
@@ -29,7 +29,7 @@ public final class DatabaseDiscoveryOrder {
     /**
      * Database discovery order.
      */
-    public static final int ORDER = 20;
+    public static final int ORDER = 30;
     
     /**
      * Algorithm provider database discovery order.
diff --git 
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/rule/builder/AlgorithmProvidedDatabaseDiscoveryRuleBuilder.java
 
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/rule/builder/AlgorithmProvidedDatabaseDiscoveryRuleBuilder.java
index a5e6c7d..a553861 100644
--- 
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/rule/builder/AlgorithmProvidedDatabaseDiscoveryRuleBuilder.java
+++ 
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/rule/builder/AlgorithmProvidedDatabaseDiscoveryRuleBuilder.java
@@ -21,6 +21,7 @@ import 
org.apache.shardingsphere.dbdiscovery.algorithm.config.AlgorithmProvidedD
 import org.apache.shardingsphere.dbdiscovery.constant.DatabaseDiscoveryOrder;
 import org.apache.shardingsphere.dbdiscovery.rule.DatabaseDiscoveryRule;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.builder.level.FeatureRuleBuilder;
 import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
 
@@ -35,7 +36,7 @@ public final class 
AlgorithmProvidedDatabaseDiscoveryRuleBuilder implements Feat
     
     @Override
     public DatabaseDiscoveryRule build(final String schemaName, final 
Map<String, DataSource> dataSourceMap, final DatabaseType databaseType, 
-                                       final 
AlgorithmProvidedDatabaseDiscoveryRuleConfiguration ruleConfig, final 
Collection<String> occupiedTables) {
+                                       final 
AlgorithmProvidedDatabaseDiscoveryRuleConfiguration ruleConfig, final 
Collection<ShardingSphereRule> rules) {
         return new DatabaseDiscoveryRule(ruleConfig, databaseType, 
dataSourceMap, schemaName);
     }
     
diff --git 
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/rule/builder/DatabaseDiscoveryRuleBuilder.java
 
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/rule/builder/DatabaseDiscoveryRuleBuilder.java
index f376548..e0d95db 100644
--- 
a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/rule/builder/DatabaseDiscoveryRuleBuilder.java
+++ 
b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-core/src/main/java/org/apache/shardingsphere/dbdiscovery/rule/builder/DatabaseDiscoveryRuleBuilder.java
@@ -22,6 +22,7 @@ import 
org.apache.shardingsphere.dbdiscovery.api.config.rule.DatabaseDiscoveryDa
 import org.apache.shardingsphere.dbdiscovery.constant.DatabaseDiscoveryOrder;
 import org.apache.shardingsphere.dbdiscovery.rule.DatabaseDiscoveryRule;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.builder.level.FeatureRuleBuilder;
 import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
 
@@ -37,7 +38,7 @@ public final class DatabaseDiscoveryRuleBuilder implements 
FeatureRuleBuilder, S
     
     @Override
     public DatabaseDiscoveryRule build(final String schemaName, final 
Map<String, DataSource> dataSourceMap, final DatabaseType databaseType, 
-                                       final 
DatabaseDiscoveryRuleConfiguration ruleConfig, final Collection<String> 
occupiedTables) {
+                                       final 
DatabaseDiscoveryRuleConfiguration ruleConfig, final 
Collection<ShardingSphereRule> rules) {
         Map<String, DataSource> realDataSourceMap = new HashMap<>();
         for (DatabaseDiscoveryDataSourceRuleConfiguration each : 
ruleConfig.getDataSources()) {
             for (String datasourceName : each.getDataSourceNames()) {
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/AlgorithmProvidedEncryptRuleBuilder.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/AlgorithmProvidedEncryptRuleBuilder.java
index df0e83d..0a8a365 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/AlgorithmProvidedEncryptRuleBuilder.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/AlgorithmProvidedEncryptRuleBuilder.java
@@ -21,6 +21,7 @@ import 
org.apache.shardingsphere.encrypt.algorithm.config.AlgorithmProvidedEncry
 import org.apache.shardingsphere.encrypt.constant.EncryptOrder;
 import org.apache.shardingsphere.encrypt.rule.EncryptRule;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.builder.level.FeatureRuleBuilder;
 import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
 
@@ -35,7 +36,7 @@ public final class AlgorithmProvidedEncryptRuleBuilder 
implements FeatureRuleBui
     
     @Override
     public EncryptRule build(final String schemaName, final Map<String, 
DataSource> dataSourceMap, final DatabaseType databaseType, 
-                             final AlgorithmProvidedEncryptRuleConfiguration 
config, final Collection<String> occupiedTables) {
+                             final AlgorithmProvidedEncryptRuleConfiguration 
config, final Collection<ShardingSphereRule> rules) {
         return new EncryptRule(config);
     }
     
diff --git 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/EncryptRuleBuilder.java
 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/EncryptRuleBuilder.java
index fc96ee7..07ce5c6 100644
--- 
a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/EncryptRuleBuilder.java
+++ 
b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-core/src/main/java/org/apache/shardingsphere/encrypt/rule/builder/EncryptRuleBuilder.java
@@ -21,6 +21,7 @@ import 
org.apache.shardingsphere.encrypt.api.config.EncryptRuleConfiguration;
 import org.apache.shardingsphere.encrypt.constant.EncryptOrder;
 import org.apache.shardingsphere.encrypt.rule.EncryptRule;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.builder.level.FeatureRuleBuilder;
 import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
 
@@ -35,7 +36,7 @@ public final class EncryptRuleBuilder implements 
FeatureRuleBuilder, SchemaRuleB
     
     @Override
     public EncryptRule build(final String schemaName, final Map<String, 
DataSource> dataSourceMap, final DatabaseType databaseType, 
-                             final EncryptRuleConfiguration config, final 
Collection<String> occupiedTables) {
+                             final EncryptRuleConfiguration config, final 
Collection<ShardingSphereRule> rules) {
         return new EncryptRule(config);
     }
     
diff --git 
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/constant/ReadwriteSplittingOrder.java
 
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/constant/ReadwriteSplittingOrder.java
index 1ef0cbe..0a7ff12 100644
--- 
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/constant/ReadwriteSplittingOrder.java
+++ 
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/constant/ReadwriteSplittingOrder.java
@@ -29,7 +29,7 @@ public final class ReadwriteSplittingOrder {
     /**
      * Readwrite-splitting order.
      */
-    public static final int ORDER = 10;
+    public static final int ORDER = 20;
     
     /**
      * Algorithm provider readwrite-splitting order.
diff --git 
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/builder/AlgorithmProvidedReadwriteSplittingRuleBuilder.java
 
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/builder/AlgorithmProvidedReadwriteSplittingRuleBuilder.java
index bfa648e..954b079 100644
--- 
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/builder/AlgorithmProvidedReadwriteSplittingRuleBuilder.java
+++ 
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/builder/AlgorithmProvidedReadwriteSplittingRuleBuilder.java
@@ -18,6 +18,7 @@
 package org.apache.shardingsphere.readwritesplitting.rule.builder;
 
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.builder.level.FeatureRuleBuilder;
 import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
 import 
org.apache.shardingsphere.readwritesplitting.algorithm.config.AlgorithmProvidedReadwriteSplittingRuleConfiguration;
@@ -35,7 +36,7 @@ public final class 
AlgorithmProvidedReadwriteSplittingRuleBuilder implements Fea
     
     @Override
     public ReadwriteSplittingRule build(final String schemaName, final 
Map<String, DataSource> dataSourceMap, final DatabaseType databaseType, 
-                                        final 
AlgorithmProvidedReadwriteSplittingRuleConfiguration config, final 
Collection<String> occupiedTables) {
+                                        final 
AlgorithmProvidedReadwriteSplittingRuleConfiguration config, final 
Collection<ShardingSphereRule> rules) {
         return new ReadwriteSplittingRule(config);
     }
     
diff --git 
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/builder/ReadwriteSplittingRuleBuilder.java
 
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/builder/ReadwriteSplittingRuleBuilder.java
index 5f6a5ef..6921e0d 100644
--- 
a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/builder/ReadwriteSplittingRuleBuilder.java
+++ 
b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/builder/ReadwriteSplittingRuleBuilder.java
@@ -18,6 +18,7 @@
 package org.apache.shardingsphere.readwritesplitting.rule.builder;
 
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.builder.level.FeatureRuleBuilder;
 import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
 import 
org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
@@ -35,7 +36,7 @@ public final class ReadwriteSplittingRuleBuilder implements 
FeatureRuleBuilder,
     
     @Override
     public ReadwriteSplittingRule build(final String schemaName, final 
Map<String, DataSource> dataSourceMap, final DatabaseType databaseType, 
-                                        final 
ReadwriteSplittingRuleConfiguration config, final Collection<String> 
occupiedTables) {
+                                        final 
ReadwriteSplittingRuleConfiguration config, final 
Collection<ShardingSphereRule> rules) {
         return new ReadwriteSplittingRule(config);
     }
     
diff --git 
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/route/ShadowSQLRouter.java
 
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/route/ShadowSQLRouter.java
index c1951aa..fe44993 100644
--- 
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/route/ShadowSQLRouter.java
+++ 
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/route/ShadowSQLRouter.java
@@ -17,14 +17,14 @@
 
 package org.apache.shardingsphere.shadow.route;
 
+import org.apache.shardingsphere.infra.binder.LogicSQL;
 import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
 import 
org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;
+import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import org.apache.shardingsphere.infra.route.SQLRouter;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
 import org.apache.shardingsphere.infra.route.context.RouteMapper;
 import org.apache.shardingsphere.infra.route.context.RouteUnit;
-import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
-import org.apache.shardingsphere.infra.binder.LogicSQL;
 import org.apache.shardingsphere.shadow.constant.ShadowOrder;
 import 
org.apache.shardingsphere.shadow.route.judge.ShadowDataSourceJudgeEngine;
 import 
org.apache.shardingsphere.shadow.route.judge.impl.PreparedShadowDataSourceJudgeEngine;
diff --git 
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/rule/ShadowRule.java
 
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/rule/ShadowRule.java
index f955ace..b28e50e 100644
--- 
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/rule/ShadowRule.java
+++ 
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/rule/ShadowRule.java
@@ -20,8 +20,11 @@ package org.apache.shardingsphere.shadow.rule;
 import lombok.Getter;
 import org.apache.shardingsphere.infra.rule.level.FeatureRule;
 import org.apache.shardingsphere.infra.rule.scope.SchemaRule;
+import org.apache.shardingsphere.infra.rule.type.DataSourceContainedRule;
 import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
 
+import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.Map;
 
@@ -29,7 +32,7 @@ import java.util.Map;
  * Databases shadow rule.
  */
 @Getter
-public final class ShadowRule implements FeatureRule, SchemaRule {
+public final class ShadowRule implements FeatureRule, SchemaRule, 
DataSourceContainedRule {
     
     private final Map<String, String> shadowMappings;
     
@@ -42,4 +45,13 @@ public final class ShadowRule implements FeatureRule, 
SchemaRule {
             
shadowMappings.put(shadowRuleConfig.getSourceDataSourceNames().get(i), 
shadowRuleConfig.getShadowDataSourceNames().get(i));
         }
     }
+    
+    @Override
+    public Map<String, Collection<String>> getDataSourceMapper() {
+        Map<String, Collection<String>> result = new 
HashMap<>(shadowMappings.size());
+        for (Map.Entry<String, String> entry : shadowMappings.entrySet()) {
+            result.put(entry.getKey(), 
Collections.singletonList(entry.getValue()));
+        }
+        return result;
+    }
 }
diff --git 
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/rule/builder/ShadowRuleBuilder.java
 
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/rule/builder/ShadowRuleBuilder.java
index 7e31d27..ef02355 100644
--- 
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/rule/builder/ShadowRuleBuilder.java
+++ 
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/rule/builder/ShadowRuleBuilder.java
@@ -18,6 +18,7 @@
 package org.apache.shardingsphere.shadow.rule.builder;
 
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.builder.level.FeatureRuleBuilder;
 import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
 import org.apache.shardingsphere.shadow.api.config.ShadowRuleConfiguration;
@@ -35,7 +36,7 @@ public final class ShadowRuleBuilder implements 
FeatureRuleBuilder, SchemaRuleBu
     
     @Override
     public ShadowRule build(final String schemaName, final Map<String, 
DataSource> dataSourceMap, final DatabaseType databaseType, 
-                            final ShadowRuleConfiguration config, final 
Collection<String> occupiedTables) {
+                            final ShadowRuleConfiguration config, final 
Collection<ShardingSphereRule> rules) {
         return new ShadowRule(config);
     }
     
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
index 4548e53..f95c778 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
@@ -89,7 +89,7 @@ public final class ShardingRule implements FeatureRule, 
SchemaRule, DataNodeCont
     
     private final KeyGenerateAlgorithm defaultKeyGenerateAlgorithm;
     
-    public ShardingRule(final ShardingRuleConfiguration config, final 
Map<String, DataSource> dataSourceMap, final Collection<String> occupiedTables) 
{
+    public ShardingRule(final ShardingRuleConfiguration config, final 
Map<String, DataSource> dataSourceMap) {
         Preconditions.checkArgument(null != dataSourceMap && 
!dataSourceMap.isEmpty(), "Data sources cannot be empty.");
         dataSourceNames = getDataSourceNames(config.getTables(), 
config.getAutoTables(), dataSourceMap.keySet());
         config.getShardingAlgorithms().forEach((key, value) -> 
shardingAlgorithms.put(key, 
ShardingSphereAlgorithmFactory.createAlgorithm(value, 
ShardingAlgorithm.class)));
@@ -102,10 +102,9 @@ public final class ShardingRule implements FeatureRule, 
SchemaRule, DataNodeCont
         defaultTableShardingStrategyConfig = null == 
config.getDefaultTableShardingStrategy() ? new 
NoneShardingStrategyConfiguration() : config.getDefaultTableShardingStrategy();
         defaultKeyGenerateAlgorithm = null == 
config.getDefaultKeyGenerateStrategy()
                 ? 
TypedSPIRegistry.getRegisteredService(KeyGenerateAlgorithm.class) : 
keyGenerators.get(config.getDefaultKeyGenerateStrategy().getKeyGeneratorName());
-        occupiedTables.addAll(getAllTables());
     }
     
-    public ShardingRule(final AlgorithmProvidedShardingRuleConfiguration 
config, final Map<String, DataSource> dataSourceMap, final Collection<String> 
occupiedTables) {
+    public ShardingRule(final AlgorithmProvidedShardingRuleConfiguration 
config, final Map<String, DataSource> dataSourceMap) {
         Preconditions.checkArgument(null != dataSourceMap && 
!dataSourceMap.isEmpty(), "Data sources cannot be empty.");
         dataSourceNames = getDataSourceNames(config.getTables(), 
config.getAutoTables(), dataSourceMap.keySet());
         shardingAlgorithms.putAll(config.getShardingAlgorithms());
@@ -118,7 +117,6 @@ public final class ShardingRule implements FeatureRule, 
SchemaRule, DataNodeCont
         defaultTableShardingStrategyConfig = null == 
config.getDefaultTableShardingStrategy() ? new 
NoneShardingStrategyConfiguration() : config.getDefaultTableShardingStrategy();
         defaultKeyGenerateAlgorithm = null == 
config.getDefaultKeyGenerateStrategy()
                 ? 
TypedSPIRegistry.getRegisteredService(KeyGenerateAlgorithm.class) : 
keyGenerators.get(config.getDefaultKeyGenerateStrategy().getKeyGeneratorName());
-        occupiedTables.addAll(getAllTables());
     }
     
     private Collection<String> getDataSourceNames(final 
Collection<ShardingTableRuleConfiguration> tableRuleConfigs, 
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/builder/AlgorithmProvidedShardingRuleBuilder.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/builder/AlgorithmProvidedShardingRuleBuilder.java
index 7e83dbe..4cfa610 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/builder/AlgorithmProvidedShardingRuleBuilder.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/builder/AlgorithmProvidedShardingRuleBuilder.java
@@ -18,6 +18,7 @@
 package org.apache.shardingsphere.sharding.rule.builder;
 
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.builder.level.FeatureRuleBuilder;
 import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
 import 
org.apache.shardingsphere.sharding.algorithm.config.AlgorithmProvidedShardingRuleConfiguration;
@@ -35,8 +36,8 @@ public final class AlgorithmProvidedShardingRuleBuilder 
implements FeatureRuleBu
     
     @Override
     public ShardingRule build(final String schemaName, final Map<String, 
DataSource> dataSourceMap, final DatabaseType databaseType, 
-                              final AlgorithmProvidedShardingRuleConfiguration 
config, final Collection<String> occupiedTables) {
-        return new ShardingRule(config, dataSourceMap, occupiedTables);
+                              final AlgorithmProvidedShardingRuleConfiguration 
config, final Collection<ShardingSphereRule> rules) {
+        return new ShardingRule(config, dataSourceMap);
     }
     
     @Override
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/builder/ShardingRuleBuilder.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/builder/ShardingRuleBuilder.java
index 964b272..5549c74 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/builder/ShardingRuleBuilder.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/builder/ShardingRuleBuilder.java
@@ -18,6 +18,7 @@
 package org.apache.shardingsphere.sharding.rule.builder;
 
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.builder.level.FeatureRuleBuilder;
 import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
 import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
@@ -35,8 +36,8 @@ public final class ShardingRuleBuilder implements 
FeatureRuleBuilder, SchemaRule
     
     @Override
     public ShardingRule build(final String schemaName, final Map<String, 
DataSource> dataSourceMap, final DatabaseType databaseType, 
-                              final ShardingRuleConfiguration config, final 
Collection<String> occupiedTables) {
-        return new ShardingRule(config, dataSourceMap, occupiedTables);
+                              final ShardingRuleConfiguration config, final 
Collection<ShardingSphereRule> rules) {
+        return new ShardingRule(config, dataSourceMap);
     }
     
     @Override
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/merge/dal/show/ShowCreateTableMergedResultTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/merge/dal/show/ShowCreateTableMergedResultTest.java
index ae01434..c428255 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/merge/dal/show/ShowCreateTableMergedResultTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/merge/dal/show/ShowCreateTableMergedResultTest.java
@@ -17,7 +17,6 @@
 
 package org.apache.shardingsphere.sharding.merge.dal.show;
 
-import com.google.common.collect.Sets;
 import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResult;
 import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
@@ -56,7 +55,7 @@ public final class ShowCreateTableMergedResultTest {
         ShardingTableRuleConfiguration tableRuleConfig = new 
ShardingTableRuleConfiguration("table", "ds.table_${0..2}");
         ShardingRuleConfiguration shardingRuleConfig = new 
ShardingRuleConfiguration();
         shardingRuleConfig.getTables().add(tableRuleConfig);
-        return new ShardingRule(shardingRuleConfig, 
Collections.singletonMap("ds", mock(DataSource.class, RETURNS_DEEP_STUBS)), 
Sets.newHashSet());
+        return new ShardingRule(shardingRuleConfig, 
Collections.singletonMap("ds", mock(DataSource.class, RETURNS_DEEP_STUBS)));
     }
     
     private ShardingSphereSchema buildSchema() {
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/merge/dal/show/ShowTablesMergedResultTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/merge/dal/show/ShowTablesMergedResultTest.java
index 6873153..937a43f 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/merge/dal/show/ShowTablesMergedResultTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/merge/dal/show/ShowTablesMergedResultTest.java
@@ -17,7 +17,6 @@
 
 package org.apache.shardingsphere.sharding.merge.dal.show;
 
-import com.google.common.collect.Sets;
 import org.apache.shardingsphere.infra.binder.statement.SQLStatementContext;
 import 
org.apache.shardingsphere.infra.executor.sql.execute.result.query.QueryResult;
 import org.apache.shardingsphere.infra.metadata.schema.ShardingSphereSchema;
@@ -56,7 +55,7 @@ public final class ShowTablesMergedResultTest {
         ShardingTableRuleConfiguration tableRuleConfig = new 
ShardingTableRuleConfiguration("table", "ds.table_${0..2}");
         ShardingRuleConfiguration shardingRuleConfig = new 
ShardingRuleConfiguration();
         shardingRuleConfig.getTables().add(tableRuleConfig);
-        return new ShardingRule(shardingRuleConfig, 
Collections.singletonMap("ds", mock(DataSource.class, RETURNS_DEEP_STUBS)), 
Sets.newHashSet());
+        return new ShardingRule(shardingRuleConfig, 
Collections.singletonMap("ds", mock(DataSource.class, RETURNS_DEEP_STUBS)));
     }
     
     private ShardingSphereSchema buildSchema() {
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/fixture/AbstractRoutingEngineTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/fixture/AbstractRoutingEngineTest.java
index d56d55a..cea7c74 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/fixture/AbstractRoutingEngineTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/fixture/AbstractRoutingEngineTest.java
@@ -17,9 +17,9 @@
 
 package org.apache.shardingsphere.sharding.route.engine.fixture;
 
-import com.google.common.collect.Sets;
 import 
org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.single.SingleTableRule;
 import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
 import 
org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
@@ -55,7 +55,7 @@ public abstract class AbstractRoutingEngineTest {
         Properties props1 = new Properties();
         props1.setProperty("algorithm-expression", "t_order_${order_id % 2}");
         shardingRuleConfig.getShardingAlgorithms().put("t_order_inline", new 
ShardingSphereAlgorithmConfiguration("INLINE", props1));
-        return new ShardingRule(shardingRuleConfig, createDataSourceMap(), 
Sets.newHashSet());
+        return new ShardingRule(shardingRuleConfig, createDataSourceMap());
     }
     
     protected final ShardingRule createErrorShardingRule() {
@@ -67,7 +67,7 @@ public abstract class AbstractRoutingEngineTest {
         Properties props1 = new Properties();
         props1.setProperty("algorithm-expression", "t_order_${order_id % 3}");
         shardingRuleConfig.getShardingAlgorithms().put("t_order_inline", new 
ShardingSphereAlgorithmConfiguration("INLINE", props1));
-        return new ShardingRule(shardingRuleConfig, createDataSourceMap(), 
Sets.newHashSet());
+        return new ShardingRule(shardingRuleConfig, createDataSourceMap());
     }
     
     protected final ShardingRule createBindingShardingRule() {
@@ -84,7 +84,7 @@ public abstract class AbstractRoutingEngineTest {
         Properties props2 = new Properties();
         props2.setProperty("algorithm-expression", "t_order_item_${order_id % 
2}");
         shardingRuleConfig.getShardingAlgorithms().put("t_order_item_inline", 
new ShardingSphereAlgorithmConfiguration("INLINE", props2));
-        return new ShardingRule(shardingRuleConfig, createDataSourceMap(), 
Sets.newHashSet());
+        return new ShardingRule(shardingRuleConfig, createDataSourceMap());
     }
     
     protected final ShardingRule createBroadcastShardingRule() {
@@ -101,14 +101,14 @@ public abstract class AbstractRoutingEngineTest {
         Properties props2 = new Properties();
         props2.setProperty("algorithm-expression", "t_order_item_${order_id % 
2}");
         shardingRuleConfig.getShardingAlgorithms().put("t_order_item_inline", 
new ShardingSphereAlgorithmConfiguration("INLINE", props2));
-        return new ShardingRule(shardingRuleConfig, createDataSourceMap(), 
Sets.newHashSet());
+        return new ShardingRule(shardingRuleConfig, createDataSourceMap());
     }
     
     protected final ShardingRule createHintShardingRule() {
         ShardingRuleConfiguration shardingRuleConfig = new 
ShardingRuleConfiguration();
         shardingRuleConfig.getTables().add(createTableRuleWithHintConfig());
         shardingRuleConfig.getShardingAlgorithms().put("hint_test", new 
ShardingSphereAlgorithmConfiguration("HINT_TEST", new Properties()));
-        return new ShardingRule(shardingRuleConfig, createDataSourceMap(), 
Sets.newHashSet());
+        return new ShardingRule(shardingRuleConfig, createDataSourceMap());
     }
     
     protected final ShardingRule createMixedShardingRule() {
@@ -124,10 +124,10 @@ public abstract class AbstractRoutingEngineTest {
         Properties props1 = new Properties();
         props1.setProperty("algorithm-expression", "t_hint_ds_test_${order_id 
% 2}");
         
shardingRuleConfig.getShardingAlgorithms().put("t_hint_ds_test_inline", new 
ShardingSphereAlgorithmConfiguration("INLINE", props1));
-        return new ShardingRule(shardingRuleConfig, createDataSourceMap(), 
Sets.newHashSet());
+        return new ShardingRule(shardingRuleConfig, createDataSourceMap());
     }
     
-    protected final ShardingRule createAllShardingRule(final 
Collection<String> occupiedTables) {
+    protected final ShardingRule createAllShardingRule() {
         ShardingRuleConfiguration shardingRuleConfig = new 
ShardingRuleConfiguration();
         shardingRuleConfig.getBroadcastTables().add("t_product");
         Properties props0 = new Properties();
@@ -149,7 +149,7 @@ public abstract class AbstractRoutingEngineTest {
         props3.setProperty("algorithm-expression", "t_user_${user_id % 2}");
         shardingRuleConfig.getShardingAlgorithms().put("t_user_inline", new 
ShardingSphereAlgorithmConfiguration("INLINE", props3));
         shardingRuleConfig.getShardingAlgorithms().put("hint_test", new 
ShardingSphereAlgorithmConfiguration("HINT_TEST", new Properties()));
-        return new ShardingRule(shardingRuleConfig, 
createDataSourceMapWithMain(), occupiedTables);
+        return new ShardingRule(shardingRuleConfig, 
createDataSourceMapWithMain());
     }
     
     protected final ShardingRule createIntervalTableShardingRule() {
@@ -164,7 +164,7 @@ public abstract class AbstractRoutingEngineTest {
         props0.setProperty("datetime-interval-amount", "1");
         props0.setProperty("datetime-interval-unit", "MONTHS");
         shardingRuleConfig.getShardingAlgorithms().put("interval_test", new 
ShardingSphereAlgorithmConfiguration("INTERVAL", props0));
-        return new ShardingRule(shardingRuleConfig, createDataSourceMap(), 
Sets.newHashSet());
+        return new ShardingRule(shardingRuleConfig, createDataSourceMap());
     }
     
     private ShardingTableRuleConfiguration createInlineTableRuleConfig(final 
String tableName, final String actualDataNodes, final String 
algorithmExpression, final String dsAlgorithmExpression) {
@@ -240,9 +240,9 @@ public abstract class AbstractRoutingEngineTest {
         return result;
     }
     
-    protected SingleTableRule createAllSingleTableRule(final 
Collection<String> occupiedTables) {
+    protected SingleTableRule createAllSingleTableRule(final 
Collection<ShardingSphereRule> rules) {
         Map<String, DataSource> dataSourceMap = createDataSourceMapWithMain();
-        SingleTableRule singleTableRule = new 
SingleTableRule(mock(DatabaseType.class), dataSourceMap, occupiedTables);
+        SingleTableRule singleTableRule = new 
SingleTableRule(mock(DatabaseType.class), dataSourceMap, rules);
         singleTableRule.addSingleTableDataNode("t_category", 
dataSourceMap.keySet().iterator().next());
         return singleTableRule;
     }
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingDatabaseBroadcastRoutingEngineTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingDatabaseBroadcastRoutingEngineTest.java
index 2e221bf..5350cbf 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingDatabaseBroadcastRoutingEngineTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingDatabaseBroadcastRoutingEngineTest.java
@@ -17,7 +17,6 @@
 
 package org.apache.shardingsphere.sharding.route.engine.type.broadcast;
 
-import com.google.common.collect.Sets;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
 import org.apache.shardingsphere.infra.route.context.RouteUnit;
 import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
@@ -45,7 +44,7 @@ public final class ShardingDatabaseBroadcastRoutingEngineTest 
{
         ShardingRuleConfiguration shardingRuleConfig = new 
ShardingRuleConfiguration();
         shardingRuleConfig.getTables().add(new 
ShardingTableRuleConfiguration("t_order", "ds_${0..1}.t_order_${0..2}"));
         RouteContext routeContext = new RouteContext();
-        shardingDatabaseBroadcastRoutingEngine.route(routeContext, new 
ShardingRule(shardingRuleConfig, createDataSourceMap(), Sets.newHashSet()));
+        shardingDatabaseBroadcastRoutingEngine.route(routeContext, new 
ShardingRule(shardingRuleConfig, createDataSourceMap()));
         List<RouteUnit> routeUnits = new 
ArrayList<>(routeContext.getRouteUnits());
         assertThat(routeContext.getRouteUnits().size(), is(2));
         assertThat(routeUnits.get(0).getDataSourceMapper().getActualName(), 
is("ds_0"));
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingTableBroadcastRoutingEngineTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingTableBroadcastRoutingEngineTest.java
index f3f57fa..cb0c605 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingTableBroadcastRoutingEngineTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/broadcast/ShardingTableBroadcastRoutingEngineTest.java
@@ -155,7 +155,7 @@ public final class ShardingTableBroadcastRoutingEngineTest 
extends AbstractRouti
         dataSourceMap.put("ds0", mock(DataSource.class, RETURNS_DEEP_STUBS));
         dataSourceMap.put("ds1", mock(DataSource.class, RETURNS_DEEP_STUBS));
         
-        return new ShardingRule(shardingRuleConfiguration, dataSourceMap, 
Sets.newHashSet());
+        return new ShardingRule(shardingRuleConfiguration, dataSourceMap);
     }
 
     private SQLStatementContext<?> createSQLStatementContext(final 
List<String> tableNames) {
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/standard/AbstractSQLRouteTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/standard/AbstractSQLRouteTest.java
index 6aa67cf..bbf72d2 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/standard/AbstractSQLRouteTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/standard/AbstractSQLRouteTest.java
@@ -59,8 +59,8 @@ public abstract class AbstractSQLRouteTest extends 
AbstractRoutingEngineTest {
     
     protected final RouteContext assertRoute(final String sql, final 
List<Object> parameters, final int routeUnitSize) {
         Collection<String> occupiedTables = new HashSet<>();
-        ShardingRule shardingRule = createAllShardingRule(occupiedTables);
-        SingleTableRule singleTableRule = 
createAllSingleTableRule(occupiedTables);
+        ShardingRule shardingRule = createAllShardingRule();
+        SingleTableRule singleTableRule = 
createAllSingleTableRule(Collections.singletonList(shardingRule));
         ShardingSphereSchema schema = buildSchema();
         ConfigurationProperties props = new ConfigurationProperties(new 
Properties());
         SQLStatementParserEngine sqlStatementParserEngine = new 
SQLStatementParserEngine("MySQL");
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/unicast/ShardingUnicastRoutingEngineTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/unicast/ShardingUnicastRoutingEngineTest.java
index d384b3a..bb996c2 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/unicast/ShardingUnicastRoutingEngineTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/unicast/ShardingUnicastRoutingEngineTest.java
@@ -17,7 +17,6 @@
 
 package org.apache.shardingsphere.sharding.route.engine.type.unicast;
 
-import com.google.common.collect.Sets;
 import 
org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurationException;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
 import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
@@ -48,7 +47,7 @@ public final class ShardingUnicastRoutingEngineTest {
         ShardingRuleConfiguration shardingRuleConfig = new 
ShardingRuleConfiguration();
         shardingRuleConfig.getTables().add(new 
ShardingTableRuleConfiguration("t_order", "ds_${0..1}.t_order_${0..2}"));
         shardingRuleConfig.getBroadcastTables().add("t_config");
-        shardingRule = new ShardingRule(shardingRuleConfig, 
createDataSourceMap(), Sets.newHashSet());
+        shardingRule = new ShardingRule(shardingRuleConfig, 
createDataSourceMap());
     }
     
     @Test
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java
index 93bb095..75ef282 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/rule/ShardingRuleTest.java
@@ -17,7 +17,6 @@
 
 package org.apache.shardingsphere.sharding.rule;
 
-import com.google.common.collect.Sets;
 import 
org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmConfiguration;
 import 
org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurationException;
 import org.apache.shardingsphere.infra.datanode.DataNode;
@@ -52,7 +51,7 @@ public final class ShardingRuleTest {
     
     @Test(expected = IllegalArgumentException.class)
     public void assertNewShardingRuleWithEmptyDataSourceNames() {
-        new ShardingRule(new ShardingRuleConfiguration(), 
Collections.emptyMap(), Sets.newHashSet());
+        new ShardingRule(new ShardingRuleConfiguration(), 
Collections.emptyMap());
     }
     
     @Test
@@ -203,7 +202,7 @@ public final class ShardingRuleTest {
         
shardingRuleConfig.getTables().add(createTableRuleConfigWithAllStrategies());
         shardingRuleConfig.setDefaultDatabaseShardingStrategy(new 
StandardShardingStrategyConfiguration("column", "STANDARD_TEST"));
         shardingRuleConfig.getShardingAlgorithms().put("standard", new 
ShardingSphereAlgorithmConfiguration("STANDARD_TEST", new Properties()));
-        assertTrue(new ShardingRule(shardingRuleConfig, createDataSourceMap(), 
Sets.newHashSet()).isShardingColumn("column", "LOGIC_TABLE"));
+        assertTrue(new ShardingRule(shardingRuleConfig, 
createDataSourceMap()).isShardingColumn("column", "LOGIC_TABLE"));
     }
     
     @Test
@@ -212,7 +211,7 @@ public final class ShardingRuleTest {
         
shardingRuleConfig.getTables().add(createTableRuleConfigWithAllStrategies());
         shardingRuleConfig.setDefaultTableShardingStrategy(new 
StandardShardingStrategyConfiguration("column", "STANDARD_TEST"));
         shardingRuleConfig.getShardingAlgorithms().put("standard", new 
ShardingSphereAlgorithmConfiguration("STANDARD_TEST", new Properties()));
-        assertTrue(new ShardingRule(shardingRuleConfig, createDataSourceMap(), 
Sets.newHashSet()).isShardingColumn("column", "LOGIC_TABLE"));
+        assertTrue(new ShardingRule(shardingRuleConfig, 
createDataSourceMap()).isShardingColumn("column", "LOGIC_TABLE"));
     }
     
     @Test
@@ -220,7 +219,7 @@ public final class ShardingRuleTest {
         ShardingRuleConfiguration shardingRuleConfig = new 
ShardingRuleConfiguration();
         
shardingRuleConfig.getTables().add(createTableRuleConfigWithAllStrategies());
         shardingRuleConfig.getShardingAlgorithms().put("standard", new 
ShardingSphereAlgorithmConfiguration("STANDARD_TEST", new Properties()));
-        assertTrue(new ShardingRule(shardingRuleConfig, createDataSourceMap(), 
Sets.newHashSet()).isShardingColumn("column", "logic_Table"));
+        assertTrue(new ShardingRule(shardingRuleConfig, 
createDataSourceMap()).isShardingColumn("column", "logic_Table"));
     }
     
     @Test
@@ -228,14 +227,14 @@ public final class ShardingRuleTest {
         ShardingRuleConfiguration shardingRuleConfig = new 
ShardingRuleConfiguration();
         
shardingRuleConfig.getTables().add(createTableRuleConfigWithTableStrategies());
         shardingRuleConfig.getShardingAlgorithms().put("standard", new 
ShardingSphereAlgorithmConfiguration("STANDARD_TEST", new Properties()));
-        assertTrue(new ShardingRule(shardingRuleConfig, createDataSourceMap(), 
Sets.newHashSet()).isShardingColumn("column", "logic_Table"));
+        assertTrue(new ShardingRule(shardingRuleConfig, 
createDataSourceMap()).isShardingColumn("column", "logic_Table"));
     }
     
     @Test
     public void assertIsNotShardingColumn() {
         ShardingRuleConfiguration shardingRuleConfig = new 
ShardingRuleConfiguration();
         
shardingRuleConfig.getTables().add(createTableRuleConfigWithAllStrategies());
-        assertFalse(new ShardingRule(shardingRuleConfig, 
createDataSourceMap(), Sets.newHashSet()).isShardingColumn("column", 
"other_Table"));
+        assertFalse(new ShardingRule(shardingRuleConfig, 
createDataSourceMap()).isShardingColumn("column", "other_Table"));
     }
     
     @Test
@@ -279,7 +278,7 @@ public final class ShardingRuleTest {
         ShardingRuleConfiguration shardingRuleConfig = new 
ShardingRuleConfiguration();
         ShardingTableRuleConfiguration shardingTableRuleConfig = 
createTableRuleConfiguration("LOGIC_TABLE", "pr_ds_${0..1}.table_${0..2}");
         shardingRuleConfig.getTables().add(shardingTableRuleConfig);
-        new ShardingRule(shardingRuleConfig, Collections.emptyMap(), 
Sets.newHashSet());
+        new ShardingRule(shardingRuleConfig, Collections.emptyMap());
     }
     
     @Test
@@ -313,7 +312,7 @@ public final class ShardingRuleTest {
         Properties props = new Properties();
         props.put("sharding-count", 4);
         shardingRuleConfig.getShardingAlgorithms().put("hash_mod", new 
ShardingSphereAlgorithmConfiguration("hash_mod", props));
-        ShardingRule shardingRule = new ShardingRule(shardingRuleConfig, 
createDataSourceMap(), Sets.newHashSet());
+        ShardingRule shardingRule = new ShardingRule(shardingRuleConfig, 
createDataSourceMap());
         assertThat(shardingRule.getDataSourceNames(), is(new 
LinkedHashSet<>(Arrays.asList("ds_0", "ds_1", "resource0", "resource1"))));
     }
     
@@ -322,7 +321,7 @@ public final class ShardingRuleTest {
         ShardingRuleConfiguration shardingRuleConfig = new 
ShardingRuleConfiguration();
         ShardingTableRuleConfiguration shardingTableRuleConfig = new 
ShardingTableRuleConfiguration("LOGIC_TABLE", "ds_${0..1}.table_${0..2}");
         shardingRuleConfig.getTables().add(shardingTableRuleConfig);
-        ShardingRule shardingRule = new ShardingRule(shardingRuleConfig, 
createDataSourceMap(), Sets.newHashSet());
+        ShardingRule shardingRule = new ShardingRule(shardingRuleConfig, 
createDataSourceMap());
         assertThat(shardingRule.getDataSourceNames(), is(new 
LinkedHashSet<>(Arrays.asList("ds_0", "ds_1"))));
     }
     
@@ -349,14 +348,14 @@ public final class ShardingRuleTest {
         shardingRuleConfig.getShardingAlgorithms().put("standard", new 
ShardingSphereAlgorithmConfiguration("STANDARD_TEST", new Properties()));
         shardingRuleConfig.getKeyGenerators().put("increment", new 
ShardingSphereAlgorithmConfiguration("INCREMENT", new Properties()));
         shardingRuleConfig.getKeyGenerators().put("default", new 
ShardingSphereAlgorithmConfiguration("INCREMENT", new Properties()));
-        return new ShardingRule(shardingRuleConfig, createDataSourceMap(), 
Sets.newHashSet());
+        return new ShardingRule(shardingRuleConfig, createDataSourceMap());
     }
     
     private ShardingRule createMinimumShardingRule() {
         ShardingRuleConfiguration shardingRuleConfig = new 
ShardingRuleConfiguration();
         ShardingTableRuleConfiguration shardingTableRuleConfig = 
createTableRuleConfiguration("LOGIC_TABLE", "ds_${0..1}.table_${0..2}");
         shardingRuleConfig.getTables().add(shardingTableRuleConfig);
-        return new ShardingRule(shardingRuleConfig, createDataSourceMap(), 
Sets.newHashSet());
+        return new ShardingRule(shardingRuleConfig, createDataSourceMap());
     }
     
     private ShardingTableRuleConfiguration createTableRuleConfiguration(final 
String logicTableName, final String actualDataNodes) {
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/constant/SingleTableOrder.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/constant/SingleTableOrder.java
index 1a37b29..7d11210 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/constant/SingleTableOrder.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/constant/SingleTableOrder.java
@@ -29,5 +29,10 @@ public final class SingleTableOrder {
     /**
      * Single table order.
      */
-    public static final int ORDER = 5;
+    public static final int ORDER = 10;
+    
+    /**
+     * Rule builder single table order.
+     */
+    public static final int RULE_BUILDER_ORDER = -ORDER;
 }
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/ShardingSphereRulesBuilder.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/ShardingSphereRulesBuilder.java
index fffc81a..1090145 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/ShardingSphereRulesBuilder.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/ShardingSphereRulesBuilder.java
@@ -34,8 +34,8 @@ import 
org.apache.shardingsphere.infra.spi.ordered.OrderedSPIRegistry;
 
 import javax.sql.DataSource;
 import java.util.Collection;
+import java.util.Comparator;
 import java.util.HashMap;
-import java.util.HashSet;
 import java.util.LinkedList;
 import java.util.Map;
 import java.util.Map.Entry;
@@ -65,10 +65,14 @@ public final class ShardingSphereRulesBuilder {
     @SuppressWarnings({"unchecked", "rawtypes"})
     public static Collection<ShardingSphereRule> buildSchemaRules(final String 
schemaName, final Collection<RuleConfiguration> schemaRuleConfigurations,
                                                                   final 
DatabaseType databaseType, final Map<String, DataSource> dataSourceMap) {
-        Map<RuleConfiguration, SchemaRuleBuilder> builders = 
OrderedSPIRegistry.getRegisteredServices(getAllSchemaRuleConfigurations(schemaRuleConfigurations),
 SchemaRuleBuilder.class);
+        Map<RuleConfiguration, SchemaRuleBuilder> builders = 
OrderedSPIRegistry.getRegisteredServices(
+                getAllSchemaRuleConfigurations(schemaRuleConfigurations), 
SchemaRuleBuilder.class, Comparator.reverseOrder());
         appendDefaultKernelSchemaRuleConfigurationBuilder(builders);
-        Collection<String> occupiedTables = new HashSet<>();
-        return builders.entrySet().stream().map(entry -> 
entry.getValue().build(schemaName, dataSourceMap, databaseType, entry.getKey(), 
occupiedTables)).collect(Collectors.toList());
+        Collection<ShardingSphereRule> result = new LinkedList<>();
+        for (Map.Entry<RuleConfiguration, SchemaRuleBuilder> entry : 
builders.entrySet()) {
+            result.add(entry.getValue().build(schemaName, dataSourceMap, 
databaseType, entry.getKey(), result));
+        }
+        return result;
     }
     
     private static Collection<RuleConfiguration> 
getAllSchemaRuleConfigurations(final Collection<RuleConfiguration> 
schemaRuleConfigurations) {
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/scope/SchemaRuleBuilder.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/scope/SchemaRuleBuilder.java
index 8d37c84..5550966 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/scope/SchemaRuleBuilder.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/scope/SchemaRuleBuilder.java
@@ -19,6 +19,7 @@ package org.apache.shardingsphere.infra.rule.builder.scope;
 
 import org.apache.shardingsphere.infra.config.RuleConfiguration;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.scope.SchemaRule;
 
 import javax.sql.DataSource;
@@ -39,8 +40,8 @@ public interface SchemaRuleBuilder<T extends 
RuleConfiguration> extends RuleBuil
      * @param dataSourceMap dataSource map
      * @param databaseType database type
      * @param config rule configuration
-     * @param occupiedTables occupied tables
+     * @param rules rules
      * @return built schema rule
      */
-    SchemaRule build(String schemaName, Map<String, DataSource> dataSourceMap, 
DatabaseType databaseType, T config, Collection<String> occupiedTables);
+    SchemaRule build(String schemaName, Map<String, DataSource> dataSourceMap, 
DatabaseType databaseType, T config, Collection<ShardingSphereRule> rules);
 }
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/single/SingleTableRuleBuilder.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/single/SingleTableRuleBuilder.java
index 2f0ec7a..665b840 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/single/SingleTableRuleBuilder.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/builder/single/SingleTableRuleBuilder.java
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.infra.rule.builder.single;
 import 
org.apache.shardingsphere.infra.config.single.SingleTableRuleConfiguration;
 import org.apache.shardingsphere.infra.constant.SingleTableOrder;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.builder.level.FeatureRuleBuilder;
 import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
 import org.apache.shardingsphere.infra.rule.single.SingleTableRule;
@@ -35,13 +36,13 @@ public final class SingleTableRuleBuilder implements 
FeatureRuleBuilder, SchemaR
     
     @Override
     public SingleTableRule build(final String schemaName, final Map<String, 
DataSource> dataSourceMap, final DatabaseType databaseType, 
-                                 final SingleTableRuleConfiguration config, 
final Collection<String> occupiedTables) {
-        return new SingleTableRule(databaseType, dataSourceMap, 
occupiedTables);
+                                 final SingleTableRuleConfiguration config, 
final Collection<ShardingSphereRule> rules) {
+        return new SingleTableRule(databaseType, dataSourceMap, rules);
     }
     
     @Override
     public int getOrder() {
-        return SingleTableOrder.ORDER;
+        return SingleTableOrder.RULE_BUILDER_ORDER;
     }
     
     @Override
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/checker/single/SingleTableRuleConfigurationChecker.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/checker/single/SingleTableRuleConfigurationChecker.java
index 044da2c..e82d89c 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/checker/single/SingleTableRuleConfigurationChecker.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/checker/single/SingleTableRuleConfigurationChecker.java
@@ -32,7 +32,7 @@ public final class SingleTableRuleConfigurationChecker 
implements RuleConfigurat
     
     @Override
     public int getOrder() {
-        return SingleTableOrder.ORDER;
+        return SingleTableOrder.RULE_BUILDER_ORDER;
     }
     
     @Override
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/single/SingleTableDataNodeLoader.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/single/SingleTableDataNodeLoader.java
index b018871..fe77814 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/single/SingleTableDataNodeLoader.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/single/SingleTableDataNodeLoader.java
@@ -17,6 +17,7 @@
 
 package org.apache.shardingsphere.infra.rule.single;
 
+import com.google.common.base.Preconditions;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import 
org.apache.shardingsphere.infra.config.exception.ShardingSphereConfigurationException;
@@ -49,8 +50,7 @@ public final class SingleTableDataNodeLoader {
         Map<String, SingleTableDataNode> result = new HashMap<>();
         for (Entry<String, DataSource> entry : dataSourceMap.entrySet()) {
             Map<String, SingleTableDataNode> singleTableDataNodes = 
load(databaseType, entry.getKey(), entry.getValue(), excludedTables);
-            // TODO recover check single table must be unique. Current 
situation cannot recognize replica query rule or databaseDiscovery rule for 
single table duplicate. 
-//            singleTableDataNodes.keySet().forEach(each -> 
Preconditions.checkState(!result.containsKey(each), "Single table conflict, 
there are multiple tables `%s` existed.", each));
+            singleTableDataNodes.keySet().forEach(each -> 
Preconditions.checkState(!result.containsKey(each), "Single table conflict, 
there are multiple tables `%s` existed.", each));
             result.putAll(singleTableDataNodes);
         }
         return result;
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/single/SingleTableRule.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/single/SingleTableRule.java
index 867546b..456304d 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/single/SingleTableRule.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/rule/single/SingleTableRule.java
@@ -20,11 +20,15 @@ package org.apache.shardingsphere.infra.rule.single;
 import com.google.common.collect.Sets;
 import lombok.Getter;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.level.FeatureRule;
 import org.apache.shardingsphere.infra.rule.scope.SchemaRule;
+import org.apache.shardingsphere.infra.rule.type.DataNodeContainedRule;
+import org.apache.shardingsphere.infra.rule.type.DataSourceContainedRule;
 
 import javax.sql.DataSource;
 import java.util.Collection;
+import java.util.HashMap;
 import java.util.LinkedList;
 import java.util.Map;
 import java.util.stream.Collectors;
@@ -39,9 +43,34 @@ public final class SingleTableRule implements FeatureRule, 
SchemaRule {
     
     private final Map<String, SingleTableDataNode> singleTableDataNodes;
     
-    public SingleTableRule(final DatabaseType databaseType, final Map<String, 
DataSource> dataSourceMap, final Collection<String> occupiedTables) {
-        dataSourceNames = dataSourceMap.keySet();
-        singleTableDataNodes = SingleTableDataNodeLoader.load(databaseType, 
dataSourceMap, occupiedTables);
+    public SingleTableRule(final DatabaseType databaseType, final Map<String, 
DataSource> dataSourceMap, final Collection<ShardingSphereRule> rules) {
+        Map<String, DataSource> aggregateDataSourceMap = 
getAggregateDataSourceMap(dataSourceMap, rules);
+        dataSourceNames = aggregateDataSourceMap.keySet();
+        singleTableDataNodes = SingleTableDataNodeLoader.load(databaseType, 
aggregateDataSourceMap, getExcludedTables(rules));
+    }
+    
+    private Map<String, DataSource> getAggregateDataSourceMap(final 
Map<String, DataSource> dataSourceMap, final Collection<ShardingSphereRule> 
rules) {
+        Map<String, DataSource> result = new HashMap<>(dataSourceMap);
+        for (ShardingSphereRule each : rules) {
+            if (each instanceof DataSourceContainedRule) {
+                result = getAggregateDataSourceMap(result, 
(DataSourceContainedRule) each);
+            }
+        }
+        return result;
+    }
+    
+    private Map<String, DataSource> getAggregateDataSourceMap(final 
Map<String, DataSource> dataSourceMap, final DataSourceContainedRule each) {
+        Map<String, DataSource> result = new HashMap<>();
+        for (Map.Entry<String, Collection<String>> entry : 
each.getDataSourceMapper().entrySet()) {
+            Collection<String> actualDataSources = entry.getValue();
+            for (String actualDataSource : actualDataSources) {
+                if (dataSourceMap.containsKey(actualDataSource)) {
+                    result.put(entry.getKey(), 
dataSourceMap.remove(actualDataSource));
+                }
+            }
+        }
+        result.putAll(dataSourceMap);
+        return result;
     }
     
     /**
@@ -86,4 +115,8 @@ public final class SingleTableRule implements FeatureRule, 
SchemaRule {
     public void dropSingleTableDataNode(final String tableName) {
         singleTableDataNodes.remove(tableName);
     }
+    
+    private Collection<String> getExcludedTables(final 
Collection<ShardingSphereRule> rules) {
+        return rules.stream().filter(each -> each instanceof 
DataNodeContainedRule).flatMap(each -> ((DataNodeContainedRule) 
each).getAllTables().stream()).collect(Collectors.toList());
+    }
 }
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/spi/ordered/OrderedSPIRegistry.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/spi/ordered/OrderedSPIRegistry.java
index 5d547b8..8072704 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/spi/ordered/OrderedSPIRegistry.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/spi/ordered/OrderedSPIRegistry.java
@@ -25,6 +25,7 @@ import 
org.apache.shardingsphere.infra.spi.ordered.cache.CachedOrderedServices;
 import org.apache.shardingsphere.infra.spi.ordered.cache.OrderedServicesCache;
 
 import java.util.Collection;
+import java.util.Comparator;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Optional;
@@ -62,13 +63,27 @@ public final class OrderedSPIRegistry {
      * @param <V> type of ordered SPI class
      * @return registered services
      */
-    @SuppressWarnings("unchecked")
     public static <K, V extends OrderedSPI<?>> Map<K, V> 
getRegisteredServices(final Collection<K> types, final Class<V> 
orderedSPIClass) {
+        return getRegisteredServices(types, orderedSPIClass, 
Comparator.naturalOrder());
+    }
+    
+    /**
+     * Get registered services.
+     *
+     * @param types types
+     * @param orderedSPIClass class of ordered SPI
+     * @param <K> type of key
+     * @param <V> type of ordered SPI class
+     * @param comparator comparator
+     * @return registered services
+     */
+    @SuppressWarnings("unchecked")
+    public static <K, V extends OrderedSPI<?>> Map<K, V> 
getRegisteredServices(final Collection<K> types, final Class<V> 
orderedSPIClass, final Comparator<Integer> comparator) {
         Optional<CachedOrderedServices> cachedServices = 
OrderedServicesCache.findCachedServices(types, orderedSPIClass);
         if (cachedServices.isPresent()) {
             return (Map<K, V>) cachedServices.get().getServices();
         }
-        Collection<V> registeredServices = 
getRegisteredServices(orderedSPIClass);
+        Collection<V> registeredServices = 
getRegisteredServices(orderedSPIClass, comparator);
         Map<K, V> result = new LinkedHashMap<>(registeredServices.size(), 1);
         for (V each : registeredServices) {
             types.stream().filter(type -> each.getTypeClass() == 
type.getClass()).forEach(type -> result.put(type, each));
@@ -85,7 +100,19 @@ public final class OrderedSPIRegistry {
      * @return registered services
      */
     public static <T extends OrderedSPI<?>> Collection<T> 
getRegisteredServices(final Class<T> orderedSPIClass) {
-        Map<Integer, T> result = new TreeMap<>();
+        return getRegisteredServices(orderedSPIClass, 
Comparator.naturalOrder());
+    }
+    
+    /**
+     * Get registered services.
+     *
+     * @param orderedSPIClass class of ordered SPI
+     * @param <T> type of ordered SPI class
+     * @param comparator comparator
+     * @return registered services
+     */
+    public static <T extends OrderedSPI<?>> Collection<T> 
getRegisteredServices(final Class<T> orderedSPIClass, final Comparator<Integer> 
comparator) {
+        Map<Integer, T> result = new TreeMap<>(comparator);
         for (T each : 
ShardingSphereServiceLoader.getSingletonServiceInstances(orderedSPIClass)) {
             Preconditions.checkArgument(!result.containsKey(each.getOrder()), 
"Found same order `%s` with `%s` and `%s`", each.getOrder(), 
result.get(each.getOrder()), each);
             result.put(each.getOrder(), each);
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/fixture/TestShardingSphereRuleBuilder.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/fixture/TestShardingSphereRuleBuilder.java
index 6651127..17398ef 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/fixture/TestShardingSphereRuleBuilder.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/fixture/TestShardingSphereRuleBuilder.java
@@ -19,6 +19,7 @@ package org.apache.shardingsphere.infra.rule.fixture;
 
 import lombok.Getter;
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
 import org.apache.shardingsphere.infra.rule.scope.SchemaRule;
 
@@ -33,7 +34,7 @@ public final class TestShardingSphereRuleBuilder implements 
SchemaRuleBuilder<Te
     
     @Override
     public SchemaRule build(final String schemaName, final Map<String, 
DataSource> dataSourceMap, final DatabaseType databaseType, 
-                            final TestRuleConfiguration config, final 
Collection<String> occupiedTables) {
+                            final TestRuleConfiguration config, final 
Collection<ShardingSphereRule> rules) {
         return RULE;
     }
     
diff --git 
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/single/SingleTableDataNodeLoaderTest.java
 
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/single/SingleTableDataNodeLoaderTest.java
index 5fbf229..aca3bdd 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/single/SingleTableDataNodeLoaderTest.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/rule/single/SingleTableDataNodeLoaderTest.java
@@ -54,7 +54,7 @@ public final class SingleTableDataNodeLoaderTest {
     @Before
     public void setUp() throws SQLException {
         dataSourceMap = new HashMap<>(2, 1);
-        dataSourceMap.put("ds0", mockDataSource("ds0", 
Arrays.asList("employee", "dept", "salary")));
+        dataSourceMap.put("ds0", mockDataSource("ds0", 
Arrays.asList("employee", "dept")));
         dataSourceMap.put("ds1", mockDataSource("ds1", 
Arrays.asList("student", "teacher", "class", "salary")));
     }
     
diff --git 
a/shardingsphere-infra/shardingsphere-infra-context/src/test/java/org/apache/shardingsphere/infra/context/fixture/FixtureRuleBuilder.java
 
b/shardingsphere-infra/shardingsphere-infra-context/src/test/java/org/apache/shardingsphere/infra/context/fixture/FixtureRuleBuilder.java
index 2e35230..db535f2 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-context/src/test/java/org/apache/shardingsphere/infra/context/fixture/FixtureRuleBuilder.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-context/src/test/java/org/apache/shardingsphere/infra/context/fixture/FixtureRuleBuilder.java
@@ -18,6 +18,7 @@
 package org.apache.shardingsphere.infra.context.fixture;
 
 import org.apache.shardingsphere.infra.database.type.DatabaseType;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.builder.scope.SchemaRuleBuilder;
 
 import javax.sql.DataSource;
@@ -28,7 +29,7 @@ public final class FixtureRuleBuilder implements 
SchemaRuleBuilder<FixtureRuleCo
     
     @Override
     public FixtureRule build(final String schemaName, final Map<String, 
DataSource> dataSourceMap, final DatabaseType databaseType, 
-                             final FixtureRuleConfiguration config, final 
Collection<String> occupiedTables) {
+                             final FixtureRuleConfiguration config, final 
Collection<ShardingSphereRule> rules) {
         return new FixtureRule();
     }
     
diff --git 
a/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/SingleTableSQLRouter.java
 
b/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/SingleTableSQLRouter.java
index 6f16514..38f3663 100644
--- 
a/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/SingleTableSQLRouter.java
+++ 
b/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/SingleTableSQLRouter.java
@@ -62,7 +62,7 @@ public final class SingleTableSQLRouter implements 
SQLRouter<SingleTableRule> {
     }
     
     private void validateSameDataSource(final SingleTableRule rule, final 
SQLStatementContext<?> sqlStatementContext, final Collection<String> 
singleTableNames) {
-        if (!(sqlStatementContext instanceof SelectStatementContext) && 
!rule.isSingleTableInSameDataSource(singleTableNames)) {
+        if (!(sqlStatementContext instanceof SelectStatementContext || 
rule.isSingleTableInSameDataSource(singleTableNames))) {
             throw new ShardingSphereException("Single tables must be in the 
same datasource.");
         }
     }
diff --git 
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/datasource/metadata/ShardingSphereDatabaseMetaDataTest.java
 
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/datasource/metadata/ShardingSphereDatabaseMetaDataTest.java
index 775cef4..1287c45 100644
--- 
a/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/datasource/metadata/ShardingSphereDatabaseMetaDataTest.java
+++ 
b/shardingsphere-jdbc/shardingsphere-jdbc-core/src/test/java/org/apache/shardingsphere/driver/jdbc/core/datasource/metadata/ShardingSphereDatabaseMetaDataTest.java
@@ -18,7 +18,6 @@
 package org.apache.shardingsphere.driver.jdbc.core.datasource.metadata;
 
 import com.google.common.collect.LinkedHashMultimap;
-import com.google.common.collect.Sets;
 import 
org.apache.shardingsphere.driver.jdbc.core.connection.ShardingSphereConnection;
 import 
org.apache.shardingsphere.driver.jdbc.core.resultset.DatabaseMetaDataResultSet;
 import org.apache.shardingsphere.infra.context.metadata.MetaDataContexts;
@@ -105,7 +104,7 @@ public final class ShardingSphereDatabaseMetaDataTest {
         ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
         ShardingTableRuleConfiguration shardingTableRuleConfig = new 
ShardingTableRuleConfiguration(TABLE_NAME, DATA_SOURCE_NAME + "." + TABLE_NAME);
         
ruleConfig.setTables(Collections.singletonList(shardingTableRuleConfig));
-        return new ShardingRule(ruleConfig, 
Collections.singletonMap(DATA_SOURCE_NAME, mock(DataSource.class, 
RETURNS_DEEP_STUBS)), Sets.newHashSet());
+        return new ShardingRule(ruleConfig, 
Collections.singletonMap(DATA_SOURCE_NAME, mock(DataSource.class, 
RETURNS_DEEP_STUBS)));
     }
     
     @Test
diff --git 
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/internal/datasource/GovernanceShardingSphereDataSourceTest.java
 
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/internal/datasource/GovernanceShardingSphereDataSourceTest.java
index 6b78030..4c76aef 100644
--- 
a/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/internal/datasource/GovernanceShardingSphereDataSourceTest.java
+++ 
b/shardingsphere-jdbc/shardingsphere-jdbc-governance/src/test/java/org/apache/shardingsphere/driver/governance/internal/datasource/GovernanceShardingSphereDataSourceTest.java
@@ -32,7 +32,6 @@ import 
org.apache.shardingsphere.infra.config.algorithm.ShardingSphereAlgorithmC
 import 
org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
 import 
org.apache.shardingsphere.infra.config.properties.ConfigurationPropertyKey;
 import org.apache.shardingsphere.infra.database.DefaultSchema;
-import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import 
org.apache.shardingsphere.readwritesplitting.api.ReadwriteSplittingRuleConfiguration;
 import 
org.apache.shardingsphere.readwritesplitting.api.rule.ReadwriteSplittingDataSourceRuleConfiguration;
 import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
@@ -48,15 +47,16 @@ import java.sql.Connection;
 import java.sql.SQLException;
 import java.util.Arrays;
 import java.util.Collections;
-import java.util.Iterator;
 import java.util.LinkedHashMap;
 import java.util.Map;
 import java.util.Objects;
+import java.util.Optional;
 import java.util.Properties;
 
 import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
 
 public final class GovernanceShardingSphereDataSourceTest {
     
@@ -90,8 +90,10 @@ public final class GovernanceShardingSphereDataSourceTest {
     @Test
     public void assertRenewRules() throws SQLException {
         metaDataContexts.renew(new 
RuleConfigurationsChangedEvent(DefaultSchema.LOGIC_NAME, 
Arrays.asList(getShardingRuleConfiguration(), 
getReadwriteSplittingRuleConfiguration())));
-        Iterator<ShardingSphereRule> iterator = 
metaDataContexts.getDefaultMetaData().getRuleMetaData().getRules().iterator();
-        assertThat(((ShardingRule) iterator.next()).getTableRules().size(), 
is(1));
+        Optional<ShardingRule> rule = 
metaDataContexts.getDefaultMetaData().getRuleMetaData().getRules().stream()
+                .filter(each -> each instanceof ShardingRule).map(each -> 
(ShardingRule) each).findFirst();
+        assertTrue(rule.isPresent());
+        assertThat(rule.get().getTableRules().size(), is(1));
     }
     
     private ShardingRuleConfiguration getShardingRuleConfiguration() {
diff --git 
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/governance/type/GovernanceSpringBootReadwriteSplittingTest.java
 
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/governance/type/GovernanceSpringBootRe
 [...]
index 2ecc26c..15e56d4 100644
--- 
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/governance/type/GovernanceSpringBootReadwriteSplittingTest.java
+++ 
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-boot-starter/src/test/java/org/apache/shardingsphere/spring/boot/governance/type/GovernanceSpringBootReadwriteSplittingTest.java
@@ -20,8 +20,6 @@ package org.apache.shardingsphere.spring.boot.governance.type;
 import org.apache.commons.dbcp2.BasicDataSource;
 import 
org.apache.shardingsphere.driver.governance.internal.datasource.GovernanceShardingSphereDataSource;
 import org.apache.shardingsphere.infra.context.metadata.MetaDataContexts;
-import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
-import org.apache.shardingsphere.infra.rule.single.SingleTableRule;
 import 
org.apache.shardingsphere.readwritesplitting.rule.ReadwriteSplittingDataSourceRule;
 import 
org.apache.shardingsphere.readwritesplitting.rule.ReadwriteSplittingRule;
 import 
org.apache.shardingsphere.spring.boot.governance.util.EmbedTestingServer;
@@ -36,10 +34,8 @@ import 
org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
 import javax.annotation.Resource;
 import javax.sql.DataSource;
 import java.lang.reflect.Field;
-import java.util.Collection;
-import java.util.Iterator;
+import java.util.Optional;
 
-import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
 import static org.junit.Assert.assertTrue;
@@ -68,11 +64,10 @@ public class GovernanceSpringBootReadwriteSplittingTest {
             assertThat(((BasicDataSource) each).getMaxTotal(), is(16));
             assertThat(((BasicDataSource) each).getUsername(), is("sa"));
         }
-        Collection<ShardingSphereRule> rules = 
metaDataContexts.getDefaultMetaData().getRuleMetaData().getRules();
-        assertThat(rules.size(), is(2));
-        Iterator<ShardingSphereRule> iterator = rules.iterator();
-        assertThat(iterator.next(), instanceOf(SingleTableRule.class));
-        assertReadwriteSplittingRule((ReadwriteSplittingRule) iterator.next());
+        Optional<ReadwriteSplittingRule> rule = 
metaDataContexts.getDefaultMetaData().getRuleMetaData().getRules().stream().filter(each
 
+            -> each instanceof ReadwriteSplittingRule).map(each -> 
(ReadwriteSplittingRule) each).findFirst();
+        assertTrue(rule.isPresent());
+        assertReadwriteSplittingRule(rule.get());
     }
     
     private void assertReadwriteSplittingRule(final ReadwriteSplittingRule 
rule) {
diff --git 
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/GovernanceReadwriteSplittingNamespaceTest.java
 
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/GovernanceReadwriteSplittingN
 [...]
index 9cf603a..1605988 100644
--- 
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/GovernanceReadwriteSplittingNamespaceTest.java
+++ 
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/GovernanceReadwriteSplittingNamespaceTest.java
@@ -21,8 +21,6 @@ import 
org.apache.shardingsphere.driver.governance.internal.datasource.Governanc
 import 
org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;
 import 
org.apache.shardingsphere.infra.config.properties.ConfigurationPropertyKey;
 import org.apache.shardingsphere.infra.context.metadata.MetaDataContexts;
-import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
-import org.apache.shardingsphere.infra.rule.single.SingleTableRule;
 import 
org.apache.shardingsphere.readwritesplitting.algorithm.RandomReplicaLoadBalanceAlgorithm;
 import 
org.apache.shardingsphere.readwritesplitting.algorithm.RoundRobinReplicaLoadBalanceAlgorithm;
 import 
org.apache.shardingsphere.readwritesplitting.rule.ReadwriteSplittingDataSourceRule;
@@ -36,10 +34,8 @@ import org.junit.Test;
 import org.springframework.test.context.ContextConfiguration;
 import 
org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
 
-import java.util.Iterator;
 import java.util.Optional;
 
-import static org.hamcrest.CoreMatchers.instanceOf;
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertThat;
@@ -60,8 +56,9 @@ public class GovernanceReadwriteSplittingNamespaceTest 
extends AbstractJUnit4Spr
     
     @Test
     public void assertReadwriteSplittingDataSource() {
-        ReadwriteSplittingRule rule = 
getReadwriteSplittingRule("defaultGovernanceDataSource");
-        Optional<ReadwriteSplittingDataSourceRule> dataSourceRule = 
rule.findDataSourceRule("default_dbtbl_0");
+        Optional<ReadwriteSplittingRule> rule = 
getReadwriteSplittingRule("defaultGovernanceDataSource");
+        assertTrue(rule.isPresent());
+        Optional<ReadwriteSplittingDataSourceRule> dataSourceRule = 
rule.get().findDataSourceRule("default_dbtbl_0");
         assertTrue(dataSourceRule.isPresent());
         assertThat(dataSourceRule.get().getWriteDataSourceName(), 
is("dbtbl_write_0"));
         
assertTrue(dataSourceRule.get().getReadDataSourceNames().contains("dbtbl_0_read_0"));
@@ -70,12 +67,14 @@ public class GovernanceReadwriteSplittingNamespaceTest 
extends AbstractJUnit4Spr
     
     @Test
     public void assertTypeReadwriteSplittingDataSource() {
-        ReadwriteSplittingRule randomRule = 
getReadwriteSplittingRule("randomGovernanceDataSource");
-        Optional<ReadwriteSplittingDataSourceRule> randomDataSourceRule = 
randomRule.findDataSourceRule("random_dbtbl_0");
+        Optional<ReadwriteSplittingRule> randomRule = 
getReadwriteSplittingRule("randomGovernanceDataSource");
+        assertTrue(randomRule.isPresent());
+        Optional<ReadwriteSplittingDataSourceRule> randomDataSourceRule = 
randomRule.get().findDataSourceRule("random_dbtbl_0");
         assertTrue(randomDataSourceRule.isPresent());
         assertTrue(randomDataSourceRule.get().getLoadBalancer() instanceof 
RandomReplicaLoadBalanceAlgorithm);
-        ReadwriteSplittingRule roundRobinRule = 
getReadwriteSplittingRule("roundRobinGovernanceDataSource");
-        Optional<ReadwriteSplittingDataSourceRule> roundRobinDataSourceRule = 
roundRobinRule.findDataSourceRule("roundRobin_dbtbl_0");
+        Optional<ReadwriteSplittingRule> roundRobinRule = 
getReadwriteSplittingRule("roundRobinGovernanceDataSource");
+        assertTrue(roundRobinRule.isPresent());
+        Optional<ReadwriteSplittingDataSourceRule> roundRobinDataSourceRule = 
roundRobinRule.get().findDataSourceRule("roundRobin_dbtbl_0");
         assertTrue(roundRobinDataSourceRule.isPresent());
         assertTrue(roundRobinDataSourceRule.get().getLoadBalancer() instanceof 
RoundRobinReplicaLoadBalanceAlgorithm);
     }
@@ -85,18 +84,18 @@ public class GovernanceReadwriteSplittingNamespaceTest 
extends AbstractJUnit4Spr
     // TODO load balance algorithm have been construct twice for 
SpringDatasource extends ReplicaQueryDatasource.
     public void assertRefReadwriteSplittingDataSource() {
         ReplicaLoadBalanceAlgorithm randomLoadBalanceAlgorithm = 
applicationContext.getBean("randomLoadBalanceAlgorithm", 
ReplicaLoadBalanceAlgorithm.class);
-        ReadwriteSplittingRule rule = 
getReadwriteSplittingRule("refGovernanceDataSource");
-        Optional<ReadwriteSplittingDataSourceRule> dataSourceRule = 
rule.findDataSourceRule("randomLoadBalanceAlgorithm");
+        Optional<ReadwriteSplittingRule> rule = 
getReadwriteSplittingRule("refGovernanceDataSource");
+        assertTrue(rule.isPresent());
+        Optional<ReadwriteSplittingDataSourceRule> dataSourceRule = 
rule.get().findDataSourceRule("randomLoadBalanceAlgorithm");
         assertTrue(dataSourceRule.isPresent());
         assertThat(dataSourceRule.get().getLoadBalancer(), 
is(randomLoadBalanceAlgorithm));
     }
     
-    private ReadwriteSplittingRule getReadwriteSplittingRule(final String 
dataSourceName) {
+    private Optional<ReadwriteSplittingRule> getReadwriteSplittingRule(final 
String dataSourceName) {
         GovernanceShardingSphereDataSource dataSource = 
applicationContext.getBean(dataSourceName, 
GovernanceShardingSphereDataSource.class);
         MetaDataContexts metaDataContexts = (MetaDataContexts) 
FieldValueUtil.getFieldValue(dataSource, "metaDataContexts");
-        Iterator<ShardingSphereRule> iterator = 
metaDataContexts.getDefaultMetaData().getRuleMetaData().getRules().iterator();
-        assertThat(iterator.next(), instanceOf(SingleTableRule.class));
-        return (ReadwriteSplittingRule) iterator.next();
+        return 
metaDataContexts.getDefaultMetaData().getRuleMetaData().getRules().stream().filter(each
 
+            -> each instanceof ReadwriteSplittingRule).map(each -> 
(ReadwriteSplittingRule) each).findFirst();
     }
     
     @Test
diff --git 
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/GovernanceShardingReadwriteSplittingNamespaceTest.java
 
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/GovernanceShardingRea
 [...]
index 409591a..0bf1ff9 100644
--- 
a/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/GovernanceShardingReadwriteSplittingNamespaceTest.java
+++ 
b/shardingsphere-jdbc/shardingsphere-jdbc-spring/shardingsphere-jdbc-governance-spring/shardingsphere-jdbc-governance-spring-namespace/src/test/java/org/apache/shardingsphere/spring/namespace/governance/GovernanceShardingReadwriteSplittingNamespaceTest.java
@@ -19,7 +19,6 @@ package org.apache.shardingsphere.spring.namespace.governance;
 
 import 
org.apache.shardingsphere.driver.governance.internal.datasource.GovernanceShardingSphereDataSource;
 import org.apache.shardingsphere.infra.context.metadata.MetaDataContexts;
-import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
 import 
org.apache.shardingsphere.spring.namespace.governance.util.EmbedTestingServer;
 import 
org.apache.shardingsphere.spring.namespace.governance.util.FieldValueUtil;
@@ -29,12 +28,13 @@ import 
org.springframework.test.context.ContextConfiguration;
 import 
org.springframework.test.context.junit4.AbstractJUnit4SpringContextTests;
 
 import javax.sql.DataSource;
-import java.util.Iterator;
 import java.util.Map;
+import java.util.Optional;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertNotNull;
 import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
 
 @ContextConfiguration(locations = 
"classpath:META-INF/rdb/sharding-readwrite-splitting-governance.xml")
 public class GovernanceShardingReadwriteSplittingNamespaceTest extends 
AbstractJUnit4SpringContextTests {
@@ -53,9 +53,10 @@ public class 
GovernanceShardingReadwriteSplittingNamespaceTest extends AbstractJ
         assertNotNull(dataSourceMap.get("dbtbl_write_1"));
         assertNotNull(dataSourceMap.get("dbtbl_1_read_0"));
         assertNotNull(dataSourceMap.get("dbtbl_1_read_1"));
-        ShardingRule shardingRule = 
getShardingRule("dataSourceByUserStrategyGovernance");
-        assertThat(shardingRule.getTableRules().size(), is(1));
-        
assertThat(shardingRule.getTableRules().iterator().next().getLogicTable(), 
is("t_order"));
+        Optional<ShardingRule> shardingRule = 
getShardingRule("dataSourceByUserStrategyGovernance");
+        assertTrue(shardingRule.isPresent());
+        assertThat(shardingRule.get().getTableRules().size(), is(1));
+        
assertThat(shardingRule.get().getTableRules().iterator().next().getLogicTable(),
 is("t_order"));
     }
     
     private Map<String, DataSource> getDataSourceMap(final String 
dataSourceName) {
@@ -64,10 +65,9 @@ public class 
GovernanceShardingReadwriteSplittingNamespaceTest extends AbstractJ
         return 
metaDataContexts.getDefaultMetaData().getResource().getDataSources();
     }
     
-    private ShardingRule getShardingRule(final String dataSourceName) {
+    private Optional<ShardingRule> getShardingRule(final String 
dataSourceName) {
         GovernanceShardingSphereDataSource shardingSphereDataSource = 
applicationContext.getBean(dataSourceName, 
GovernanceShardingSphereDataSource.class);
         MetaDataContexts metaDataContexts = (MetaDataContexts) 
FieldValueUtil.getFieldValue(shardingSphereDataSource, "metaDataContexts");
-        Iterator<ShardingSphereRule> iterator = 
metaDataContexts.getDefaultMetaData().getRuleMetaData().getRules().iterator();
-        return (ShardingRule) iterator.next();
+        return 
metaDataContexts.getDefaultMetaData().getRuleMetaData().getRules().stream().filter(each
 -> each instanceof ShardingRule).map(each -> (ShardingRule) each).findFirst();
     }
 }
diff --git 
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/util/JobConfigurationUtil.java
 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/util/JobConfigurationUtil.java
index 51fe419..fa47667 100644
--- 
a/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/util/JobConfigurationUtil.java
+++ 
b/shardingsphere-scaling/shardingsphere-scaling-core/src/main/java/org/apache/shardingsphere/scaling/core/util/JobConfigurationUtil.java
@@ -28,8 +28,8 @@ import lombok.NoArgsConstructor;
 import org.apache.commons.collections4.CollectionUtils;
 import 
org.apache.shardingsphere.infra.config.datasource.DataSourceConfiguration;
 import 
org.apache.shardingsphere.infra.yaml.config.pojo.YamlRootRuleConfigurations;
-import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
 import 
org.apache.shardingsphere.infra.yaml.config.swapper.YamlDataSourceConfigurationSwapper;
+import org.apache.shardingsphere.infra.yaml.engine.YamlEngine;
 import org.apache.shardingsphere.scaling.core.common.datasource.JdbcUri;
 import org.apache.shardingsphere.scaling.core.config.DumperConfiguration;
 import org.apache.shardingsphere.scaling.core.config.HandleConfiguration;
@@ -224,7 +224,7 @@ public final class JobConfigurationUtil {
         ShardingRuleConfiguration sourceRuleConfig = 
ShardingRuleConfigurationSwapper.findAndConvertShardingRuleConfiguration(sourceConfig.getRootRuleConfigs().getRules());
         Map<String, DataSourceConfiguration> sourceDataSource = 
getDataSourceConfigurations(sourceConfig.getRootRuleConfigs().getDataSources());
         Map<String, DataSource> dataSourceMap = 
sourceDataSource.entrySet().stream().collect(Collectors.toMap(Map.Entry::getKey,
 entry -> entry.getValue().createDataSource()));
-        Map<String, Map<String, String>> dataSourceTableNameMap = 
toDataSourceTableNameMap(new ShardingRule(sourceRuleConfig, dataSourceMap, 
Sets.newHashSet()));
+        Map<String, Map<String, String>> dataSourceTableNameMap = 
toDataSourceTableNameMap(new ShardingRule(sourceRuleConfig, dataSourceMap));
         Optional<ShardingRuleConfiguration> targetRuleConfig = 
getTargetRuleConfiguration(jobConfig);
         filterByShardingDataSourceTables(dataSourceTableNameMap, 
jobConfig.getHandleConfig());
         Map<String, Set<String>> shardingColumnsMap = 
getShardingColumnsMap(targetRuleConfig.orElse(sourceRuleConfig));
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/db/init-sql/h2/init-db_0.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/db/init-sql/h2/init-db_0.sql
index 4abe2db..6b4bc7b 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/db/init-sql/h2/init-db_0.sql
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/db/init-sql/h2/init-db_0.sql
@@ -16,5 +16,7 @@
 --
 
 DROP TABLE IF EXISTS t_order_federate;
+DROP TABLE IF EXISTS t_single_table;
 
 CREATE TABLE t_order_federate (order_id INT NOT NULL, user_id INT NOT NULL, 
status VARCHAR(45) NULL, PRIMARY KEY (order_id));
+CREATE TABLE t_single_table (single_id INT NOT NULL, id INT NOT NULL, status 
VARCHAR(45) NULL, PRIMARY KEY (single_id));
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/db/init-sql/h2/init.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/db/init-sql/h2/init.sql
index 06e1086..0fd19c9 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/db/init-sql/h2/init.sql
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/db/init-sql/h2/init.sql
@@ -17,11 +17,9 @@
 
 DROP TABLE IF EXISTS t_order;
 DROP TABLE IF EXISTS t_order_item;
-DROP TABLE IF EXISTS t_single_table;
 DROP TABLE IF EXISTS t_broadcast_table;
 
 CREATE TABLE t_order (order_id INT NOT NULL, user_id INT NOT NULL, status 
VARCHAR(45) NULL, PRIMARY KEY (order_id));
 CREATE TABLE t_order_item (item_id INT NOT NULL, order_id INT NOT NULL, 
user_id INT NOT NULL, status VARCHAR(45) NULL, creation_date DATE, PRIMARY KEY 
(item_id));
-CREATE TABLE t_single_table (single_id INT NOT NULL, id INT NOT NULL, status 
VARCHAR(45) NULL, PRIMARY KEY (single_id));
 CREATE TABLE t_broadcast_table (id INT NOT NULL, status VARCHAR(45) NULL, 
PRIMARY KEY (id));
 CREATE INDEX order_index_t_order ON t_order (order_id);
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting/init-sql/h2/init-read_ds_0.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting/init-sql/h2/init-read_ds_0.sql
index 4abe2db..6b4bc7b 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting/init-sql/h2/init-read_ds_0.sql
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting/init-sql/h2/init-read_ds_0.sql
@@ -16,5 +16,7 @@
 --
 
 DROP TABLE IF EXISTS t_order_federate;
+DROP TABLE IF EXISTS t_single_table;
 
 CREATE TABLE t_order_federate (order_id INT NOT NULL, user_id INT NOT NULL, 
status VARCHAR(45) NULL, PRIMARY KEY (order_id));
+CREATE TABLE t_single_table (single_id INT NOT NULL, id INT NOT NULL, status 
VARCHAR(45) NULL, PRIMARY KEY (single_id));
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting/init-sql/h2/init-write_ds_0.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting/init-sql/h2/init-write_ds_0.sql
index 4abe2db..6b4bc7b 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting/init-sql/h2/init-write_ds_0.sql
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting/init-sql/h2/init-write_ds_0.sql
@@ -16,5 +16,7 @@
 --
 
 DROP TABLE IF EXISTS t_order_federate;
+DROP TABLE IF EXISTS t_single_table;
 
 CREATE TABLE t_order_federate (order_id INT NOT NULL, user_id INT NOT NULL, 
status VARCHAR(45) NULL, PRIMARY KEY (order_id));
+CREATE TABLE t_single_table (single_id INT NOT NULL, id INT NOT NULL, status 
VARCHAR(45) NULL, PRIMARY KEY (single_id));
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting/init-sql/h2/init.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting/init-sql/h2/init.sql
index 315dc79..63f093f 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting/init-sql/h2/init.sql
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting/init-sql/h2/init.sql
@@ -36,7 +36,6 @@ DROP TABLE IF EXISTS t_order_item_8;
 DROP TABLE IF EXISTS t_order_9;
 DROP TABLE IF EXISTS t_order_item_9;
 DROP TABLE IF EXISTS t_broadcast_table;
-DROP TABLE IF EXISTS t_single_table;
 
 CREATE TABLE t_order_0 (order_id INT NOT NULL, user_id INT NOT NULL, status 
VARCHAR(45) NULL, PRIMARY KEY (order_id));
 CREATE TABLE t_order_item_0 (item_id INT NOT NULL, order_id INT NOT NULL, 
user_id INT NOT NULL, status VARCHAR(45) NULL, creation_date DATE, PRIMARY KEY 
(item_id));
@@ -58,7 +57,6 @@ CREATE TABLE t_order_8 (order_id INT NOT NULL, user_id INT 
NOT NULL, status VARC
 CREATE TABLE t_order_item_8 (item_id INT NOT NULL, order_id INT NOT NULL, 
user_id INT NOT NULL, status VARCHAR(45) NULL, creation_date DATE, PRIMARY KEY 
(item_id));
 CREATE TABLE t_order_9 (order_id INT NOT NULL, user_id INT NOT NULL, status 
VARCHAR(45) NULL, PRIMARY KEY (order_id));
 CREATE TABLE t_order_item_9 (item_id INT NOT NULL, order_id INT NOT NULL, 
user_id INT NOT NULL, status VARCHAR(45) NULL, creation_date DATE, PRIMARY KEY 
(item_id));
-CREATE TABLE t_single_table (single_id INT NOT NULL, id INT NOT NULL, status 
VARCHAR(45) NULL, PRIMARY KEY (single_id));
 CREATE TABLE t_broadcast_table (id INT NOT NULL, status VARCHAR(45) NULL, 
PRIMARY KEY (id));
 CREATE INDEX order_index_t_order_0 ON t_order_0 (order_id);
 CREATE INDEX order_index_t_order_1 ON t_order_1 (order_id);
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting_and_encrypt/init-sql/h2/init-encrypt_read_ds_0.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting_and_encrypt/init-sql/h2/init-encrypt_read_ds_0.sql
index 4abe2db..6b4bc7b 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting_and_encrypt/init-sql/h2/init-encrypt_read_ds_0.sql
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting_and_encrypt/init-sql/h2/init-encrypt_read_ds_0.sql
@@ -16,5 +16,7 @@
 --
 
 DROP TABLE IF EXISTS t_order_federate;
+DROP TABLE IF EXISTS t_single_table;
 
 CREATE TABLE t_order_federate (order_id INT NOT NULL, user_id INT NOT NULL, 
status VARCHAR(45) NULL, PRIMARY KEY (order_id));
+CREATE TABLE t_single_table (single_id INT NOT NULL, id INT NOT NULL, status 
VARCHAR(45) NULL, PRIMARY KEY (single_id));
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting_and_encrypt/init-sql/h2/init-encrypt_write_ds_0.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting_and_encrypt/init-sql/h2/init-encrypt_write_ds_0.sql
index 4abe2db..6b4bc7b 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting_and_encrypt/init-sql/h2/init-encrypt_write_ds_0.sql
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting_and_encrypt/init-sql/h2/init-encrypt_write_ds_0.sql
@@ -16,5 +16,7 @@
 --
 
 DROP TABLE IF EXISTS t_order_federate;
+DROP TABLE IF EXISTS t_single_table;
 
 CREATE TABLE t_order_federate (order_id INT NOT NULL, user_id INT NOT NULL, 
status VARCHAR(45) NULL, PRIMARY KEY (order_id));
+CREATE TABLE t_single_table (single_id INT NOT NULL, id INT NOT NULL, status 
VARCHAR(45) NULL, PRIMARY KEY (single_id));
diff --git 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting_and_encrypt/init-sql/h2/init.sql
 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting_and_encrypt/init-sql/h2/init.sql
index b722d39..26936c5 100644
--- 
a/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting_and_encrypt/init-sql/h2/init.sql
+++ 
b/shardingsphere-test/shardingsphere-integration-test/shardingsphere-integration-test-suite/src/test/resources/env/dbtbl_with_readwrite_splitting_and_encrypt/init-sql/h2/init.sql
@@ -35,7 +35,6 @@ DROP TABLE IF EXISTS t_user_8;
 DROP TABLE IF EXISTS t_user_item_8;
 DROP TABLE IF EXISTS t_user_9;
 DROP TABLE IF EXISTS t_user_item_9;
-DROP TABLE IF EXISTS t_single_table;
 
 CREATE TABLE t_user_0 (user_id INT NOT NULL, address_id INT NOT NULL, 
pwd_plain VARCHAR(45) NULL, pwd_cipher VARCHAR(45) NULL, status VARCHAR(45) 
NULL, PRIMARY KEY (user_id));
 CREATE TABLE t_user_item_0 (item_id INT NOT NULL, user_id INT NOT NULL, status 
VARCHAR(45) NULL, creation_date DATE, PRIMARY KEY (item_id));
@@ -57,7 +56,6 @@ CREATE TABLE t_user_8 (user_id INT NOT NULL, address_id INT 
NOT NULL, pwd_plain
 CREATE TABLE t_user_item_8 (item_id INT NOT NULL, user_id INT NOT NULL, status 
VARCHAR(45) NULL, creation_date DATE, PRIMARY KEY (item_id));
 CREATE TABLE t_user_9 (user_id INT NOT NULL, address_id INT NOT NULL, 
pwd_plain VARCHAR(45) NULL, pwd_cipher VARCHAR(45) NULL, status VARCHAR(45) 
NULL, PRIMARY KEY (user_id));
 CREATE TABLE t_user_item_9 (item_id INT NOT NULL, user_id INT NOT NULL, status 
VARCHAR(45) NULL, creation_date DATE, PRIMARY KEY (item_id));
-CREATE TABLE t_single_table (single_id INT NOT NULL, id INT NOT NULL, status 
VARCHAR(45) NULL, PRIMARY KEY (single_id));
 CREATE INDEX user_index_t_user_0 ON t_user_0 (user_id);
 CREATE INDEX user_index_t_user_1 ON t_user_1 (user_id);
 CREATE INDEX user_index_t_user_2 ON t_user_2 (user_id);

Reply via email to