You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by me...@apache.org on 2020/09/30 05:58:49 UTC

[shardingsphere] branch master updated: Split create route context and decorate route context in route module (#7665)

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

menghaoran pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git


The following commit(s) were added to refs/heads/master by this push:
     new e5833b2  Split create route context and decorate route context in route module (#7665)
e5833b2 is described below

commit e5833b2a1bbe5ab0259542f56a1b29c37e55ea7c
Author: Liang Zhang <te...@163.com>
AuthorDate: Wed Sep 30 13:58:37 2020 +0800

    Split create route context and decorate route context in route module (#7665)
    
    * Rename RouteEngine
    
    * Rename SQLRouteEngine
    
    * Rename UnconfiguredSchemaRouter
    
    * Rename UnconfiguredSchemaSQLRouter
    
    * Add route.engine package
    
    * Rename RouteDecorator to SQLRouter
    
    * Rename SQLRouter test cases
    
    * Refactor SQLRouter
    
    * Update ConsensusReplicationRouter
    
    * Update Fixture Router
    
    * Rename ConsensusReplicationSQLRouter
    
    * Update ShadowSQLRouter
    
    * Update PrimaryReplicaReplicationSQLRouter
    
    * Update ShardingSQLRouter
    
    * Update SQLRouteEngine
    
    * Update ShadowSQLRouterTest
    
    * Update PrimaryReplicaReplicationSQLRouterTest
    
    * For checkstyle
    
    * Fix test case
---
 ...tor.java => ConsensusReplicationSQLRouter.java} | 44 +++++++++--------
 ...rg.apache.shardingsphere.infra.route.SQLRouter} |  2 +-
 .../EncryptSQLRewriterParameterizedTest.java       |  4 +-
 ...ava => PrimaryReplicaReplicationSQLRouter.java} | 26 +++++-----
 ...rg.apache.shardingsphere.infra.route.SQLRouter} |  2 +-
 ...=> PrimaryReplicaReplicationSQLRouterTest.java} | 56 +++++++++++-----------
 ...dowRouteDecorator.java => ShadowSQLRouter.java} | 50 +++++++++----------
 ...rg.apache.shardingsphere.infra.route.SQLRouter} |  2 +-
 ...DecoratorTest.java => ShadowSQLRouterTest.java} | 44 +++++++++--------
 .../MixSQLRewriterParameterizedTest.java           |  4 +-
 .../ShardingSQLRewriterParameterizedTest.java      |  4 +-
 ...gRouteDecorator.java => ShardingSQLRouter.java} | 42 +++++++++-------
 ...rg.apache.shardingsphere.infra.route.SQLRouter} |  2 +-
 .../engine/type/standard/AbstractSQLRouteTest.java |  4 +-
 .../governance/core/utils/IpUtils.java             |  7 +--
 .../infra/context/kernel/KernelProcessor.java      |  6 +--
 .../RouteDecorator.java => SQLRouter.java}         | 20 ++++++--
 ...rator.java => UnconfiguredSchemaSQLRouter.java} |  6 +--
 .../SQLRouteEngine.java}                           | 33 ++++++++-----
 .../SQLRouteEngineTest.java}                       | 22 ++++-----
 .../SQLRouterFailureFixture.java}                  | 16 +++++--
 .../SQLRouterFixture.java}                         | 18 +++++--
 ...org.apache.shardingsphere.infra.route.SQLRouter |  3 +-
 ...dingsphere.infra.route.decorator.RouteDecorator | 19 --------
 24 files changed, 229 insertions(+), 207 deletions(-)

diff --git a/shardingsphere-features/shardingsphere-consensus-replication/shardingsphere-consensus-replication-route/src/main/java/org/apache/shardingsphere/replication/consensus/route/engine/ConsensusReplicationRouteDecorator.java b/shardingsphere-features/shardingsphere-consensus-replication/shardingsphere-consensus-replication-route/src/main/java/org/apache/shardingsphere/replication/consensus/route/engine/ConsensusReplicationSQLRouter.java
similarity index 64%
rename from shardingsphere-features/shardingsphere-consensus-replication/shardingsphere-consensus-replication-route/src/main/java/org/apache/shardingsphere/replication/consensus/route/engine/ConsensusReplicationRouteDecorator.java
rename to shardingsphere-features/shardingsphere-consensus-replication/shardingsphere-consensus-replication-route/src/main/java/org/apache/shardingsphere/replication/consensus/route/engine/ConsensusReplicationSQLRouter.java
index 7e0fb69..9839c06 100644
--- a/shardingsphere-features/shardingsphere-consensus-replication/shardingsphere-consensus-replication-route/src/main/java/org/apache/shardingsphere/replication/consensus/route/engine/ConsensusReplicationRouteDecorator.java
+++ b/shardingsphere-features/shardingsphere-consensus-replication/shardingsphere-consensus-replication-route/src/main/java/org/apache/shardingsphere/replication/consensus/route/engine/ConsensusReplicationSQLRouter.java
@@ -19,57 +19,61 @@ package org.apache.shardingsphere.replication.consensus.route.engine;
 
 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.route.decorator.RouteDecorator;
 import org.apache.shardingsphere.replication.consensus.constant.ConsensusReplicationOrder;
 import org.apache.shardingsphere.replication.consensus.rule.ConsensusReplicationRule;
 import org.apache.shardingsphere.replication.consensus.rule.ConsensusReplicationTableRule;
 import org.apache.shardingsphere.sql.parser.binder.statement.SQLStatementContext;
 
 import java.util.Collection;
+import java.util.Collections;
 import java.util.HashMap;
 import java.util.List;
 import java.util.Map;
 import java.util.Optional;
 
 /**
- * Route decorator for consensus replication.
+ * Consensus replication SQL router.
  */
-public final class ConsensusReplicationRouteDecorator implements RouteDecorator<ConsensusReplicationRule> {
+public final class ConsensusReplicationSQLRouter implements SQLRouter<ConsensusReplicationRule> {
     
     @Override
-    public void decorate(final RouteContext routeContext, final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, 
-                         final ShardingSphereMetaData metaData, final ConsensusReplicationRule consensusReplicationRule, final ConfigurationProperties props) {
+    public RouteContext createRouteContext(final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, 
+                                           final ShardingSphereMetaData metaData, final ConsensusReplicationRule rule, final ConfigurationProperties props) {
+        RouteContext result = new RouteContext();
+        ConsensusReplicationTableRule replicaRoutingRule = rule.getReplicaTableRules().iterator().next();
+        ConsensusReplicationGroup replicaGroup = new ConsensusReplicationGroup(replicaRoutingRule.getPhysicsTable(), replicaRoutingRule.getReplicaGroupId(), replicaRoutingRule.getReplicaPeers(),
+                replicaRoutingRule.getDataSourceName());
+        Map<String, ConsensusReplicationGroup> replicaGroups = Collections.singletonMap(ConsensusReplicationGroup.BLANK_CONSENSUS_REPLICATION_GROUP_KEY, replicaGroup);
+        result.getRouteStageContexts().put(getTypeClass(), new ConsensusReplicationRouteStageContext(metaData.getSchemaName(), replicaGroups, sqlStatementContext.isReadOnly()));
+        return result;
+    }
+    
+    @Override
+    public void decorateRouteContext(final RouteContext routeContext, final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, 
+                                     final ShardingSphereMetaData metaData, final ConsensusReplicationRule rule, final ConfigurationProperties props) {
         Map<String, ConsensusReplicationGroup> replicaGroups = new HashMap<>();
-        String schemaName = metaData.getSchemaName();
-        if (routeContext.getRouteUnits().isEmpty()) {
-            ConsensusReplicationTableRule replicaRoutingRule = consensusReplicationRule.getReplicaTableRules().iterator().next();
-            ConsensusReplicationGroup replicaGroup = new ConsensusReplicationGroup(replicaRoutingRule.getPhysicsTable(), replicaRoutingRule.getReplicaGroupId(), replicaRoutingRule.getReplicaPeers(),
-                    replicaRoutingRule.getDataSourceName());
-            replicaGroups.put(ConsensusReplicationGroup.BLANK_CONSENSUS_REPLICATION_GROUP_KEY, replicaGroup);
-            routeContext.getRouteStageContexts().put(getTypeClass(), new ConsensusReplicationRouteStageContext(schemaName, replicaGroups, sqlStatementContext.isReadOnly()));
-            return;
-        }
         for (RouteUnit each : routeContext.getRouteUnits()) {
             Collection<RouteMapper> routeMappers = each.getTableMappers();
             if (null == routeMappers || routeMappers.isEmpty()) {
-                ConsensusReplicationTableRule tableRule = consensusReplicationRule.getReplicaTableRules().iterator().next();
+                ConsensusReplicationTableRule tableRule = rule.getReplicaTableRules().iterator().next();
                 ConsensusReplicationGroup replicaGroup = new ConsensusReplicationGroup(
                         tableRule.getPhysicsTable(), tableRule.getReplicaGroupId(), tableRule.getReplicaPeers(), tableRule.getDataSourceName());
                 replicaGroups.put(ConsensusReplicationGroup.BLANK_CONSENSUS_REPLICATION_GROUP_KEY, replicaGroup);
             } else {
-                routeReplicaGroups(routeMappers, consensusReplicationRule, replicaGroups);
+                routeReplicaGroups(routeMappers, rule, replicaGroups);
             }
         }
-        routeContext.getRouteStageContexts().put(getTypeClass(), new ConsensusReplicationRouteStageContext(schemaName, replicaGroups, sqlStatementContext.isReadOnly()));
+        routeContext.getRouteStageContexts().put(getTypeClass(), new ConsensusReplicationRouteStageContext(metaData.getSchemaName(), replicaGroups, sqlStatementContext.isReadOnly()));
     }
     
-    private void routeReplicaGroups(final Collection<RouteMapper> routeMappers, final ConsensusReplicationRule replicaRule, final Map<String, ConsensusReplicationGroup> replicaGroups) {
+    private void routeReplicaGroups(final Collection<RouteMapper> routeMappers, final ConsensusReplicationRule rule, final Map<String, ConsensusReplicationGroup> replicaGroups) {
         for (RouteMapper each : routeMappers) {
             String actualTableName = each.getActualName();
-            Optional<ConsensusReplicationTableRule> replicaRoutingRuleOptional = replicaRule.findRoutingByTable(actualTableName);
+            Optional<ConsensusReplicationTableRule> replicaRoutingRuleOptional = rule.findRoutingByTable(actualTableName);
             ConsensusReplicationGroup replicaGroup;
             if (replicaRoutingRuleOptional.isPresent()) {
                 ConsensusReplicationTableRule replicaRoutingRule = replicaRoutingRuleOptional.get();
@@ -77,7 +81,7 @@ public final class ConsensusReplicationRouteDecorator implements RouteDecorator<
                         replicaRoutingRule.getDataSourceName());
                 replicaGroups.put(actualTableName, replicaGroup);
             } else {
-                ConsensusReplicationTableRule replicaRoutingRule = replicaRule.getReplicaTableRules().iterator().next();
+                ConsensusReplicationTableRule replicaRoutingRule = rule.getReplicaTableRules().iterator().next();
                 replicaGroup = new ConsensusReplicationGroup(replicaRoutingRule.getPhysicsTable(), replicaRoutingRule.getReplicaGroupId(), replicaRoutingRule.getReplicaPeers(),
                         replicaRoutingRule.getDataSourceName());
             }
diff --git a/shardingsphere-features/shardingsphere-consensus-replication/shardingsphere-consensus-replication-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.decorator.RouteDecorator b/shardingsphere-features/shardingsphere-consensus-replication/shardingsphere-consensus-replication-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.SQLRouter
similarity index 96%
rename from shardingsphere-features/shardingsphere-consensus-replication/shardingsphere-consensus-replication-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.decorator.RouteDecorator
rename to shardingsphere-features/shardingsphere-consensus-replication/shardingsphere-consensus-replication-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.SQLRouter
index 2f5b459..3a55c2b 100644
--- a/shardingsphere-features/shardingsphere-consensus-replication/shardingsphere-consensus-replication-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.decorator.RouteDecorator
+++ b/shardingsphere-features/shardingsphere-consensus-replication/shardingsphere-consensus-replication-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.SQLRouter
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.replication.consensus.route.engine.ConsensusReplicationRouteDecorator
+org.apache.shardingsphere.replication.consensus.route.engine.ConsensusReplicationSQLRouter
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-rewrite/src/test/java/org/apache/shardingsphere/encrypt/rewrite/parameterized/EncryptSQLRewriterParameterizedTest.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-rewrite/src/test/java/org/apache/shardingsphere/encrypt/rewrite/parameterized/EncryptSQLRewriterParameterizedTest.java
index 6e6224f..36c4c10 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-rewrite/src/test/java/org/apache/shardingsphere/encrypt/rewrite/parameterized/EncryptSQLRewriterParameterizedTest.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-rewrite/src/test/java/org/apache/shardingsphere/encrypt/rewrite/parameterized/EncryptSQLRewriterParameterizedTest.java
@@ -30,7 +30,7 @@ import org.apache.shardingsphere.infra.rewrite.engine.result.SQLRewriteUnit;
 import org.apache.shardingsphere.infra.rewrite.parameterized.engine.AbstractSQLRewriterParameterizedTest;
 import org.apache.shardingsphere.infra.rewrite.parameterized.engine.parameter.SQLRewriteEngineTestParameters;
 import org.apache.shardingsphere.infra.rewrite.parameterized.engine.parameter.SQLRewriteEngineTestParametersBuilder;
-import org.apache.shardingsphere.infra.route.DataNodeRouter;
+import org.apache.shardingsphere.infra.route.engine.SQLRouteEngine;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
 import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.ShardingSphereRulesBuilder;
@@ -77,7 +77,7 @@ public final class EncryptSQLRewriterParameterizedTest extends AbstractSQLRewrit
         ConfigurationProperties props = new ConfigurationProperties(ruleConfigurations.getProps());
         SQLStatementContext<?> sqlStatementContext = SQLStatementContextFactory.newInstance(
                 metaData.getRuleSchemaMetaData().getConfiguredSchemaMetaData(), getTestParameters().getInputParameters(), standardSqlParserEngine.parse(getTestParameters().getInputSQL(), false));
-        RouteContext routeContext = new DataNodeRouter(metaData, props, rules).route(sqlStatementContext, getTestParameters().getInputSQL(), getTestParameters().getInputParameters());
+        RouteContext routeContext = new SQLRouteEngine(metaData, props, rules).route(sqlStatementContext, getTestParameters().getInputSQL(), getTestParameters().getInputParameters());
         SQLRewriteResult sqlRewriteResult = new SQLRewriteEntry(metaData.getRuleSchemaMetaData().getConfiguredSchemaMetaData(),
                 props, rules).rewrite(getTestParameters().getInputSQL(), getTestParameters().getInputParameters(), sqlStatementContext, routeContext);
         return sqlRewriteResult instanceof GenericSQLRewriteResult
diff --git a/shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/main/java/org/apache/shardingsphere/replication/primaryreplica/route/engine/PrimaryReplicaReplicationRouteDecorator.java b/shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/main/java/org/apache/shardingsphere/replication/primaryreplica/route/engine/PrimaryReplicaReplicationSQLRouter.java
similarity index 73%
rename from shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/main/java/org/apache/shardingsphere/replication/primaryreplica/route/engine/PrimaryReplicaReplicationRouteDecorator.java
rename to shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/main/java/org/apache/shardingsphere/replication/primaryreplica/route/engine/PrimaryReplicaReplicationSQLRouter.java
index f7251d4..883ffac 100644
--- a/shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/main/java/org/apache/shardingsphere/replication/primaryreplica/route/engine/PrimaryReplicaReplicationRouteDecorator.java
+++ b/shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/main/java/org/apache/shardingsphere/replication/primaryreplica/route/engine/PrimaryReplicaReplicationSQLRouter.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 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.route.decorator.RouteDecorator;
+import org.apache.shardingsphere.infra.route.SQLRouter;
 import org.apache.shardingsphere.replication.primaryreplica.constant.PrimaryReplicaReplicationOrder;
 import org.apache.shardingsphere.replication.primaryreplica.route.engine.impl.PrimaryReplicaReplicationDataSourceRouter;
 import org.apache.shardingsphere.replication.primaryreplica.rule.PrimaryReplicaReplicationDataSourceRule;
@@ -37,26 +37,22 @@ import java.util.List;
 import java.util.Optional;
 
 /**
- * Route decorator for primary-replica replication.
+ * Primary-replica replication SQL router.
  */
-public final class PrimaryReplicaReplicationRouteDecorator implements RouteDecorator<PrimaryReplicaReplicationRule> {
+public final class PrimaryReplicaReplicationSQLRouter implements SQLRouter<PrimaryReplicaReplicationRule> {
     
     @Override
-    public void decorate(final RouteContext routeContext, final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters,
-                         final ShardingSphereMetaData metaData, final PrimaryReplicaReplicationRule rule, final ConfigurationProperties props) {
-        if (routeContext.getRouteUnits().isEmpty()) {
-            firstDecorate(routeContext, sqlStatementContext, rule);
-        } else {
-            continueDecorate(routeContext, sqlStatementContext, rule);
-        }
-    }
-    
-    private void firstDecorate(final RouteContext routeContext, final SQLStatementContext<?> sqlStatementContext, final PrimaryReplicaReplicationRule rule) {
+    public RouteContext createRouteContext(final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, 
+                                           final ShardingSphereMetaData metaData, final PrimaryReplicaReplicationRule rule, final ConfigurationProperties props) {
+        RouteContext result = new RouteContext();
         String dataSourceName = new PrimaryReplicaReplicationDataSourceRouter(rule.getSingleDataSourceRule()).route(sqlStatementContext.getSqlStatement());
-        routeContext.getRouteUnits().add(new RouteUnit(new RouteMapper(DefaultSchema.LOGIC_NAME, dataSourceName), Collections.emptyList()));
+        result.getRouteUnits().add(new RouteUnit(new RouteMapper(DefaultSchema.LOGIC_NAME, dataSourceName), Collections.emptyList()));
+        return result;
     }
     
-    private void continueDecorate(final RouteContext routeContext, final SQLStatementContext<?> sqlStatementContext, final PrimaryReplicaReplicationRule rule) {
+    @Override
+    public void decorateRouteContext(final RouteContext routeContext, final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, 
+                                     final ShardingSphereMetaData metaData, final PrimaryReplicaReplicationRule rule, final ConfigurationProperties props) {
         Collection<RouteUnit> toBeRemoved = new LinkedList<>();
         Collection<RouteUnit> toBeAdded = new LinkedList<>();
         for (RouteUnit each : routeContext.getRouteUnits()) {
diff --git a/shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.decorator.RouteDecorator b/shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.SQLRouter
similarity index 95%
copy from shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.decorator.RouteDecorator
copy to shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.SQLRouter
index ab8f793..e5c2546 100644
--- a/shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.decorator.RouteDecorator
+++ b/shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.SQLRouter
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.replication.primaryreplica.route.engine.PrimaryReplicaReplicationRouteDecorator
+org.apache.shardingsphere.replication.primaryreplica.route.engine.PrimaryReplicaReplicationSQLRouter
diff --git a/shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/test/java/org/apache/shardingsphere/replication/primaryreplica/route/engine/PrimaryReplicaReplicationRouteDecoratorTest.java b/shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/test/java/org/apache/shardingsphere/replication/primaryreplica/route/engine/PrimaryReplicaReplicationSQLRouterTest.java
similarity index 75%
rename from shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/test/java/org/apache/shardingsphere/replication/primaryreplica/route/engine/PrimaryReplicaReplicationRouteDecoratorTest.java
rename to shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/test/java/org/apache/shardingsphere/replication/primaryreplica/route/engine/PrimaryReplicaReplicationSQLRouterTest.java
index abd9226..5ff091c 100644
--- a/shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/test/java/org/apache/shardingsphere/replication/primaryreplica/route/engine/PrimaryReplicaReplicationRouteDecoratorTest.java
+++ b/shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/test/java/org/apache/shardingsphere/replication/primaryreplica/route/engine/PrimaryReplicaReplicationSQLRouterTest.java
@@ -22,7 +22,7 @@ import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 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.route.decorator.RouteDecorator;
+import org.apache.shardingsphere.infra.route.SQLRouter;
 import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
 import org.apache.shardingsphere.infra.spi.order.OrderedSPIRegistry;
 import org.apache.shardingsphere.replication.primaryreplica.api.config.PrimaryReplicaReplicationRuleConfiguration;
@@ -52,7 +52,7 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 @RunWith(MockitoJUnitRunner.class)
-public final class PrimaryReplicaReplicationRouteDecoratorTest {
+public final class PrimaryReplicaReplicationSQLRouterTest {
     
     private static final String DATASOURCE_NAME = "ds";
     
@@ -67,17 +67,17 @@ public final class PrimaryReplicaReplicationRouteDecoratorTest {
     @Mock
     private SQLStatementContext<SQLStatement> sqlStatementContext;
     
-    private PrimaryReplicaReplicationRouteDecorator routeDecorator;
+    private PrimaryReplicaReplicationSQLRouter sqlRouter;
     
     static {
-        ShardingSphereServiceLoader.register(RouteDecorator.class);
+        ShardingSphereServiceLoader.register(SQLRouter.class);
     }
     
     @Before
     public void setUp() {
         rule = new PrimaryReplicaReplicationRule(new PrimaryReplicaReplicationRuleConfiguration(Collections.singleton(
                 new PrimaryReplicaReplicationDataSourceRuleConfiguration(DATASOURCE_NAME, PRIMARY_DATASOURCE, Collections.singletonList(REPLICA_DATASOURCE), null)), Collections.emptyMap()));
-        routeDecorator = (PrimaryReplicaReplicationRouteDecorator) OrderedSPIRegistry.getRegisteredServices(Collections.singleton(rule), RouteDecorator.class).get(rule);
+        sqlRouter = (PrimaryReplicaReplicationSQLRouter) OrderedSPIRegistry.getRegisteredServices(Collections.singleton(rule), SQLRouter.class).get(rule);
     }
     
     @After
@@ -86,73 +86,71 @@ public final class PrimaryReplicaReplicationRouteDecoratorTest {
     }
     
     @Test
-    public void assertDecorateToPrimary() {
-        RouteContext actual = mockRouteContext();
-        routeDecorator.decorate(actual, mock(SQLStatementContext.class), Collections.emptyList(), mock(ShardingSphereMetaData.class), rule, new ConfigurationProperties(new Properties()));
+    public void assertCreateRouteContextToPrimaryWithoutRouteUnits() {
+        RouteContext actual = sqlRouter.createRouteContext(mock(SQLStatementContext.class), 
+                Collections.emptyList(), mock(ShardingSphereMetaData.class), rule, new ConfigurationProperties(new Properties()));
         Iterator<String> routedDataSourceNames = actual.getActualDataSourceNames().iterator();
-        assertThat(routedDataSourceNames.next(), is(NON_PRIMARY_REPLICA_DATASOURCE_NAME));
         assertThat(routedDataSourceNames.next(), is(PRIMARY_DATASOURCE));
     }
     
     @Test
-    public void assertDecorateToPrimaryWithoutRouteUnits() {
-        RouteContext actual = new RouteContext();
-        routeDecorator.decorate(actual, mock(SQLStatementContext.class), Collections.emptyList(), mock(ShardingSphereMetaData.class), rule, new ConfigurationProperties(new Properties()));
+    public void assertDecorateRouteContextToPrimaryDataSource() {
+        RouteContext actual = mockRouteContext();
+        sqlRouter.decorateRouteContext(actual, mock(SQLStatementContext.class), Collections.emptyList(), mock(ShardingSphereMetaData.class), rule, new ConfigurationProperties(new Properties()));
         Iterator<String> routedDataSourceNames = actual.getActualDataSourceNames().iterator();
+        assertThat(routedDataSourceNames.next(), is(NON_PRIMARY_REPLICA_DATASOURCE_NAME));
         assertThat(routedDataSourceNames.next(), is(PRIMARY_DATASOURCE));
     }
     
     @Test
-    public void assertDecorateToReplica() {
-        RouteContext actual = mockRouteContext();
+    public void assertCreateRouteContextToReplicaDataSource() {
         MySQLSelectStatement selectStatement = mock(MySQLSelectStatement.class);
         when(sqlStatementContext.getSqlStatement()).thenReturn(selectStatement);
         when(selectStatement.getLock()).thenReturn(Optional.empty());
-        routeDecorator.decorate(actual, sqlStatementContext, Collections.emptyList(), mock(ShardingSphereMetaData.class), rule, new ConfigurationProperties(new Properties()));
+        RouteContext actual = sqlRouter.createRouteContext(sqlStatementContext, Collections.emptyList(), mock(ShardingSphereMetaData.class), rule, new ConfigurationProperties(new Properties()));
         Iterator<String> routedDataSourceNames = actual.getActualDataSourceNames().iterator();
-        assertThat(routedDataSourceNames.next(), is(NON_PRIMARY_REPLICA_DATASOURCE_NAME));
         assertThat(routedDataSourceNames.next(), is(REPLICA_DATASOURCE));
     }
     
     @Test
-    public void assertDecorateToReplicaWithoutRouteUnits() {
-        RouteContext actual = new RouteContext();
+    public void assertDecorateRouteContextToReplicaDataSource() {
+        RouteContext actual = mockRouteContext();
         MySQLSelectStatement selectStatement = mock(MySQLSelectStatement.class);
         when(sqlStatementContext.getSqlStatement()).thenReturn(selectStatement);
         when(selectStatement.getLock()).thenReturn(Optional.empty());
-        routeDecorator.decorate(actual, sqlStatementContext, Collections.emptyList(), mock(ShardingSphereMetaData.class), rule, new ConfigurationProperties(new Properties()));
+        sqlRouter.decorateRouteContext(actual, sqlStatementContext, Collections.emptyList(), mock(ShardingSphereMetaData.class), rule, new ConfigurationProperties(new Properties()));
         Iterator<String> routedDataSourceNames = actual.getActualDataSourceNames().iterator();
+        assertThat(routedDataSourceNames.next(), is(NON_PRIMARY_REPLICA_DATASOURCE_NAME));
         assertThat(routedDataSourceNames.next(), is(REPLICA_DATASOURCE));
     }
     
     @Test
-    public void assertLockDecorateToPrimary() {
-        RouteContext actual = mockRouteContext();
+    public void assertCreateRouteContextToPrimaryDataSourceWithLock() {
         MySQLSelectStatement selectStatement = mock(MySQLSelectStatement.class);
         when(sqlStatementContext.getSqlStatement()).thenReturn(selectStatement);
         when(selectStatement.getLock()).thenReturn(Optional.of(mock(LockSegment.class)));
-        routeDecorator.decorate(actual, sqlStatementContext, Collections.emptyList(), mock(ShardingSphereMetaData.class), rule, new ConfigurationProperties(new Properties()));
+        RouteContext actual = sqlRouter.createRouteContext(sqlStatementContext, Collections.emptyList(), mock(ShardingSphereMetaData.class), rule, new ConfigurationProperties(new Properties()));
         Iterator<String> routedDataSourceNames = actual.getActualDataSourceNames().iterator();
-        assertThat(routedDataSourceNames.next(), is(NON_PRIMARY_REPLICA_DATASOURCE_NAME));
         assertThat(routedDataSourceNames.next(), is(PRIMARY_DATASOURCE));
     }
     
     @Test
-    public void assertLockDecorateToPrimaryWithoutRouteUnits() {
-        RouteContext actual = new RouteContext();
+    public void assertDecorateRouteContextToPrimaryDataSourceWithLock() {
+        RouteContext actual = mockRouteContext();
         MySQLSelectStatement selectStatement = mock(MySQLSelectStatement.class);
         when(sqlStatementContext.getSqlStatement()).thenReturn(selectStatement);
         when(selectStatement.getLock()).thenReturn(Optional.of(mock(LockSegment.class)));
-        routeDecorator.decorate(actual, sqlStatementContext, Collections.emptyList(), mock(ShardingSphereMetaData.class), rule, new ConfigurationProperties(new Properties()));
+        sqlRouter.decorateRouteContext(actual, sqlStatementContext, Collections.emptyList(), mock(ShardingSphereMetaData.class), rule, new ConfigurationProperties(new Properties()));
         Iterator<String> routedDataSourceNames = actual.getActualDataSourceNames().iterator();
+        assertThat(routedDataSourceNames.next(), is(NON_PRIMARY_REPLICA_DATASOURCE_NAME));
         assertThat(routedDataSourceNames.next(), is(PRIMARY_DATASOURCE));
     }
     
     @Test
-    public void assertDecorateToPrimaryWithoutRouteUnitsAndWithParameters() {
-        RouteContext actual = new RouteContext();
+    public void assertCreateRouteContextToPrimaryDataSource() {
         when(sqlStatementContext.getSqlStatement()).thenReturn(mock(InsertStatement.class));
-        routeDecorator.decorate(actual, sqlStatementContext, Collections.singletonList("true"), mock(ShardingSphereMetaData.class), rule, new ConfigurationProperties(new Properties()));
+        RouteContext actual = sqlRouter.createRouteContext(
+                sqlStatementContext, Collections.singletonList("true"), mock(ShardingSphereMetaData.class), rule, new ConfigurationProperties(new Properties()));
         Iterator<String> routedDataSourceNames = actual.getActualDataSourceNames().iterator();
         assertThat(routedDataSourceNames.next(), is(PRIMARY_DATASOURCE));
     }
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-route/src/main/java/org/apache/shardingsphere/shadow/route/engine/ShadowRouteDecorator.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-route/src/main/java/org/apache/shardingsphere/shadow/route/engine/ShadowSQLRouter.java
similarity index 57%
rename from shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-route/src/main/java/org/apache/shardingsphere/shadow/route/engine/ShadowRouteDecorator.java
rename to shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-route/src/main/java/org/apache/shardingsphere/shadow/route/engine/ShadowSQLRouter.java
index 30be9c5..6ff6cde 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-route/src/main/java/org/apache/shardingsphere/shadow/route/engine/ShadowRouteDecorator.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-route/src/main/java/org/apache/shardingsphere/shadow/route/engine/ShadowSQLRouter.java
@@ -22,7 +22,7 @@ import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 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.route.decorator.RouteDecorator;
+import org.apache.shardingsphere.infra.route.SQLRouter;
 import org.apache.shardingsphere.shadow.constant.ShadowOrder;
 import org.apache.shardingsphere.shadow.route.engine.judge.ShadowDataSourceJudgeEngine;
 import org.apache.shardingsphere.shadow.route.engine.judge.impl.PreparedShadowDataSourceJudgeEngine;
@@ -37,50 +37,46 @@ import java.util.LinkedList;
 import java.util.List;
 
 /**
- * Route decorator for shadow.
+ * Shadow SQL router.
  */
-public final class ShadowRouteDecorator implements RouteDecorator<ShadowRule> {
+public final class ShadowSQLRouter implements SQLRouter<ShadowRule> {
     
     @Override
-    public void decorate(final RouteContext routeContext, final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters,
-                         final ShardingSphereMetaData metaData, final ShadowRule shadowRule, final ConfigurationProperties props) {
-        if (routeContext.getRouteUnits().isEmpty()) {
-            decorateRouteContext(routeContext, sqlStatementContext, parameters, shadowRule);
-            return;
-        }
-        decorateRouteContextWithRouteUnits(routeContext, sqlStatementContext, parameters, shadowRule);
-    }
-    
-    private void decorateRouteContext(final RouteContext routeContext, final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, final ShadowRule shadowRule) {
+    public RouteContext createRouteContext(final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, 
+                                           final ShardingSphereMetaData metaData, final ShadowRule rule, final ConfigurationProperties props) {
+        RouteContext result = new RouteContext();
         if (!(sqlStatementContext.getSqlStatement() instanceof DMLStatement)) {
-            shadowRule.getShadowMappings().forEach((key, value) -> {
-                routeContext.getRouteUnits().add(new RouteUnit(new RouteMapper(key, key), Collections.emptyList()));
-                routeContext.getRouteUnits().add(new RouteUnit(new RouteMapper(value, value), Collections.emptyList()));
+            rule.getShadowMappings().forEach((key, value) -> {
+                result.getRouteUnits().add(new RouteUnit(new RouteMapper(key, key), Collections.emptyList()));
+                result.getRouteUnits().add(new RouteUnit(new RouteMapper(value, value), Collections.emptyList()));
             });
-            return;
+            return result;
         }
-        if (isShadow(sqlStatementContext, parameters, shadowRule)) {
-            shadowRule.getShadowMappings().values().forEach(each -> routeContext.getRouteUnits().add(new RouteUnit(new RouteMapper(each, each), Collections.emptyList())));
+        if (isShadow(sqlStatementContext, parameters, rule)) {
+            rule.getShadowMappings().values().forEach(each -> result.getRouteUnits().add(new RouteUnit(new RouteMapper(each, each), Collections.emptyList())));
         } else {
-            shadowRule.getShadowMappings().keySet().forEach(each -> routeContext.getRouteUnits().add(new RouteUnit(new RouteMapper(each, each), Collections.emptyList())));
+            rule.getShadowMappings().keySet().forEach(each -> result.getRouteUnits().add(new RouteUnit(new RouteMapper(each, each), Collections.emptyList())));
         }
+        return result;
     }
     
-    private void decorateRouteContextWithRouteUnits(final RouteContext routeContext, final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, final ShadowRule shadowRule) {
+    @Override
+    public void decorateRouteContext(final RouteContext routeContext, final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, 
+                                     final ShardingSphereMetaData metaData, final ShadowRule rule, final ConfigurationProperties props) {
         Collection<RouteUnit> toBeAdded = new LinkedList<>();
         if (!(sqlStatementContext.getSqlStatement() instanceof DMLStatement)) {
             for (RouteUnit each : routeContext.getRouteUnits()) {
-                String shadowDataSourceName = shadowRule.getShadowMappings().get(each.getDataSourceMapper().getActualName());
+                String shadowDataSourceName = rule.getShadowMappings().get(each.getDataSourceMapper().getActualName());
                 toBeAdded.add(new RouteUnit(new RouteMapper(each.getDataSourceMapper().getLogicName(), shadowDataSourceName), each.getTableMappers()));
             }
             routeContext.getRouteUnits().addAll(toBeAdded);
             return;
         }
         Collection<RouteUnit> toBeRemoved = new LinkedList<>();
-        if (isShadow(sqlStatementContext, parameters, shadowRule)) {
+        if (isShadow(sqlStatementContext, parameters, rule)) {
             for (RouteUnit each : routeContext.getRouteUnits()) {
                 toBeRemoved.add(each);
-                String shadowDataSourceName = shadowRule.getShadowMappings().get(each.getDataSourceMapper().getActualName());
+                String shadowDataSourceName = rule.getShadowMappings().get(each.getDataSourceMapper().getActualName());
                 toBeAdded.add(new RouteUnit(new RouteMapper(each.getDataSourceMapper().getLogicName(), shadowDataSourceName), each.getTableMappers()));
             }
         }
@@ -88,9 +84,9 @@ public final class ShadowRouteDecorator implements RouteDecorator<ShadowRule> {
         routeContext.getRouteUnits().addAll(toBeAdded);
     }
     
-    private boolean isShadow(final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, final ShadowRule shadowRule) {
-        ShadowDataSourceJudgeEngine shadowDataSourceRouter = parameters.isEmpty() ? new SimpleShadowDataSourceJudgeEngine(shadowRule, sqlStatementContext)
-                : new PreparedShadowDataSourceJudgeEngine(shadowRule, sqlStatementContext, parameters);
+    private boolean isShadow(final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, final ShadowRule rule) {
+        ShadowDataSourceJudgeEngine shadowDataSourceRouter = parameters.isEmpty()
+                ? new SimpleShadowDataSourceJudgeEngine(rule, sqlStatementContext) : new PreparedShadowDataSourceJudgeEngine(rule, sqlStatementContext, parameters);
         return shadowDataSourceRouter.isShadow();
     }
     
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.decorator.RouteDecorator b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.SQLRouter
similarity index 92%
rename from shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.decorator.RouteDecorator
rename to shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.SQLRouter
index feb7f06..a4690bd 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.decorator.RouteDecorator
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.SQLRouter
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.shadow.route.engine.ShadowRouteDecorator
+org.apache.shardingsphere.shadow.route.engine.ShadowSQLRouter
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-route/src/test/java/org/apache/shardingsphere/shadow/route/engine/ShadowRouteDecoratorTest.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-route/src/test/java/org/apache/shardingsphere/shadow/route/engine/ShadowSQLRouterTest.java
similarity index 75%
rename from shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-route/src/test/java/org/apache/shardingsphere/shadow/route/engine/ShadowRouteDecoratorTest.java
rename to shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-route/src/test/java/org/apache/shardingsphere/shadow/route/engine/ShadowSQLRouterTest.java
index d877925..b86d78b 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-route/src/test/java/org/apache/shardingsphere/shadow/route/engine/ShadowRouteDecoratorTest.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-route/src/test/java/org/apache/shardingsphere/shadow/route/engine/ShadowSQLRouterTest.java
@@ -46,7 +46,7 @@ import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
 @RunWith(MockitoJUnitRunner.class)
-public final class ShadowRouteDecoratorTest {
+public final class ShadowSQLRouterTest {
     
     private static final String SHADOW_COLUMN = "is_shadow";
     
@@ -54,75 +54,79 @@ public final class ShadowRouteDecoratorTest {
     
     private static final String SHADOW_DATASOURCE = "shadow_ds";
     
-    private ShadowRouteDecorator routeDecorator;
+    private ShadowSQLRouter sqlRouter;
     
     private ShadowRule shadowRule;
     
     @Before
     public void setUp() {
-        routeDecorator = new ShadowRouteDecorator();
+        sqlRouter = new ShadowSQLRouter();
         ShadowRuleConfiguration shadowRuleConfiguration = new ShadowRuleConfiguration(SHADOW_COLUMN, Collections.singletonList(ACTUAL_DATASOURCE), Collections.singletonList(SHADOW_DATASOURCE));
         shadowRule = new ShadowRule(shadowRuleConfiguration);
     }
     
     @Test
-    public void assertDecorateToShadowWithOutRouteUnit() {
-        RouteContext actual = new RouteContext();
-        routeDecorator.decorate(actual, mockSQLStatementContextForShadow(), Collections.emptyList(), mock(ShardingSphereMetaData.class), shadowRule, new ConfigurationProperties(new Properties()));
+    public void assertCreateRouteContextToShadowDataSource() {
+        RouteContext actual = sqlRouter.createRouteContext(mockSQLStatementContextForShadow(), 
+                Collections.emptyList(), mock(ShardingSphereMetaData.class), shadowRule, new ConfigurationProperties(new Properties()));
         Iterator<String> routedDataSourceNames = actual.getActualDataSourceNames().iterator();
         assertThat(routedDataSourceNames.next(), is(SHADOW_DATASOURCE));
     }
     
     @Test
-    public void assertDecorateToActualWithOutRouteUnit() {
-        RouteContext actual = new RouteContext();
-        routeDecorator.decorate(actual, mockSQLStatementContext(), Collections.emptyList(), mock(ShardingSphereMetaData.class), shadowRule, new ConfigurationProperties(new Properties()));
+    public void assertCreateRouteContextToActualDataSource() {
+        RouteContext actual = sqlRouter.createRouteContext(mockSQLStatementContext(), 
+                Collections.emptyList(), mock(ShardingSphereMetaData.class), shadowRule, new ConfigurationProperties(new Properties()));
         Iterator<String> routedDataSourceNames = actual.getActualDataSourceNames().iterator();
         assertThat(routedDataSourceNames.next(), is(ACTUAL_DATASOURCE));
     }
     
     @Test
-    public void assertNonDMLStatementWithOutRouteUnit() {
-        RouteContext actual = new RouteContext();
-        routeDecorator.decorate(actual, mockNonDMLSQLStatementContext(), Collections.emptyList(), mock(ShardingSphereMetaData.class), shadowRule, new ConfigurationProperties(new Properties()));
+    public void assertCreateRouteContextForNonDMLStatement() {
+        RouteContext actual = sqlRouter.createRouteContext(mockNonDMLSQLStatementContext(), 
+                Collections.emptyList(), mock(ShardingSphereMetaData.class), shadowRule, new ConfigurationProperties(new Properties()));
         assertThat(actual.getRouteUnits().size(), is(2));
         assertTrue(actual.getActualDataSourceNames().contains(SHADOW_DATASOURCE));
         assertTrue(actual.getActualDataSourceNames().contains(ACTUAL_DATASOURCE));
     }
     
     @Test
-    public void assertDecorateToShadowWithRouteUnit() {
+    public void assertDecorateRouteContextToShadowDataSource() {
         RouteContext actual = new RouteContext();
         actual.getRouteUnits().add(mockRouteUnit());
-        routeDecorator.decorate(actual, mockSQLStatementContextForShadow(), Collections.emptyList(), mock(ShardingSphereMetaData.class), shadowRule, new ConfigurationProperties(new Properties()));
+        sqlRouter.decorateRouteContext(actual, 
+                mockSQLStatementContextForShadow(), Collections.emptyList(), mock(ShardingSphereMetaData.class), shadowRule, new ConfigurationProperties(new Properties()));
         assertThat(actual.getRouteUnits().size(), is(1));
         assertTrue(actual.getActualDataSourceNames().contains(SHADOW_DATASOURCE));
     }
     
     @Test
-    public void assertDecorateToActualWithRouteUnit() {
+    public void assertDecorateRouteContextToActualDataSource() {
         RouteContext actual = new RouteContext();
         actual.getRouteUnits().add(mockRouteUnit());
-        routeDecorator.decorate(actual, mockSQLStatementContext(), Collections.emptyList(), mock(ShardingSphereMetaData.class), shadowRule, new ConfigurationProperties(new Properties()));
+        sqlRouter.decorateRouteContext(actual, 
+                mockSQLStatementContext(), Collections.emptyList(), mock(ShardingSphereMetaData.class), shadowRule, new ConfigurationProperties(new Properties()));
         Iterator<String> routedDataSourceNames = actual.getActualDataSourceNames().iterator();
         assertThat(routedDataSourceNames.next(), is(ACTUAL_DATASOURCE));
     }
     
     @Test
-    public void assertNonDMLStatementWithRouteUnit() {
+    public void assertDecorateRouteContextNonDMLStatement() {
         RouteContext actual = new RouteContext();
         actual.getRouteUnits().add(mockRouteUnit());
-        routeDecorator.decorate(actual, mockNonDMLSQLStatementContext(), Collections.emptyList(), mock(ShardingSphereMetaData.class), shadowRule, new ConfigurationProperties(new Properties()));
+        sqlRouter.decorateRouteContext(actual, 
+                mockNonDMLSQLStatementContext(), Collections.emptyList(), mock(ShardingSphereMetaData.class), shadowRule, new ConfigurationProperties(new Properties()));
         assertThat(actual.getRouteUnits().size(), is(2));
         assertTrue(actual.getActualDataSourceNames().contains(SHADOW_DATASOURCE));
         assertTrue(actual.getActualDataSourceNames().contains(ACTUAL_DATASOURCE));
     }
     
     @Test
-    public void assertTableMapperWithRouteUnit() {
+    public void assertDecorateRouteContextWithTableMapper() {
         RouteContext actual = new RouteContext();
         actual.getRouteUnits().add(mockRouteUnit());
-        routeDecorator.decorate(actual, mockSQLStatementContextForShadow(), Collections.emptyList(), mock(ShardingSphereMetaData.class), shadowRule, new ConfigurationProperties(new Properties()));
+        sqlRouter.decorateRouteContext(actual, 
+                mockSQLStatementContextForShadow(), Collections.emptyList(), mock(ShardingSphereMetaData.class), shadowRule, new ConfigurationProperties(new Properties()));
         assertThat(actual.getRouteUnits().size(), is(1));
         assertTrue(actual.getActualDataSourceNames().contains(SHADOW_DATASOURCE));
         Collection<RouteMapper> tableMappers = actual.getRouteUnits().iterator().next().getTableMappers();
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/test/java/org/apache/shardingsphere/sharding/rewrite/parameterized/MixSQLRewriterParameterizedTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/test/java/org/apache/shardingsphere/sharding/rewrite/parameterized/MixSQLRewriterParameterizedTest.java
index 2d1d951..d40ba42 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/test/java/org/apache/shardingsphere/sharding/rewrite/parameterized/MixSQLRewriterParameterizedTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/test/java/org/apache/shardingsphere/sharding/rewrite/parameterized/MixSQLRewriterParameterizedTest.java
@@ -30,7 +30,7 @@ import org.apache.shardingsphere.infra.rewrite.engine.result.SQLRewriteUnit;
 import org.apache.shardingsphere.infra.rewrite.parameterized.engine.AbstractSQLRewriterParameterizedTest;
 import org.apache.shardingsphere.infra.rewrite.parameterized.engine.parameter.SQLRewriteEngineTestParameters;
 import org.apache.shardingsphere.infra.rewrite.parameterized.engine.parameter.SQLRewriteEngineTestParametersBuilder;
-import org.apache.shardingsphere.infra.route.DataNodeRouter;
+import org.apache.shardingsphere.infra.route.engine.SQLRouteEngine;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
 import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.ShardingSphereRulesBuilder;
@@ -84,7 +84,7 @@ public final class MixSQLRewriterParameterizedTest extends AbstractSQLRewriterPa
         ConfigurationProperties props = new ConfigurationProperties(ruleConfigurations.getProps());
         SQLStatementContext<?> sqlStatementContext = SQLStatementContextFactory.newInstance(
                 metaData.getRuleSchemaMetaData().getConfiguredSchemaMetaData(), getTestParameters().getInputParameters(), standardSqlParserEngine.parse(getTestParameters().getInputSQL(), false));
-        RouteContext routeContext = new DataNodeRouter(metaData, props, rules).route(sqlStatementContext, getTestParameters().getInputSQL(), getTestParameters().getInputParameters());
+        RouteContext routeContext = new SQLRouteEngine(metaData, props, rules).route(sqlStatementContext, getTestParameters().getInputSQL(), getTestParameters().getInputParameters());
         SQLRewriteResult sqlRewriteResult = new SQLRewriteEntry(metaData.getRuleSchemaMetaData().getConfiguredSchemaMetaData(),
                 props, rules).rewrite(getTestParameters().getInputSQL(), getTestParameters().getInputParameters(), sqlStatementContext, routeContext);
         return sqlRewriteResult instanceof GenericSQLRewriteResult
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/test/java/org/apache/shardingsphere/sharding/rewrite/parameterized/ShardingSQLRewriterParameterizedTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/test/java/org/apache/shardingsphere/sharding/rewrite/parameterized/ShardingSQLRewriterParameterizedTest.java
index a438ff8..2474730 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/test/java/org/apache/shardingsphere/sharding/rewrite/parameterized/ShardingSQLRewriterParameterizedTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-rewrite/src/test/java/org/apache/shardingsphere/sharding/rewrite/parameterized/ShardingSQLRewriterParameterizedTest.java
@@ -30,7 +30,7 @@ import org.apache.shardingsphere.infra.rewrite.engine.result.SQLRewriteUnit;
 import org.apache.shardingsphere.infra.rewrite.parameterized.engine.AbstractSQLRewriterParameterizedTest;
 import org.apache.shardingsphere.infra.rewrite.parameterized.engine.parameter.SQLRewriteEngineTestParameters;
 import org.apache.shardingsphere.infra.rewrite.parameterized.engine.parameter.SQLRewriteEngineTestParametersBuilder;
-import org.apache.shardingsphere.infra.route.DataNodeRouter;
+import org.apache.shardingsphere.infra.route.engine.SQLRouteEngine;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
 import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.rule.ShardingSphereRulesBuilder;
@@ -84,7 +84,7 @@ public final class ShardingSQLRewriterParameterizedTest extends AbstractSQLRewri
         ConfigurationProperties props = new ConfigurationProperties(yamlRootRuleConfigs.getProps());
         SQLStatementContext<?> sqlStatementContext = SQLStatementContextFactory.newInstance(
                 metaData.getRuleSchemaMetaData().getConfiguredSchemaMetaData(), getTestParameters().getInputParameters(), standardSqlParserEngine.parse(getTestParameters().getInputSQL(), false));
-        RouteContext routeContext = new DataNodeRouter(metaData, props, rules).route(
+        RouteContext routeContext = new SQLRouteEngine(metaData, props, rules).route(
                 sqlStatementContext, getTestParameters().getInputSQL(), getTestParameters().getInputParameters());
         SQLRewriteResult sqlRewriteResult = new SQLRewriteEntry(metaData.getRuleSchemaMetaData().getConfiguredSchemaMetaData(),
                 props, rules).rewrite(getTestParameters().getInputSQL(), getTestParameters().getInputParameters(), sqlStatementContext, routeContext);
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/ShardingRouteDecorator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/ShardingSQLRouter.java
similarity index 84%
rename from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/ShardingRouteDecorator.java
rename to shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/ShardingSQLRouter.java
index b8e944e..9f5c6c6 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/ShardingRouteDecorator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/java/org/apache/shardingsphere/sharding/route/engine/ShardingSQLRouter.java
@@ -22,7 +22,7 @@ import org.apache.shardingsphere.infra.config.properties.ConfigurationProperties
 import org.apache.shardingsphere.infra.hint.HintManager;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
-import org.apache.shardingsphere.infra.route.decorator.RouteDecorator;
+import org.apache.shardingsphere.infra.route.SQLRouter;
 import org.apache.shardingsphere.sharding.constant.ShardingOrder;
 import org.apache.shardingsphere.sharding.route.engine.condition.ShardingCondition;
 import org.apache.shardingsphere.sharding.route.engine.condition.ShardingConditions;
@@ -50,43 +50,45 @@ import java.util.List;
 import java.util.Optional;
 
 /**
- * Sharding route decorator.
+ * Sharding SQL router.
  */
-public final class ShardingRouteDecorator implements RouteDecorator<ShardingRule> {
+public final class ShardingSQLRouter implements SQLRouter<ShardingRule> {
     
     @SuppressWarnings({"rawtypes", "unchecked"})
     @Override
-    public void decorate(final RouteContext routeContext, final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, 
-                         final ShardingSphereMetaData metaData, final ShardingRule shardingRule, final ConfigurationProperties props) {
+    public RouteContext createRouteContext(final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, 
+                                           final ShardingSphereMetaData metaData, final ShardingRule rule, final ConfigurationProperties props) {
+        RouteContext result = new RouteContext();
         SQLStatement sqlStatement = sqlStatementContext.getSqlStatement();
         Optional<ShardingStatementValidator> shardingStatementValidator = ShardingStatementValidatorFactory.newInstance(sqlStatement);
-        shardingStatementValidator.ifPresent(validator -> validator.preValidate(shardingRule, sqlStatementContext, parameters, metaData));
-        ShardingConditions shardingConditions = getShardingConditions(parameters, sqlStatementContext, metaData.getRuleSchemaMetaData().getConfiguredSchemaMetaData(), shardingRule);
-        boolean needMergeShardingValues = isNeedMergeShardingValues(sqlStatementContext, shardingRule);
+        shardingStatementValidator.ifPresent(validator -> validator.preValidate(rule, sqlStatementContext, parameters, metaData));
+        ShardingConditions shardingConditions = getShardingConditions(parameters, sqlStatementContext, metaData.getRuleSchemaMetaData().getConfiguredSchemaMetaData(), rule);
+        boolean needMergeShardingValues = isNeedMergeShardingValues(sqlStatementContext, rule);
         if (sqlStatement instanceof DMLStatement && needMergeShardingValues) {
-            checkSubqueryShardingValues(sqlStatementContext, shardingRule, shardingConditions);
+            checkSubqueryShardingValues(sqlStatementContext, rule, shardingConditions);
             mergeShardingConditions(shardingConditions);
         }
-        ShardingRouteEngineFactory.newInstance(shardingRule, metaData, sqlStatementContext, shardingConditions, props).route(routeContext, shardingRule);
-        shardingStatementValidator.ifPresent(validator -> validator.postValidate(sqlStatement, routeContext));
+        ShardingRouteEngineFactory.newInstance(rule, metaData, sqlStatementContext, shardingConditions, props).route(result, rule);
+        shardingStatementValidator.ifPresent(validator -> validator.postValidate(sqlStatement, result));
+        return result;
     }
-
+    
     private ShardingConditions getShardingConditions(final List<Object> parameters, 
-                                                     final SQLStatementContext<?> sqlStatementContext, final SchemaMetaData schemaMetaData, final ShardingRule shardingRule) {
+                                                     final SQLStatementContext<?> sqlStatementContext, final SchemaMetaData schemaMetaData, final ShardingRule rule) {
         if (sqlStatementContext.getSqlStatement() instanceof DMLStatement) {
             if (sqlStatementContext instanceof InsertStatementContext) {
-                return new ShardingConditions(new InsertClauseShardingConditionEngine(shardingRule, schemaMetaData).createShardingConditions((InsertStatementContext) sqlStatementContext, parameters));
+                return new ShardingConditions(new InsertClauseShardingConditionEngine(rule, schemaMetaData).createShardingConditions((InsertStatementContext) sqlStatementContext, parameters));
             }
-            return new ShardingConditions(new WhereClauseShardingConditionEngine(shardingRule, schemaMetaData).createShardingConditions(sqlStatementContext, parameters));
+            return new ShardingConditions(new WhereClauseShardingConditionEngine(rule, schemaMetaData).createShardingConditions(sqlStatementContext, parameters));
         }
         return new ShardingConditions(Collections.emptyList());
     }
     
-    private boolean isNeedMergeShardingValues(final SQLStatementContext<?> sqlStatementContext, final ShardingRule shardingRule) {
+    private boolean isNeedMergeShardingValues(final SQLStatementContext<?> sqlStatementContext, final ShardingRule rule) {
         boolean selectContainsSubquery = sqlStatementContext instanceof SelectStatementContext && ((SelectStatementContext) sqlStatementContext).isContainsSubquery();
         boolean insertSelectContainsSubquery = sqlStatementContext instanceof InsertStatementContext && null != ((InsertStatementContext) sqlStatementContext).getInsertSelectContext()
                 && ((InsertStatementContext) sqlStatementContext).getInsertSelectContext().getSelectStatementContext().isContainsSubquery();
-        return (selectContainsSubquery || insertSelectContainsSubquery) && !shardingRule.getShardingLogicTableNames(sqlStatementContext.getTablesContext().getTableNames()).isEmpty();
+        return (selectContainsSubquery || insertSelectContainsSubquery) && !rule.getShardingLogicTableNames(sqlStatementContext.getTablesContext().getTableNames()).isEmpty();
     }
     
     private void checkSubqueryShardingValues(final SQLStatementContext<?> sqlStatementContext, final ShardingRule shardingRule, final ShardingConditions shardingConditions) {
@@ -154,6 +156,12 @@ public final class ShardingRouteDecorator implements RouteDecorator<ShardingRule
     }
     
     @Override
+    public void decorateRouteContext(final RouteContext routeContext, final SQLStatementContext<?> sqlStatementContext, 
+                                     final List<Object> parameters, final ShardingSphereMetaData metaData, final ShardingRule rule, final ConfigurationProperties props) {
+        // TODO
+    }
+    
+    @Override
     public int getOrder() {
         return ShardingOrder.ORDER;
     }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.decorator.RouteDecorator b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.SQLRouter
similarity index 91%
rename from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.decorator.RouteDecorator
rename to shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.SQLRouter
index 5343aa7..7b1770b 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.decorator.RouteDecorator
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.SQLRouter
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.sharding.route.engine.ShardingRouteDecorator
+org.apache.shardingsphere.sharding.route.engine.ShardingSQLRouter
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/standard/AbstractSQLRouteTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/standard/AbstractSQLRouteTest.java
index 5337045..b352647 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/standard/AbstractSQLRouteTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-route/src/test/java/org/apache/shardingsphere/sharding/route/engine/type/standard/AbstractSQLRouteTest.java
@@ -23,7 +23,7 @@ import org.apache.shardingsphere.infra.database.type.DatabaseTypes;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import org.apache.shardingsphere.infra.metadata.datasource.DataSourceMetaDatas;
 import org.apache.shardingsphere.infra.metadata.schema.RuleSchemaMetaData;
-import org.apache.shardingsphere.infra.route.DataNodeRouter;
+import org.apache.shardingsphere.infra.route.engine.SQLRouteEngine;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
 import org.apache.shardingsphere.sharding.route.fixture.AbstractRoutingEngineTest;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
@@ -56,7 +56,7 @@ public abstract class AbstractSQLRouteTest extends AbstractRoutingEngineTest {
         StandardSQLParserEngine standardSqlParserEngine = SQLParserEngineFactory.getSQLParserEngine("MySQL");
         SQLStatementContext<?> sqlStatementContext = SQLStatementContextFactory.newInstance(
                 metaData.getRuleSchemaMetaData().getConfiguredSchemaMetaData(), parameters, standardSqlParserEngine.parse(sql, false));
-        RouteContext result = new DataNodeRouter(metaData, props, Collections.singletonList(shardingRule)).route(sqlStatementContext, sql, parameters);
+        RouteContext result = new SQLRouteEngine(metaData, props, Collections.singletonList(shardingRule)).route(sqlStatementContext, sql, parameters);
         assertThat(result.getRouteUnits().size(), is(1));
         return result;
     }
diff --git a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/utils/IpUtils.java b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/utils/IpUtils.java
index e29bf79..ad9be33 100644
--- a/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/utils/IpUtils.java
+++ b/shardingsphere-governance/shardingsphere-governance-core/shardingsphere-governance-core-common/src/main/java/org/apache/shardingsphere/governance/core/utils/IpUtils.java
@@ -17,12 +17,13 @@
 
 package org.apache.shardingsphere.governance.core.utils;
 
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+
 import java.net.InetAddress;
 import java.net.NetworkInterface;
 import java.net.SocketException;
 import java.util.Enumeration;
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
 
 /**
  * IP utilities.
@@ -37,7 +38,7 @@ public final class IpUtils {
      * 
      * <p>
      * It maybe get IP address of router.
-     * Return unknown IP if exception occur. 
+     * Return unknown IP if exception occur.
      * </p>
      * 
      * @return IP address of localhost 
diff --git a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/kernel/KernelProcessor.java b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/kernel/KernelProcessor.java
index a3cc3da..c9ac1d2 100644
--- a/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/kernel/KernelProcessor.java
+++ b/shardingsphere-infra/shardingsphere-infra-context/src/main/java/org/apache/shardingsphere/infra/context/kernel/KernelProcessor.java
@@ -24,7 +24,7 @@ import org.apache.shardingsphere.infra.executor.sql.context.ExecutionContextBuil
 import org.apache.shardingsphere.infra.executor.sql.context.ExecutionUnit;
 import org.apache.shardingsphere.infra.rewrite.SQLRewriteEntry;
 import org.apache.shardingsphere.infra.rewrite.engine.result.SQLRewriteResult;
-import org.apache.shardingsphere.infra.route.DataNodeRouter;
+import org.apache.shardingsphere.infra.route.engine.SQLRouteEngine;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
 import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.sql.parser.binder.SQLStatementContextFactory;
@@ -47,10 +47,10 @@ public final class KernelProcessor {
      */
     public ExecutionContext generateExecutionContext(final LogicSQLContext logicSQLContext, final ConfigurationProperties props) {
         Collection<ShardingSphereRule> rules = logicSQLContext.getSchemaContext().getSchema().getRules();
-        DataNodeRouter router = new DataNodeRouter(logicSQLContext.getSchemaContext().getSchema().getMetaData(), props, rules);
+        SQLRouteEngine sqlRouteEngine = new SQLRouteEngine(logicSQLContext.getSchemaContext().getSchema().getMetaData(), props, rules);
         SchemaMetaData schemaMetaData = logicSQLContext.getSchemaContext().getSchema().getMetaData().getRuleSchemaMetaData().getSchemaMetaData();
         SQLStatementContext<?> sqlStatementContext = SQLStatementContextFactory.newInstance(schemaMetaData, logicSQLContext.getParameters(), logicSQLContext.getSqlStatement());
-        RouteContext routeContext = router.route(sqlStatementContext, logicSQLContext.getSql(), logicSQLContext.getParameters());
+        RouteContext routeContext = sqlRouteEngine.route(sqlStatementContext, logicSQLContext.getSql(), logicSQLContext.getParameters());
         SQLRewriteEntry rewriteEntry = new SQLRewriteEntry(logicSQLContext.getSchemaContext().getSchema().getMetaData().getRuleSchemaMetaData().getConfiguredSchemaMetaData(), props, rules);
         SQLRewriteResult rewriteResult = rewriteEntry.rewrite(logicSQLContext.getSql(), logicSQLContext.getParameters(), sqlStatementContext, routeContext);
         Collection<ExecutionUnit> executionUnits = ExecutionContextBuilder.build(logicSQLContext.getSchemaContext().getSchema().getMetaData(), rewriteResult, sqlStatementContext);
diff --git a/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/decorator/RouteDecorator.java b/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/SQLRouter.java
similarity index 66%
rename from shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/decorator/RouteDecorator.java
rename to shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/SQLRouter.java
index c942c37..1d31cbd 100644
--- a/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/decorator/RouteDecorator.java
+++ b/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/SQLRouter.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.route.decorator;
+package org.apache.shardingsphere.infra.route;
 
 import org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
@@ -27,11 +27,23 @@ import org.apache.shardingsphere.sql.parser.binder.statement.SQLStatementContext
 import java.util.List;
 
 /**
- * Route decorator.
+ * SQL Router.
  * 
  * @param <T> type of rule
  */
-public interface RouteDecorator<T extends ShardingSphereRule> extends OrderedSPI<T> {
+public interface SQLRouter<T extends ShardingSphereRule> extends OrderedSPI<T> {
+    
+    /**
+     * Create route context.
+     *
+     * @param sqlStatementContext SQL statement context
+     * @param parameters SQL parameters
+     * @param metaData meta data of ShardingSphere
+     * @param rule rule
+     * @param props configuration properties
+     * @return route context
+     */
+    RouteContext createRouteContext(SQLStatementContext<?> sqlStatementContext, List<Object> parameters, ShardingSphereMetaData metaData, T rule, ConfigurationProperties props);
     
     /**
      * Decorate route context.
@@ -43,5 +55,5 @@ public interface RouteDecorator<T extends ShardingSphereRule> extends OrderedSPI
      * @param rule rule
      * @param props configuration properties
      */
-    void decorate(RouteContext routeContext, SQLStatementContext<?> sqlStatementContext, List<Object> parameters, ShardingSphereMetaData metaData, T rule, ConfigurationProperties props);
+    void decorateRouteContext(RouteContext routeContext, SQLStatementContext<?> sqlStatementContext, List<Object> parameters, ShardingSphereMetaData metaData, T rule, ConfigurationProperties props);
 }
diff --git a/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/decorator/UnconfiguredSchemaRouteDecorator.java b/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/UnconfiguredSchemaSQLRouter.java
similarity index 93%
rename from shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/decorator/UnconfiguredSchemaRouteDecorator.java
rename to shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/UnconfiguredSchemaSQLRouter.java
index 0ff756e..8508f3e 100644
--- a/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/decorator/UnconfiguredSchemaRouteDecorator.java
+++ b/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/UnconfiguredSchemaSQLRouter.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.route.decorator;
+package org.apache.shardingsphere.infra.route;
 
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
@@ -28,9 +28,9 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dal.MySQ
 import java.util.Collections;
 
 /**
- * Unconfigured schema route decorator.
+ * Unconfigured schema SQL router.
  */
-public final class UnconfiguredSchemaRouteDecorator {
+public final class UnconfiguredSchemaSQLRouter {
     
     /**
      * Decorate route context.
diff --git a/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/DataNodeRouter.java b/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/engine/SQLRouteEngine.java
similarity index 73%
rename from shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/DataNodeRouter.java
rename to shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/engine/SQLRouteEngine.java
index b757487..25b0667 100644
--- a/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/DataNodeRouter.java
+++ b/shardingsphere-infra/shardingsphere-infra-route/src/main/java/org/apache/shardingsphere/infra/route/engine/SQLRouteEngine.java
@@ -15,13 +15,13 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.route;
+package org.apache.shardingsphere.infra.route.engine;
 
 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.UnconfiguredSchemaSQLRouter;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
-import org.apache.shardingsphere.infra.route.decorator.RouteDecorator;
-import org.apache.shardingsphere.infra.route.decorator.UnconfiguredSchemaRouteDecorator;
 import org.apache.shardingsphere.infra.route.hook.SPIRoutingHook;
 import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
 import org.apache.shardingsphere.infra.spi.ShardingSphereServiceLoader;
@@ -34,12 +34,12 @@ import java.util.Map;
 import java.util.Map.Entry;
 
 /**
- * Data node router.
+ * SQL route engine.
  */
-public final class DataNodeRouter {
+public final class SQLRouteEngine {
     
     static {
-        ShardingSphereServiceLoader.register(RouteDecorator.class);
+        ShardingSphereServiceLoader.register(SQLRouter.class);
     }
     
     private final ShardingSphereMetaData metaData;
@@ -47,14 +47,14 @@ public final class DataNodeRouter {
     private final ConfigurationProperties props;
     
     @SuppressWarnings("rawtypes")
-    private final Map<ShardingSphereRule, RouteDecorator> decorators;
+    private final Map<ShardingSphereRule, SQLRouter> decorators;
     
     private final SPIRoutingHook routingHook;
     
-    public DataNodeRouter(final ShardingSphereMetaData metaData, final ConfigurationProperties props, final Collection<ShardingSphereRule> rules) {
+    public SQLRouteEngine(final ShardingSphereMetaData metaData, final ConfigurationProperties props, final Collection<ShardingSphereRule> rules) {
         this.metaData = metaData;
         this.props = props;
-        decorators = OrderedSPIRegistry.getRegisteredServices(rules, RouteDecorator.class);
+        decorators = OrderedSPIRegistry.getRegisteredServices(rules, SQLRouter.class);
         routingHook = new SPIRoutingHook();
     }
     
@@ -82,11 +82,18 @@ public final class DataNodeRouter {
     
     @SuppressWarnings({"unchecked", "rawtypes"})
     private RouteContext doRoute(final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters) {
-        RouteContext result = new RouteContext();
-        for (Entry<ShardingSphereRule, RouteDecorator> entry : decorators.entrySet()) {
-            entry.getValue().decorate(result, sqlStatementContext, parameters, metaData, entry.getKey(), props);
+        RouteContext result = null;
+        for (Entry<ShardingSphereRule, SQLRouter> entry : decorators.entrySet()) {
+            if (null == result) {
+                result = entry.getValue().createRouteContext(sqlStatementContext, parameters, metaData, entry.getKey(), props);
+            } else {
+                entry.getValue().decorateRouteContext(result, sqlStatementContext, parameters, metaData, entry.getKey(), props);
+            }
         }
-        new UnconfiguredSchemaRouteDecorator().decorate(result, sqlStatementContext, metaData);
+        if (null == result) {
+            result = new RouteContext();
+        }
+        new UnconfiguredSchemaSQLRouter().decorate(result, sqlStatementContext, metaData);
         return result;
     }
 }
diff --git a/shardingsphere-infra/shardingsphere-infra-route/src/test/java/org/apache/shardingsphere/infra/route/DataNodeRouterTest.java b/shardingsphere-infra/shardingsphere-infra-route/src/test/java/org/apache/shardingsphere/infra/route/engine/SQLRouteEngineTest.java
similarity index 79%
rename from shardingsphere-infra/shardingsphere-infra-route/src/test/java/org/apache/shardingsphere/infra/route/DataNodeRouterTest.java
rename to shardingsphere-infra/shardingsphere-infra-route/src/test/java/org/apache/shardingsphere/infra/route/engine/SQLRouteEngineTest.java
index f728a57..29c7e7e 100644
--- a/shardingsphere-infra/shardingsphere-infra-route/src/test/java/org/apache/shardingsphere/infra/route/DataNodeRouterTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-route/src/test/java/org/apache/shardingsphere/infra/route/engine/SQLRouteEngineTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.route;
+package org.apache.shardingsphere.infra.route.engine;
 
 import lombok.SneakyThrows;
 import org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;
@@ -45,7 +45,7 @@ import static org.mockito.Mockito.verify;
 import static org.mockito.Mockito.when;
 
 @RunWith(MockitoJUnitRunner.class)
-public final class DataNodeRouterTest {
+public final class SQLRouteEngineTest {
     
     @Mock(answer = Answers.RETURNS_DEEP_STUBS)
     private ShardingSphereMetaData metaData;
@@ -63,9 +63,9 @@ public final class DataNodeRouterTest {
     
     @Test
     public void assertRouteSuccess() {
-        DataNodeRouter router = new DataNodeRouter(metaData, props, Collections.singletonList(new RouteRuleFixture()));
-        setSPIRoutingHook(router);
-        RouteContext actual = router.route(mock(SQLStatementContext.class), "SELECT 1", Collections.emptyList());
+        SQLRouteEngine sqlRouteEngine = new SQLRouteEngine(metaData, props, Collections.singletonList(new RouteRuleFixture()));
+        setSPIRoutingHook(sqlRouteEngine);
+        RouteContext actual = sqlRouteEngine.route(mock(SQLStatementContext.class), "SELECT 1", Collections.emptyList());
         assertThat(actual.getRouteUnits().size(), is(1));
         RouteUnit routeUnit = actual.getRouteUnits().iterator().next();
         assertThat(routeUnit.getDataSourceMapper().getLogicName(), is("ds"));
@@ -77,10 +77,10 @@ public final class DataNodeRouterTest {
     
     @Test(expected = UnsupportedOperationException.class)
     public void assertRouteFailure() {
-        DataNodeRouter router = new DataNodeRouter(metaData, props, Collections.singletonList(new RouteFailureRuleFixture()));
-        setSPIRoutingHook(router);
+        SQLRouteEngine sqlRouteEngine = new SQLRouteEngine(metaData, props, Collections.singletonList(new RouteFailureRuleFixture()));
+        setSPIRoutingHook(sqlRouteEngine);
         try {
-            router.route(mock(SQLStatementContext.class), "SELECT 1", Collections.emptyList());
+            sqlRouteEngine.route(mock(SQLStatementContext.class), "SELECT 1", Collections.emptyList());
         } catch (final UnsupportedOperationException ex) {
             verify(routingHook).start("SELECT 1");
             verify(routingHook).finishFailure(ex);
@@ -89,9 +89,9 @@ public final class DataNodeRouterTest {
     }
     
     @SneakyThrows(ReflectiveOperationException.class)
-    private void setSPIRoutingHook(final DataNodeRouter router) {
-        Field field = DataNodeRouter.class.getDeclaredField("routingHook");
+    private void setSPIRoutingHook(final SQLRouteEngine sqlRouteEngine) {
+        Field field = SQLRouteEngine.class.getDeclaredField("routingHook");
         field.setAccessible(true);
-        field.set(router, routingHook);
+        field.set(sqlRouteEngine, routingHook);
     }
 }
diff --git a/shardingsphere-infra/shardingsphere-infra-route/src/test/java/org/apache/shardingsphere/infra/route/fixture/decorator/RouteFailureDecoratorFixture.java b/shardingsphere-infra/shardingsphere-infra-route/src/test/java/org/apache/shardingsphere/infra/route/fixture/router/SQLRouterFailureFixture.java
similarity index 63%
rename from shardingsphere-infra/shardingsphere-infra-route/src/test/java/org/apache/shardingsphere/infra/route/fixture/decorator/RouteFailureDecoratorFixture.java
rename to shardingsphere-infra/shardingsphere-infra-route/src/test/java/org/apache/shardingsphere/infra/route/fixture/router/SQLRouterFailureFixture.java
index dab6b7d..7df2e15 100644
--- a/shardingsphere-infra/shardingsphere-infra-route/src/test/java/org/apache/shardingsphere/infra/route/fixture/decorator/RouteFailureDecoratorFixture.java
+++ b/shardingsphere-infra/shardingsphere-infra-route/src/test/java/org/apache/shardingsphere/infra/route/fixture/router/SQLRouterFailureFixture.java
@@ -15,22 +15,28 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.route.fixture.decorator;
+package org.apache.shardingsphere.infra.route.fixture.router;
 
 import org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 import org.apache.shardingsphere.infra.route.context.RouteContext;
-import org.apache.shardingsphere.infra.route.decorator.RouteDecorator;
+import org.apache.shardingsphere.infra.route.SQLRouter;
 import org.apache.shardingsphere.infra.route.fixture.rule.RouteFailureRuleFixture;
 import org.apache.shardingsphere.sql.parser.binder.statement.SQLStatementContext;
 
 import java.util.List;
 
-public final class RouteFailureDecoratorFixture implements RouteDecorator<RouteFailureRuleFixture> {
+public final class SQLRouterFailureFixture implements SQLRouter<RouteFailureRuleFixture> {
     
     @Override
-    public void decorate(final RouteContext routeContext, final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters,
-                         final ShardingSphereMetaData metaData, final RouteFailureRuleFixture rule, final ConfigurationProperties props) {
+    public RouteContext createRouteContext(final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, 
+                                           final ShardingSphereMetaData metaData, final RouteFailureRuleFixture rule, final ConfigurationProperties props) {
+        throw new UnsupportedOperationException("Route failure.");
+    }
+    
+    @Override
+    public void decorateRouteContext(final RouteContext routeContext, final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, 
+                                     final ShardingSphereMetaData metaData, final RouteFailureRuleFixture rule, final ConfigurationProperties props) {
         throw new UnsupportedOperationException("Route failure.");
     }
     
diff --git a/shardingsphere-infra/shardingsphere-infra-route/src/test/java/org/apache/shardingsphere/infra/route/fixture/decorator/RouteDecoratorFixture.java b/shardingsphere-infra/shardingsphere-infra-route/src/test/java/org/apache/shardingsphere/infra/route/fixture/router/SQLRouterFixture.java
similarity index 63%
rename from shardingsphere-infra/shardingsphere-infra-route/src/test/java/org/apache/shardingsphere/infra/route/fixture/decorator/RouteDecoratorFixture.java
rename to shardingsphere-infra/shardingsphere-infra-route/src/test/java/org/apache/shardingsphere/infra/route/fixture/router/SQLRouterFixture.java
index 8fc6d04..603fae1 100644
--- a/shardingsphere-infra/shardingsphere-infra-route/src/test/java/org/apache/shardingsphere/infra/route/fixture/decorator/RouteDecoratorFixture.java
+++ b/shardingsphere-infra/shardingsphere-infra-route/src/test/java/org/apache/shardingsphere/infra/route/fixture/router/SQLRouterFixture.java
@@ -15,25 +15,33 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.infra.route.fixture.decorator;
+package org.apache.shardingsphere.infra.route.fixture.router;
 
 import org.apache.shardingsphere.infra.config.properties.ConfigurationProperties;
 import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
 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.route.decorator.RouteDecorator;
+import org.apache.shardingsphere.infra.route.SQLRouter;
 import org.apache.shardingsphere.infra.route.fixture.rule.RouteRuleFixture;
 import org.apache.shardingsphere.sql.parser.binder.statement.SQLStatementContext;
 
 import java.util.Collections;
 import java.util.List;
 
-public final class RouteDecoratorFixture implements RouteDecorator<RouteRuleFixture> {
+public final class SQLRouterFixture implements SQLRouter<RouteRuleFixture> {
     
     @Override
-    public void decorate(final RouteContext routeContext, final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters,
-                         final ShardingSphereMetaData metaData, final RouteRuleFixture rule, final ConfigurationProperties props) {
+    public RouteContext createRouteContext(final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, 
+                                           final ShardingSphereMetaData metaData, final RouteRuleFixture rule, final ConfigurationProperties props) {
+        RouteContext result = new RouteContext();
+        result.getRouteUnits().add(new RouteUnit(new RouteMapper("ds", "ds_0"), Collections.emptyList()));
+        return result;
+    }
+    
+    @Override
+    public void decorateRouteContext(final RouteContext routeContext, final SQLStatementContext<?> sqlStatementContext, final List<Object> parameters, 
+                                     final ShardingSphereMetaData metaData, final RouteRuleFixture rule, final ConfigurationProperties props) {
         routeContext.getRouteUnits().add(new RouteUnit(new RouteMapper("ds", "ds_0"), Collections.emptyList()));
     }
     
diff --git a/shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.decorator.RouteDecorator b/shardingsphere-infra/shardingsphere-infra-route/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.route.SQLRouter
similarity index 84%
rename from shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.decorator.RouteDecorator
rename to shardingsphere-infra/shardingsphere-infra-route/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.route.SQLRouter
index ab8f793..849072c 100644
--- a/shardingsphere-features/shardingsphere-primary-replica-replication/shardingsphere-primary-replica-replication-route/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.route.decorator.RouteDecorator
+++ b/shardingsphere-infra/shardingsphere-infra-route/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.route.SQLRouter
@@ -15,4 +15,5 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.replication.primaryreplica.route.engine.PrimaryReplicaReplicationRouteDecorator
+org.apache.shardingsphere.infra.route.fixture.router.SQLRouterFixture
+org.apache.shardingsphere.infra.route.fixture.router.SQLRouterFailureFixture
diff --git a/shardingsphere-infra/shardingsphere-infra-route/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.route.decorator.RouteDecorator b/shardingsphere-infra/shardingsphere-infra-route/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.route.decorator.RouteDecorator
deleted file mode 100644
index bd4c832..0000000
--- a/shardingsphere-infra/shardingsphere-infra-route/src/test/resources/META-INF/services/org.apache.shardingsphere.infra.route.decorator.RouteDecorator
+++ /dev/null
@@ -1,19 +0,0 @@
-#
-# Licensed to the Apache Software Foundation (ASF) under one or more
-# contributor license agreements.  See the NOTICE file distributed with
-# this work for additional information regarding copyright ownership.
-# The ASF licenses this file to You under the Apache License, Version 2.0
-# (the "License"); you may not use this file except in compliance with
-# the License.  You may obtain a copy of the License at
-#
-#     http://www.apache.org/licenses/LICENSE-2.0
-#
-# Unless required by applicable law or agreed to in writing, software
-# distributed under the License is distributed on an "AS IS" BASIS,
-# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-# See the License for the specific language governing permissions and
-# limitations under the License.
-#
-
-org.apache.shardingsphere.infra.route.fixture.decorator.RouteDecoratorFixture
-org.apache.shardingsphere.infra.route.fixture.decorator.RouteFailureDecoratorFixture