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

wuweijie 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 37808b1  Split sharding ANTLR g4 file and visitor (#10807)
37808b1 is described below

commit 37808b1ed3411240fe2d79492925feae4764b320
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Jun 14 20:00:40 2021 +0800

    Split sharding ANTLR g4 file and visitor (#10807)
    
    * Add shardingsphere-sharding-distsql module
    
    * Add sharding rule parser
    
    * Add sharding rule visitor
    
    * Remove sharding rule related from common dist sql module
---
 .../src/main/antlr4/imports/Keyword.g4             |   8 -
 .../src/main/antlr4/imports/RDLStatement.g4        |  60 ------
 .../src/main/antlr4/imports/RQLStatement.g4        |  12 --
 .../distsql/parser/autogen/DistSQLStatement.g4     |  12 --
 .../parser/api/DistSQLStatementParserEngine.java   |   2 +-
 .../resource/ResourceDistSQLStatementVisitor.java  | 126 ------------
 .../resource/ResourceSQLStatementParserEngine.java |   7 +-
 .../api/DistSQLStatementParserEngineTest.java      | 183 +----------------
 .../shardingsphere-sharding/pom.xml                |   1 +
 .../shardingsphere-sharding-core/pom.xml           |   5 +
 .../shardingsphere-sharding-distsql/pom.xml        |  70 +++++++
 .../src/main/antlr4/imports/sharding/Alphabet.g4   |  74 +++----
 .../src/main/antlr4/imports/sharding}/Keyword.g4   | 132 +------------
 .../src/main/antlr4/imports/sharding/Literals.g4   |  51 ++---
 .../main/antlr4/imports/sharding}/RDLStatement.g4  | 144 +-------------
 .../main/antlr4/imports/sharding}/RQLStatement.g4  |  20 +-
 .../src/main/antlr4/imports/sharding/Symbol.g4     |  61 ++++++
 .../parser/autogen/ShardingRuleStatement.g4        |  30 +--
 .../ShardingRuleDistSQLStatementVisitor.java       | 192 ++++++++++++++++++
 .../sharding/distsql/parser/ShardingRuleLexer.java |  54 ++----
 .../distsql/parser/ShardingRuleParser.java         |  61 ++----
 .../distsql/parser/ShardingRuleParserFacade.java   |  65 +++----
 .../ShardingRuleSQLStatementVisitorFacade.java     |  59 ++----
 ...ngsphere.distsql.parser.spi.RuleSQLParserFacade |  18 ++
 ...istsql.parser.spi.RuleSQLStatementVisitorFacade |  18 ++
 .../ShardingRuleStatementParserEngineTest.java     | 216 +++++++++++++++++++++
 26 files changed, 737 insertions(+), 944 deletions(-)

diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/Keyword.g4
 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/Keyword.g4
index c776696..26e136d 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/Keyword.g4
+++ 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/Keyword.g4
@@ -119,14 +119,6 @@ REPLICA
     : R E P L I C A
     ;
 
-BINDING_TABLE
-    : B I N D I N G UL_ T A B L E
-    ;
-
-BROADCAST_TABLES
-    : B R O A D C A S T UL_ T A B L E S
-    ;
-
 GENERATED_KEY
     : G E N E R A T E D UL_ K E Y
     ;
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RDLStatement.g4
 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RDLStatement.g4
index 7a8f299..6d78bf3 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RDLStatement.g4
+++ 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RDLStatement.g4
@@ -59,34 +59,6 @@ password
     : IDENTIFIER | INT | STRING
     ;
 
-createShardingTableRule
-    : CREATE SHARDING TABLE RULE shardingTableRuleDefinition (COMMA 
shardingTableRuleDefinition)*
-    ;
-
-createShardingBindingTableRules
-    : CREATE SHARDING BINDING TABLE RULES LP bindTableRulesDefinition (COMMA 
bindTableRulesDefinition)* RP
-    ;
-
-bindTableRulesDefinition
-    : LP tableName (COMMA tableName)* RP
-    ;
-
-createShardingBroadcastTableRules
-    : CREATE SHARDING BROADCAST TABLE RULES LP IDENTIFIER (COMMA IDENTIFIER)* 
RP
-    ;
-
-alterShardingTableRule
-    : ALTER SHARDING TABLE RULE shardingTableRuleDefinition (COMMA 
shardingTableRuleDefinition)*
-    ;
-
-alterShardingBindingTableRules
-    : ALTER SHARDING BINDING TABLE RULES LP bindTableRulesDefinition (COMMA 
bindTableRulesDefinition)* RP
-    ;
-
-alterShardingBroadcastTableRules
-    : ALTER SHARDING BROADCAST TABLE RULES LP IDENTIFIER (COMMA IDENTIFIER)* RP
-    ;
-
 createReadwriteSplittingRule
     : CREATE READWRITE_SPLITTING RULE readwriteSplittingRuleDefinition (COMMA 
readwriteSplittingRuleDefinition)*
     ;
@@ -107,10 +79,6 @@ alterReadwriteSplittingRule
     : ALTER READWRITE_SPLITTING RULE readwriteSplittingRuleDefinition (COMMA 
readwriteSplittingRuleDefinition)*
     ;
 
-shardingTableRuleDefinition
-    : tableName LP resources (COMMA shardingColumn)? (COMMA 
functionDefinition)? (COMMA keyGenerateStrategy)? RP
-    ;
-
 resources
     : RESOURCES LP IDENTIFIER (COMMA IDENTIFIER)* RP
     ;
@@ -123,14 +91,6 @@ resourceName
     : IDENTIFIER
     ;
 
-shardingColumn
-    : SHARDING_COLUMN EQ columnName
-    ;
-
-keyGenerateStrategy
-    : GENERATED_KEY LP COLUMN EQ columnName COMMA functionDefinition RP
-    ;
-
 ruleName
     : IDENTIFIER
     ;
@@ -147,26 +107,6 @@ dropReadwriteSplittingRule
     : DROP READWRITE_SPLITTING RULE IDENTIFIER (COMMA IDENTIFIER)*
     ;
 
-dropShardingTableRule
-    : DROP SHARDING TABLE RULE tableName (COMMA tableName)*
-    ;
-
-dropShardingBindingTableRules
-    : DROP SHARDING BINDING TABLE RULES
-    ;
-
-dropShardingBroadcastTableRules
-    : DROP SHARDING BROADCAST TABLE RULES
-    ;
-
-schemaNames
-    : schemaName (COMMA schemaName)*
-    ;
-
-schemaName
-    : IDENTIFIER
-    ;
-
 functionDefinition
     : TYPE LP NAME EQ functionName (COMMA PROPERTIES LP algorithmProperties? 
RP)? RP
     ;
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
index 5102803..29087f4 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
+++ 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
@@ -23,18 +23,6 @@ showResources
     : SHOW RESOURCES (FROM schemaName)?
     ;
 
-showShardingTableRules
-    : SHOW SHARDING TABLE (tableRule | RULES) (FROM schemaName)?
-    ;
-
-showShardingBindingTableRules
-    : SHOW SHARDING BINDING TABLE RULES (FROM schemaName)?
-    ;
-
-showShardingBroadcastTableRules
-    : SHOW SHARDING BROADCAST TABLE RULES (FROM schemaName)?
-    ;
-
 showReadwriteSplittingRules
     : SHOW READWRITE_SPLITTING RULES (FROM schemaName)?
     ;
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/DistSQLStatement.g4
 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/DistSQLStatement.g4
index 7952d21..1f17379 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/DistSQLStatement.g4
+++ 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/DistSQLStatement.g4
@@ -22,16 +22,7 @@ import Symbol, RDLStatement, RQLStatement, RALStatement;
 execute
     : (addResource
     | dropResource
-    | createShardingTableRule
-    | createShardingBindingTableRules
-    | createShardingBroadcastTableRules
     | createReadwriteSplittingRule
-    | alterShardingTableRule
-    | alterShardingBindingTableRules
-    | alterShardingBroadcastTableRules
-    | dropShardingTableRule
-    | dropShardingBindingTableRules
-    | dropShardingBroadcastTableRules
     | alterReadwriteSplittingRule
     | dropReadwriteSplittingRule
     | createDatabaseDiscoveryRule
@@ -41,12 +32,9 @@ execute
     | alterEncryptRule
     | dropEncryptRule
     | showResources
-    | showShardingBindingTableRules
-    | showShardingBroadcastTableRules
     | showReadwriteSplittingRules
     | showDatabaseDiscoveryRules
     | showEncryptRules
-    | showShardingTableRules
     | showScalingJobList
     | showScalingJobStatus
     | startScalingJob
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/java/org/apache/shardingsphere/distsql/parser/api/DistSQLStatementParserEngine.java
 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/java/org/apache/shardingsphere/distsql/parser/api/DistSQLStatementParserEngine.java
index 1ff6b25..82453e3 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/java/org/apache/shardingsphere/distsql/parser/api/DistSQLStatementParserEngine.java
+++ 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/java/org/apache/shardingsphere/distsql/parser/api/DistSQLStatementParserEngine.java
@@ -18,8 +18,8 @@
 package org.apache.shardingsphere.distsql.parser.api;
 
 import org.antlr.v4.runtime.misc.ParseCancellationException;
-import 
org.apache.shardingsphere.distsql.parser.core.rule.RuleSQLStatementParserEngine;
 import 
org.apache.shardingsphere.distsql.parser.core.resource.ResourceSQLStatementParserEngine;
+import 
org.apache.shardingsphere.distsql.parser.core.rule.RuleSQLStatementParserEngine;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 
 /**
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/resource/ResourceDistSQLStatementVisitor.java
 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/resource/ResourceDistSQLStatementVisitor.java
index 4c75a35..ab166b9 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/resource/ResourceDistSQLStatementVisitor.java
+++ 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/resource/ResourceDistSQLStatementVisitor.java
@@ -17,7 +17,6 @@
 
 package org.apache.shardingsphere.distsql.parser.core.resource;
 
-import com.google.common.base.Joiner;
 import org.antlr.v4.runtime.RuleContext;
 import org.antlr.v4.runtime.tree.ParseTree;
 import org.antlr.v4.runtime.tree.TerminalNode;
@@ -28,18 +27,11 @@ import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.A
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.AlterDatabaseDiscoveryRuleContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.AlterEncryptRuleContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.AlterReadwriteSplittingRuleContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.AlterShardingBindingTableRulesContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.AlterShardingBroadcastTableRulesContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.AlterShardingTableRuleContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.BindTableRulesDefinitionContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.CheckScalingJobContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.ColumnDefinitionContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.CreateDatabaseDiscoveryRuleContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.CreateEncryptRuleContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.CreateReadwriteSplittingRuleContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.CreateShardingBindingTableRulesContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.CreateShardingBroadcastTableRulesContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.CreateShardingTableRuleContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.DataSourceContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.DatabaseDiscoveryRuleDefinitionContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.DropDatabaseDiscoveryRuleContext;
@@ -47,37 +39,28 @@ import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.D
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.DropReadwriteSplittingRuleContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.DropResourceContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.DropScalingJobContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.DropShardingBindingTableRulesContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.DropShardingBroadcastTableRulesContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.DropShardingTableRuleContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.DynamicReadwriteSplittingRuleDefinitionContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.EncryptRuleDefinitionContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.FunctionDefinitionContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.ReadwriteSplittingRuleDefinitionContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.ResetScalingJobContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.SchemaNameContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.ShardingTableRuleDefinitionContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.ShowDatabaseDiscoveryRulesContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.ShowEncryptRulesContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.ShowReadwriteSplittingRulesContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.ShowResourcesContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.ShowScalingJobListContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.ShowScalingJobStatusContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.ShowShardingBindingTableRulesContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.ShowShardingBroadcastTableRulesContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.ShowShardingTableRulesContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.StartScalingJobContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.StaticReadwriteSplittingRuleDefinitionContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.StopScalingJobContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.TableNameContext;
 import org.apache.shardingsphere.distsql.parser.segment.DataSourceSegment;
 import org.apache.shardingsphere.distsql.parser.segment.FunctionSegment;
-import org.apache.shardingsphere.distsql.parser.segment.TableRuleSegment;
 import 
org.apache.shardingsphere.distsql.parser.segment.rdl.DatabaseDiscoveryRuleSegment;
 import 
org.apache.shardingsphere.distsql.parser.segment.rdl.EncryptColumnSegment;
 import org.apache.shardingsphere.distsql.parser.segment.rdl.EncryptRuleSegment;
 import 
org.apache.shardingsphere.distsql.parser.segment.rdl.ReadwriteSplittingRuleSegment;
-import 
org.apache.shardingsphere.distsql.parser.segment.rdl.ShardingBindingTableRuleSegment;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.impl.CheckScalingJobStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.impl.DropScalingJobStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.impl.ResetScalingJobStatement;
@@ -88,38 +71,24 @@ import 
org.apache.shardingsphere.distsql.parser.statement.ral.impl.StopScalingJo
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.impl.AlterDatabaseDiscoveryRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.impl.AlterEncryptRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.impl.AlterReadwriteSplittingRuleStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.impl.AlterShardingBindingTableRulesStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.impl.AlterShardingBroadcastTableRulesStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.impl.AlterShardingTableRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.AddResourceStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateDatabaseDiscoveryRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateEncryptRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateReadwriteSplittingRuleStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateShardingBindingTableRulesStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateShardingBroadcastTableRulesStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateShardingTableRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.DropResourceStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropDatabaseDiscoveryRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropEncryptRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropReadwriteSplittingRuleStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropShardingBindingTableRulesStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropShardingBroadcastTableRulesStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropShardingTableRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowResourcesStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.impl.ShowDatabaseDiscoveryRulesStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.impl.ShowEncryptRulesStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.impl.ShowReadwriteSplittingRulesStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.impl.ShowShardingBindingTableRulesStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.impl.ShowShardingBroadcastTableRulesStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.impl.ShowShardingTableRulesStatement;
 import org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
 import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.SchemaSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.TableNameSegment;
 import 
org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
 
-import java.util.Collection;
-import java.util.LinkedList;
 import java.util.Objects;
 import java.util.Properties;
 import java.util.stream.Collectors;
@@ -147,58 +116,11 @@ public final class ResourceDistSQLStatementVisitor 
extends DistSQLStatementBaseV
     }
     
     @Override
-    public ASTNode visitCreateShardingTableRule(final 
CreateShardingTableRuleContext ctx) {
-        return new 
CreateShardingTableRuleStatement(ctx.shardingTableRuleDefinition().stream().map(each
 -> (TableRuleSegment) visit(each)).collect(Collectors.toList()));
-    }
-    
-    @Override
-    public ASTNode visitCreateShardingBindingTableRules(final 
CreateShardingBindingTableRulesContext ctx) {
-        Collection<ShardingBindingTableRuleSegment> rules = new LinkedList<>();
-        for (BindTableRulesDefinitionContext each : 
ctx.bindTableRulesDefinition()) {
-            ShardingBindingTableRuleSegment segment = new 
ShardingBindingTableRuleSegment();
-            
segment.setTables(Joiner.on(",").join(each.tableName().stream().map(t -> new 
IdentifierValue(t.getText()).getValue()).collect(Collectors.toList())));
-            rules.add(segment);
-        }
-        return new CreateShardingBindingTableRulesStatement(rules);
-    }
-    
-    @Override
     public ASTNode visitDropResource(final DropResourceContext ctx) {
         return new 
DropResourceStatement(ctx.IDENTIFIER().stream().map(ParseTree::getText).collect(Collectors.toList()));
     }
     
     @Override
-    public ASTNode visitCreateShardingBroadcastTableRules(final 
CreateShardingBroadcastTableRulesContext ctx) {
-        return new 
CreateShardingBroadcastTableRulesStatement(ctx.IDENTIFIER().stream().map(ParseTree::getText).collect(Collectors.toList()));
-    }
-    
-    @Override
-    public ASTNode visitAlterShardingTableRule(final 
AlterShardingTableRuleContext ctx) {
-        return new 
AlterShardingTableRuleStatement(ctx.shardingTableRuleDefinition().stream().map(each
 -> (TableRuleSegment) visit(each)).collect(Collectors.toList()));
-    }
-    
-    @Override
-    public ASTNode visitShowShardingBroadcastTableRules(final 
ShowShardingBroadcastTableRulesContext ctx) {
-        return new 
ShowShardingBroadcastTableRulesStatement(Objects.nonNull(ctx.schemaName()) ? 
(SchemaSegment) visit(ctx.schemaName()) : null);
-    }
-    
-    @Override
-    public ASTNode visitAlterShardingBindingTableRules(final 
AlterShardingBindingTableRulesContext ctx) {
-        Collection<ShardingBindingTableRuleSegment> rules = new LinkedList<>();
-        for (BindTableRulesDefinitionContext each : 
ctx.bindTableRulesDefinition()) {
-            ShardingBindingTableRuleSegment segment = new 
ShardingBindingTableRuleSegment();
-            
segment.setTables(Joiner.on(",").join(each.tableName().stream().map(t -> new 
IdentifierValue(t.getText()).getValue()).collect(Collectors.toList())));
-            rules.add(segment);
-        }
-        return new AlterShardingBindingTableRulesStatement(rules);
-    }
-    
-    @Override
-    public ASTNode visitAlterShardingBroadcastTableRules(final 
AlterShardingBroadcastTableRulesContext ctx) {
-        return new 
AlterShardingBroadcastTableRulesStatement(ctx.IDENTIFIER().stream().map(ParseTree::getText).collect(Collectors.toList()));
-    }
-    
-    @Override
     public ASTNode visitCreateReadwriteSplittingRule(final 
CreateReadwriteSplittingRuleContext ctx) {
         return new 
CreateReadwriteSplittingRuleStatement(ctx.readwriteSplittingRuleDefinition().stream().map(each
 -> (ReadwriteSplittingRuleSegment) visit(each)).collect(Collectors.toList()));
     }
@@ -239,43 +161,6 @@ public final class ResourceDistSQLStatementVisitor extends 
DistSQLStatementBaseV
     }
     
     @Override
-    public ASTNode visitDropShardingTableRule(final 
DropShardingTableRuleContext ctx) {
-        return new 
DropShardingTableRuleStatement(ctx.tableName().stream().map(each -> 
(TableNameSegment) visit(each)).collect(Collectors.toList()));
-    }
-    
-    @Override
-    public ASTNode visitDropShardingBindingTableRules(final 
DropShardingBindingTableRulesContext ctx) {
-        return new DropShardingBindingTableRulesStatement();
-    }
-    
-    @Override
-    public ASTNode visitDropShardingBroadcastTableRules(final 
DropShardingBroadcastTableRulesContext ctx) {
-        return new DropShardingBroadcastTableRulesStatement();
-    }
-    
-    @Override
-    public ASTNode visitShardingTableRuleDefinition(final 
ShardingTableRuleDefinitionContext ctx) {
-        TableRuleSegment result = new TableRuleSegment();
-        result.setLogicTable(ctx.tableName().getText());
-        Collection<String> dataSources = new LinkedList<>();
-        if (null != ctx.resources()) {
-            for (TerminalNode each : ctx.resources().IDENTIFIER()) {
-                dataSources.add(new 
IdentifierValue(each.getText()).getValue());
-            }
-        }
-        result.setDataSources(dataSources);
-        if (null != ctx.functionDefinition()) {
-            result.setTableStrategy((FunctionSegment) 
visit(ctx.functionDefinition()));
-            
result.setTableStrategyColumn(ctx.shardingColumn().columnName().getText());
-        }
-        if (null != ctx.keyGenerateStrategy()) {
-            result.setKeyGenerateStrategy((FunctionSegment) 
visit(ctx.keyGenerateStrategy().functionDefinition()));
-            
result.setKeyGenerateStrategyColumn(ctx.keyGenerateStrategy().columnName().getText());
-        }
-        return result;
-    }
-    
-    @Override
     public ASTNode visitFunctionDefinition(final FunctionDefinitionContext 
ctx) {
         FunctionSegment result = new FunctionSegment();
         result.setAlgorithmName(ctx.functionName().getText());
@@ -362,11 +247,6 @@ public final class ResourceDistSQLStatementVisitor extends 
DistSQLStatementBaseV
     }
     
     @Override
-    public ASTNode visitShowShardingBindingTableRules(final 
ShowShardingBindingTableRulesContext ctx) {
-        return new 
ShowShardingBindingTableRulesStatement(Objects.nonNull(ctx.schemaName()) ? 
(SchemaSegment) visit(ctx.schemaName()) : null);
-    }
-    
-    @Override
     public ASTNode visitSchemaName(final SchemaNameContext ctx) {
         return new SchemaSegment(ctx.getStart().getStartIndex(), 
ctx.getStop().getStopIndex(), new IdentifierValue(ctx.getText()));
     }
@@ -402,12 +282,6 @@ public final class ResourceDistSQLStatementVisitor extends 
DistSQLStatementBaseV
     }
     
     @Override
-    public ASTNode visitShowShardingTableRules(final 
ShowShardingTableRulesContext ctx) {
-        return new 
ShowShardingTableRulesStatement(Objects.nonNull(ctx.tableRule()) ? 
ctx.tableRule().tableName().getText() : null,
-                Objects.nonNull(ctx.schemaName()) ? (SchemaSegment) 
visit(ctx.schemaName()) : null);
-    }
-    
-    @Override
     public ASTNode visitShowDatabaseDiscoveryRules(final 
ShowDatabaseDiscoveryRulesContext ctx) {
         return new 
ShowDatabaseDiscoveryRulesStatement(Objects.nonNull(ctx.schemaName()) ? 
(SchemaSegment) visit(ctx.schemaName()) : null);
     }
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/resource/ResourceSQLStatementParserEngine.java
 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/resource/ResourceSQLStatementParserEngine.java
index 3e72d56..ccb08b2 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/resource/ResourceSQLStatementParserEngine.java
+++ 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/resource/ResourceSQLStatementParserEngine.java
@@ -17,7 +17,10 @@
 
 package org.apache.shardingsphere.distsql.parser.core.resource;
 
+import org.antlr.v4.runtime.BailErrorStrategy;
+import org.antlr.v4.runtime.Parser;
 import org.antlr.v4.runtime.tree.ErrorNode;
+import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
 import org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
 import org.apache.shardingsphere.sql.parser.core.ParseASTNode;
 import org.apache.shardingsphere.sql.parser.core.SQLParserFactory;
@@ -36,7 +39,9 @@ public final class ResourceSQLStatementParserEngine {
      * @return SQL statement
      */
     public SQLStatement parse(final String sql) {
-        ASTNode astNode = SQLParserFactory.newInstance(sql, 
ResourceDistSQLLexer.class, ResourceDistSQLParser.class).parse();
+        SQLParser sqlParser = SQLParserFactory.newInstance(sql, 
ResourceDistSQLLexer.class, ResourceDistSQLParser.class);
+        ((Parser) sqlParser).setErrorHandler(new BailErrorStrategy());
+        ASTNode astNode = sqlParser.parse();
         return getSQLStatement(sql, (ParseASTNode) astNode);
     }
     
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/test/java/org/apache/shardingsphere/distsql/parser/api/DistSQLStatementParserEngineTest.java
 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/test/java/org/apache/shardingsphere/distsql/parser/api/DistSQLStatementParserEngineTest.java
index cc827c9..76b1595 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/test/java/org/apache/shardingsphere/distsql/parser/api/DistSQLStatementParserEngineTest.java
+++ 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/test/java/org/apache/shardingsphere/distsql/parser/api/DistSQLStatementParserEngineTest.java
@@ -18,45 +18,30 @@
 package org.apache.shardingsphere.distsql.parser.api;
 
 import org.apache.shardingsphere.distsql.parser.segment.DataSourceSegment;
-import org.apache.shardingsphere.distsql.parser.segment.TableRuleSegment;
 import 
org.apache.shardingsphere.distsql.parser.segment.rdl.DatabaseDiscoveryRuleSegment;
-import 
org.apache.shardingsphere.distsql.parser.segment.rdl.ReadwriteSplittingRuleSegment;
 import 
org.apache.shardingsphere.distsql.parser.segment.rdl.EncryptColumnSegment;
 import org.apache.shardingsphere.distsql.parser.segment.rdl.EncryptRuleSegment;
-import 
org.apache.shardingsphere.distsql.parser.segment.rdl.ShardingBindingTableRuleSegment;
+import 
org.apache.shardingsphere.distsql.parser.segment.rdl.ReadwriteSplittingRuleSegment;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.impl.AlterDatabaseDiscoveryRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.impl.AlterEncryptRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.impl.AlterReadwriteSplittingRuleStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.impl.AlterShardingBindingTableRulesStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.impl.AlterShardingBroadcastTableRulesStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.impl.AlterShardingTableRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.AddResourceStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateDatabaseDiscoveryRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateEncryptRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateReadwriteSplittingRuleStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateShardingBindingTableRulesStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateShardingBroadcastTableRulesStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateShardingTableRuleStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.DropResourceStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropDatabaseDiscoveryRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropEncryptRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropReadwriteSplittingRuleStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.DropResourceStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropShardingBindingTableRulesStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropShardingBroadcastTableRulesStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropShardingTableRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.impl.ShowDatabaseDiscoveryRulesStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.impl.ShowEncryptRulesStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.impl.ShowReadwriteSplittingRulesStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.impl.ShowShardingTableRulesStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.impl.ShowShardingBindingTableRulesStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.impl.ShowShardingBroadcastTableRulesStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 import org.junit.Test;
 
 import java.util.ArrayList;
 import java.util.Arrays;
 import java.util.List;
-import java.util.stream.Collectors;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertNull;
@@ -75,34 +60,6 @@ public final class DistSQLStatementParserEngineTest {
     
     private static final String RDL_DROP_RESOURCE = "DROP RESOURCE ds_0,ds_1";
     
-    private static final String RDL_CREATE_SHARDING_TABLE_RULE = "CREATE 
SHARDING TABLE RULE t_order (" 
-            + "RESOURCES(ms_group_0,ms_group_1)," 
-            + "SHARDING_COLUMN=order_id," 
-            + "TYPE(NAME=hash_mod,PROPERTIES('sharding-count'=4))," 
-            + 
"GENERATED_KEY(COLUMN=another_id,TYPE(NAME=snowflake,PROPERTIES(\"worker-id\"=123))))";
-    
-    private static final String RDL_CREATE_SHARDING_BINDING_TABLE_RULES = 
"CREATE SHARDING BINDING TABLE RULES (" 
-            + "(t_order,t_order_item), (t_1,t_2))";
-    
-    private static final String RDL_CREATE_SHARDING_BROADCAST_TABLE_RULES = 
"CREATE SHARDING BROADCAST TABLE RULES(t_1,t_2)";
-    
-    private static final String RDL_ALTER_SHARDING_TABLE_RULE = "ALTER 
SHARDING TABLE RULE t_order ("
-            + "RESOURCES(ms_group_0,ms_group_1),"
-            + "SHARDING_COLUMN=order_id,"
-            + "TYPE(NAME=hash_mod,PROPERTIES('sharding-count'=4)),"
-            + 
"GENERATED_KEY(COLUMN=another_id,TYPE(NAME=snowflake,PROPERTIES(\"worker-id\"=123))))";
-    
-    private static final String RDL_ALTER_SHARDING_BINDING_TABLE_RULES = 
"ALTER SHARDING BINDING TABLE RULES ("
-            + "(t_order,t_order_item), (t_1,t_2))";
-    
-    private static final String RDL_ALTER_SHARDING_BROADCAST_TABLE_RULES = 
"ALTER SHARDING BROADCAST TABLE RULES(t_1,t_2)";
-    
-    private static final String RDL_DROP_SHARDING_TABLE_RULE = "DROP SHARDING 
TABLE RULE t_order,t_order_item";
-    
-    private static final String RDL_DROP_SHARDING_BINDING_TABLE_RULES = "DROP 
SHARDING BINDING TABLE RULES";
-    
-    private static final String RDL_DROP_SHARDING_BROADCAST_TABLE_RULES = 
"DROP SHARDING BROADCAST TABLE RULES";
-    
     private static final String RDL_CREATE_STATIC_READWRITE_SPLITTING_RULE = 
"CREATE READWRITE_SPLITTING RULE ms_group_0 ("
             + "WRITE_RESOURCE=primary_ds,"
             + "READ_RESOURCES(replica_ds_0,replica_ds_1),"
@@ -157,16 +114,6 @@ public final class DistSQLStatementParserEngineTest {
     
     private static final String RDL_DROP_ENCRYPT_RULE = "DROP ENCRYPT RULE 
t_encrypt,t_encrypt_order";
     
-    private static final String RQL_SHOW_SHARDING_BINDING_TABLE_RULES = "SHOW 
SHARDING BINDING TABLE RULES FROM sharding_db";
-    
-    private static final String RQL_SHOW_SHARDING_BROADCAST_TABLE_RULES = 
"SHOW SHARDING BROADCAST TABLE RULES FROM sharding_db";
-    
-    private static final String RQL_SHOW_SHARDING_TABLE_RULES = "SHOW SHARDING 
TABLE RULES FROM schemaName";
-    
-    private static final String RQL_SHOW_SHARDING_TABLE_RULE = "SHOW SHARDING 
TABLE RULE t_order";
-    
-    private static final String RQL_SHOW_SHARDING_TABLE_RULE_FROM = "SHOW 
SHARDING TABLE RULE t_order FROM schemaName";
-    
     private static final String RQL_SHOW_READWRITE_SPLITTING_RULES = "SHOW 
READWRITE_SPLITTING RULES FROM readwrite_splitting_db";
     
     private static final String RQL_SHOW_DB_DISCOVERY_RULES = "SHOW 
DB_DISCOVERY RULES FROM db_discovery_db";
@@ -235,96 +182,6 @@ public final class DistSQLStatementParserEngineTest {
     }
     
     @Test
-    public void assertParseCreateShardingTableRule() {
-        SQLStatement sqlStatement = 
engine.parse(RDL_CREATE_SHARDING_TABLE_RULE);
-        assertTrue(sqlStatement instanceof CreateShardingTableRuleStatement);
-        assertThat(((CreateShardingTableRuleStatement) 
sqlStatement).getRules().size(), is(1));
-        TableRuleSegment tableRuleSegment = 
((CreateShardingTableRuleStatement) sqlStatement).getRules().iterator().next();
-        assertThat(tableRuleSegment.getLogicTable(), is("t_order"));
-        
assertTrue(tableRuleSegment.getDataSources().containsAll(Arrays.asList("ms_group_0",
 "ms_group_1")));
-        assertThat(tableRuleSegment.getTableStrategyColumn(), is("order_id"));
-        
assertThat(tableRuleSegment.getKeyGenerateStrategy().getAlgorithmName(), 
is("snowflake"));
-        
assertThat(tableRuleSegment.getKeyGenerateStrategy().getAlgorithmProps().getProperty("worker-id"),
 is("123"));
-        assertThat(tableRuleSegment.getKeyGenerateStrategyColumn(), 
is("another_id"));
-        assertThat(tableRuleSegment.getTableStrategy().getAlgorithmName(), 
is("hash_mod"));
-        
assertThat(tableRuleSegment.getTableStrategy().getAlgorithmProps().getProperty("sharding-count"),
 is("4"));
-    }
-    
-    @Test
-    public void assertParseCreateShardingBindingTableRules() {
-        SQLStatement sqlStatement = 
engine.parse(RDL_CREATE_SHARDING_BINDING_TABLE_RULES);
-        assertTrue(sqlStatement instanceof 
CreateShardingBindingTableRulesStatement);
-        List<ShardingBindingTableRuleSegment> shardingBindingTableRuleSegments 
= new ArrayList<>(((CreateShardingBindingTableRulesStatement) 
sqlStatement).getRules());
-        assertThat(shardingBindingTableRuleSegments.size(), is(2));
-        ShardingBindingTableRuleSegment segment = 
shardingBindingTableRuleSegments.get(0);
-        assertThat(segment.getTables(), is("t_order,t_order_item"));
-        segment = shardingBindingTableRuleSegments.get(1);
-        assertThat(segment.getTables(), is("t_1,t_2"));
-    }
-    
-    @Test
-    public void assertParseCreateShardingBroadcastTableRules() {
-        SQLStatement sqlStatement = 
engine.parse(RDL_CREATE_SHARDING_BROADCAST_TABLE_RULES);
-        assertTrue(sqlStatement instanceof 
CreateShardingBroadcastTableRulesStatement);
-        assertThat(((CreateShardingBroadcastTableRulesStatement) 
sqlStatement).getTables(), is(Arrays.asList("t_1", "t_2")));
-    }
-    
-    @Test
-    public void assertParseAlterShardingTableRule() {
-        SQLStatement sqlStatement = 
engine.parse(RDL_ALTER_SHARDING_TABLE_RULE);
-        assertTrue(sqlStatement instanceof AlterShardingTableRuleStatement);
-        assertThat(((AlterShardingTableRuleStatement) 
sqlStatement).getRules().size(), is(1));
-        TableRuleSegment tableRuleSegment = ((AlterShardingTableRuleStatement) 
sqlStatement).getRules().iterator().next();
-        assertThat(tableRuleSegment.getLogicTable(), is("t_order"));
-        
assertTrue(tableRuleSegment.getDataSources().containsAll(Arrays.asList("ms_group_0",
 "ms_group_1")));
-        assertThat(tableRuleSegment.getTableStrategyColumn(), is("order_id"));
-        
assertThat(tableRuleSegment.getKeyGenerateStrategy().getAlgorithmName(), 
is("snowflake"));
-        
assertThat(tableRuleSegment.getKeyGenerateStrategy().getAlgorithmProps().getProperty("worker-id"),
 is("123"));
-        assertThat(tableRuleSegment.getKeyGenerateStrategyColumn(), 
is("another_id"));
-        assertThat(tableRuleSegment.getTableStrategy().getAlgorithmName(), 
is("hash_mod"));
-        
assertThat(tableRuleSegment.getTableStrategy().getAlgorithmProps().getProperty("sharding-count"),
 is("4"));
-    }
-    
-    @Test
-    public void assertParseAlterShardingBindingTableRules() {
-        SQLStatement sqlStatement = 
engine.parse(RDL_ALTER_SHARDING_BINDING_TABLE_RULES);
-        assertTrue(sqlStatement instanceof 
AlterShardingBindingTableRulesStatement);
-        List<ShardingBindingTableRuleSegment> shardingBindingTableRuleSegments 
= new ArrayList<>(((AlterShardingBindingTableRulesStatement) 
sqlStatement).getRules());
-        assertThat(shardingBindingTableRuleSegments.size(), is(2));
-        ShardingBindingTableRuleSegment segment = 
shardingBindingTableRuleSegments.get(0);
-        assertThat(segment.getTables(), is("t_order,t_order_item"));
-        segment = shardingBindingTableRuleSegments.get(1);
-        assertThat(segment.getTables(), is("t_1,t_2"));
-    }
-
-    @Test
-    public void assertParseAlterShardingBroadcastTableRules() {
-        SQLStatement sqlStatement = 
engine.parse(RDL_ALTER_SHARDING_BROADCAST_TABLE_RULES);
-        assertTrue(sqlStatement instanceof 
AlterShardingBroadcastTableRulesStatement);
-        assertThat(((AlterShardingBroadcastTableRulesStatement) 
sqlStatement).getTables(), is(Arrays.asList("t_1", "t_2")));
-    }
-    
-    @Test
-    public void assertParseDropShardingTableRule() {
-        SQLStatement sqlStatement = engine.parse(RDL_DROP_SHARDING_TABLE_RULE);
-        assertTrue(sqlStatement instanceof DropShardingTableRuleStatement);
-        assertThat(((DropShardingTableRuleStatement) 
sqlStatement).getTableNames().stream().map(each -> 
each.getIdentifier().getValue()).collect(Collectors.toList()),
-                is(Arrays.asList("t_order", "t_order_item")));
-    }
-    
-    @Test
-    public void assertParseDropShardingBindingTableRules() {
-        SQLStatement sqlStatement = 
engine.parse(RDL_DROP_SHARDING_BINDING_TABLE_RULES);
-        assertTrue(sqlStatement instanceof 
DropShardingBindingTableRulesStatement);
-    }
-    
-    @Test
-    public void assertParseDropShardingBroadcastTableRules() {
-        SQLStatement sqlStatement = 
engine.parse(RDL_DROP_SHARDING_BROADCAST_TABLE_RULES);
-        assertTrue(sqlStatement instanceof 
DropShardingBroadcastTableRulesStatement);
-    }
-    
-    @Test
     public void assertParseStaticReadwriteSplittingRule() {
         SQLStatement sqlStatement = 
engine.parse(RDL_CREATE_STATIC_READWRITE_SPLITTING_RULE);
         assertTrue(sqlStatement instanceof 
CreateReadwriteSplittingRuleStatement);
@@ -475,42 +332,6 @@ public final class DistSQLStatementParserEngineTest {
     }
     
     @Test
-    public void assertParseShowShardingTableRules() {
-        SQLStatement sqlStatement = 
engine.parse(RQL_SHOW_SHARDING_TABLE_RULES);
-        assertTrue(sqlStatement instanceof ShowShardingTableRulesStatement);
-        assertThat(((ShowShardingTableRulesStatement) 
sqlStatement).getSchema().get().getIdentifier().getValue(), is("schemaName"));
-    }
-    
-    @Test
-    public void assertParseShowShardingTableRule() {
-        SQLStatement sqlStatement = engine.parse(RQL_SHOW_SHARDING_TABLE_RULE);
-        assertTrue(sqlStatement instanceof ShowShardingTableRulesStatement);
-        assertThat(((ShowShardingTableRulesStatement) 
sqlStatement).getTableName(), is("t_order"));
-    }
-    
-    @Test
-    public void assertParseShowShardingTableRuleFrom() {
-        SQLStatement sqlStatement = 
engine.parse(RQL_SHOW_SHARDING_TABLE_RULE_FROM);
-        assertTrue(sqlStatement instanceof ShowShardingTableRulesStatement);
-        assertThat(((ShowShardingTableRulesStatement) 
sqlStatement).getTableName(), is("t_order"));
-        assertThat(((ShowShardingTableRulesStatement) 
sqlStatement).getSchema().get().getIdentifier().getValue(), is("schemaName"));
-    }
-    
-    @Test
-    public void assertParseShowShardingBindingTableRules() {
-        SQLStatement sqlStatement = 
engine.parse(RQL_SHOW_SHARDING_BINDING_TABLE_RULES);
-        assertTrue(sqlStatement instanceof 
ShowShardingBindingTableRulesStatement);
-        assertThat(((ShowShardingBindingTableRulesStatement) 
sqlStatement).getSchema().get().getIdentifier().getValue(), is("sharding_db"));
-    }
-    
-    @Test
-    public void assertParseShowShardingBroadcastTableRules() {
-        SQLStatement sqlStatement = 
engine.parse(RQL_SHOW_SHARDING_BROADCAST_TABLE_RULES);
-        assertTrue(sqlStatement instanceof 
ShowShardingBroadcastTableRulesStatement);
-        assertThat(((ShowShardingBroadcastTableRulesStatement) 
sqlStatement).getSchema().get().getIdentifier().getValue(), is("sharding_db"));
-    }
-    
-    @Test
     public void assertParseShowReadwriteSplittingRules() {
         SQLStatement sqlStatement = 
engine.parse(RQL_SHOW_READWRITE_SPLITTING_RULES);
         assertTrue(sqlStatement instanceof 
ShowReadwriteSplittingRulesStatement);
diff --git a/shardingsphere-features/shardingsphere-sharding/pom.xml 
b/shardingsphere-features/shardingsphere-sharding/pom.xml
index 5d3e2da..b510db3 100644
--- a/shardingsphere-features/shardingsphere-sharding/pom.xml
+++ b/shardingsphere-features/shardingsphere-sharding/pom.xml
@@ -30,6 +30,7 @@
     <modules>
         <module>shardingsphere-sharding-api</module>
         <module>shardingsphere-sharding-core</module>
+        <module>shardingsphere-sharding-distsql</module>
         <module>shardingsphere-sharding-spring</module>
     </modules>
 </project>
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/pom.xml
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/pom.xml
index 68f5a89..afcc8df 100644
--- 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/pom.xml
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/pom.xml
@@ -32,6 +32,11 @@
             <artifactId>shardingsphere-sharding-api</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-sharding-distsql</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/pom.xml
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/pom.xml
new file mode 100644
index 0000000..8161ead
--- /dev/null
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/pom.xml
@@ -0,0 +1,70 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0";
+         xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <artifactId>shardingsphere-sharding</artifactId>
+        <groupId>org.apache.shardingsphere</groupId>
+        <version>5.0.0-RC1-SNAPSHOT</version>
+    </parent>
+    <artifactId>shardingsphere-sharding-distsql</artifactId>
+    <name>${project.artifactId}</name>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-sql-parser-spi</artifactId>
+            <version>5.0.0-RC1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-distsql-parser-statement</artifactId>
+            <version>5.0.0-RC1-SNAPSHOT</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-distsql-parser-engine</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.antlr</groupId>
+                <artifactId>antlr4-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>antlr</id>
+                        <configuration>
+                            
<libDirectory>src/main/antlr4/imports/sharding/</libDirectory>
+                            <listener>false</listener>
+                            <visitor>true</visitor>
+                        </configuration>
+                        <goals>
+                            <goal>antlr4</goal>
+                        </goals>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/imports/sharding/Alphabet.g4
similarity index 50%
copy from 
shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
copy to 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/imports/sharding/Alphabet.g4
index 5102803..f7603cc 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/imports/sharding/Alphabet.g4
@@ -15,46 +15,34 @@
  * limitations under the License.
  */
 
-grammar RQLStatement;
-
-import Keyword, Literals, Symbol;
-
-showResources
-    : SHOW RESOURCES (FROM schemaName)?
-    ;
-
-showShardingTableRules
-    : SHOW SHARDING TABLE (tableRule | RULES) (FROM schemaName)?
-    ;
-
-showShardingBindingTableRules
-    : SHOW SHARDING BINDING TABLE RULES (FROM schemaName)?
-    ;
-
-showShardingBroadcastTableRules
-    : SHOW SHARDING BROADCAST TABLE RULES (FROM schemaName)?
-    ;
-
-showReadwriteSplittingRules
-    : SHOW READWRITE_SPLITTING RULES (FROM schemaName)?
-    ;
-
-showDatabaseDiscoveryRules
-    : SHOW DB_DISCOVERY RULES (FROM schemaName)?
-    ;
-
-showEncryptRules
-    : SHOW ENCRYPT (TABLE tableRule | RULES) (FROM schemaName)?
-    ;
-
-tableRule
-    : RULE tableName
-    ;
-
-schemaName
-    : IDENTIFIER
-    ;
-
-tableName
-    : IDENTIFIER
-    ;
+lexer grammar Alphabet;
+
+FOR_GENERATOR: 'DO NOT MATCH ANY THING, JUST FOR GENERATOR';
+
+fragment A:   [Aa];
+fragment B:   [Bb];
+fragment C:   [Cc];
+fragment D:   [Dd];
+fragment E:   [Ee];
+fragment F:   [Ff];
+fragment G:   [Gg];
+fragment H:   [Hh];
+fragment I:   [Ii];
+fragment J:   [Jj];
+fragment K:   [Kk];
+fragment L:   [Ll];
+fragment M:   [Mm];
+fragment N:   [Nn];
+fragment O:   [Oo];
+fragment P:   [Pp];
+fragment Q:   [Qq];
+fragment R:   [Rr];
+fragment S:   [Ss];
+fragment T:   [Tt];
+fragment U:   [Uu];
+fragment V:   [Vv];
+fragment W:   [Ww];
+fragment X:   [Xx];
+fragment Y:   [Yy];
+fragment Z:   [Zz];
+fragment UL_: '_';
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/Keyword.g4
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/imports/sharding/Keyword.g4
similarity index 58%
copy from 
shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/Keyword.g4
copy to 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/imports/sharding/Keyword.g4
index c776696..fd08625 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/Keyword.g4
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/imports/sharding/Keyword.g4
@@ -23,10 +23,6 @@ WS
     : [ \t\r\n] + ->skip
     ;
 
-ADD
-    : A D D
-    ;
-
 CREATE
     : C R E A T E
     ;
@@ -35,10 +31,6 @@ ALTER
     : A L T E R
     ;
 
-MODIFY
-    : M O D I F Y
-    ;
-
 DROP
     : D R O P
     ;
@@ -47,28 +39,8 @@ SHOW
     : S H O W
     ;
 
-START
-    : S T A R T
-    ;
-
-STOP
-    : S T O P
-    ;
-
-RESET
-    : R E S E T
-    ;
-
-CHECK
-    : C H E C K
-    ;
-
-RESOURCE
-    : R E S O U R C E
-    ;
-
-RESOURCES
-    : R E S O U R C E S
+SHARDING
+    : S H A R D I N G
     ;
 
 RULE
@@ -79,52 +51,8 @@ FROM
     : F R O M
     ;
 
-SHARDING
-    : S H A R D I N G
-    ;
-
-READWRITE_SPLITTING
-    : R E A D W R I T E UL_ S P L I T T I N G
-    ;
-
-WRITE_RESOURCE
-    : W R I T E UL_ R E S O U R C E
-    ;
-
-READ_RESOURCES
-    : R E A D UL_ R E S O U R C E S
-    ;
-
-AUTO_AWARE_RESOURCE
-    : A U T O UL_ A W A R E UL_ R E S O U R C E
-    ;
-
-REPLICA_QUERY
-    : R E P L I C A UL_ Q U E R Y
-    ;
-
-ENCRYPT
-    : E N C R Y P T
-    ;
-
-SHADOW
-    : S H A D O W
-    ;
-
-PRIMARY
-    : P R I M A R Y
-    ;
-
-REPLICA
-    : R E P L I C A
-    ;
-
-BINDING_TABLE
-    : B I N D I N G UL_ T A B L E
-    ;
-
-BROADCAST_TABLES
-    : B R O A D C A S T UL_ T A B L E S
+RESOURCES
+    : R E S O U R C E S
     ;
 
 GENERATED_KEY
@@ -135,42 +63,6 @@ DEFAULT_TABLE_STRATEGY
     : D E F A U L T UL_ T A B L E UL_ S T R A T E G Y
     ;
 
-SCALING
-    : S C A L I N G
-    ;
-
-JOB
-    : J O B
-    ;
-
-LIST
-    : L I S T
-    ;
-
-STATUS
-    : S T A T U S
-    ;
-
-HOST
-    : H O S T
-    ;
-    
-PORT
-    : P O R T
-    ;
-    
-DB
-    : D B
-    ;
-    
-USER
-    : U S E R
-    ;
-    
-PASSWORD
-    : P A S S W O R D
-    ;
-
 TABLE
     : T A B L E
     ;
@@ -199,26 +91,14 @@ BINDING
     : B I N D I N G
     ;
 
-RULES
-    : R U L E S
-    ;
-
 BROADCAST
     : B R O A D C A S T
     ;
 
-DB_DISCOVERY
-    : D B UL_ D I S C O V E R Y
+RULES
+    : R U L E S
     ;
 
 COLUMNS
     : C O L U M N S
     ;
-
-CIPHER
-    : C I P H E R
-    ;
-
-PLAIN
-    : P L A I N
-    ;
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/imports/sharding/Literals.g4
similarity index 53%
copy from 
shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
copy to 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/imports/sharding/Literals.g4
index 5102803..e5f807b 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/imports/sharding/Literals.g4
@@ -15,46 +15,37 @@
  * limitations under the License.
  */
 
-grammar RQLStatement;
+lexer grammar Literals;
 
-import Keyword, Literals, Symbol;
+import Alphabet, Symbol;
 
-showResources
-    : SHOW RESOURCES (FROM schemaName)?
+IDENTIFIER
+    : [A-Za-z_$0-9]*?[A-Za-z_$]+?[A-Za-z_$0-9]*
+    | BQ ~'`'+ BQ
+    | (DQ ( '\\'. | '""' | ~('"'| '\\') )* DQ)
     ;
-
-showShardingTableRules
-    : SHOW SHARDING TABLE (tableRule | RULES) (FROM schemaName)?
-    ;
-
-showShardingBindingTableRules
-    : SHOW SHARDING BINDING TABLE RULES (FROM schemaName)?
-    ;
-
-showShardingBroadcastTableRules
-    : SHOW SHARDING BROADCAST TABLE RULES (FROM schemaName)?
-    ;
-
-showReadwriteSplittingRules
-    : SHOW READWRITE_SPLITTING RULES (FROM schemaName)?
+    
+STRING
+    : (DQ ('""' | ~('"'| '\\') )* DQ)
+    | (SQ ('\'\'' | ~('\'' | '\\'))* SQ)
     ;
 
-showDatabaseDiscoveryRules
-    : SHOW DB_DISCOVERY RULES (FROM schemaName)?
+INT
+    : [0-9]+
     ;
 
-showEncryptRules
-    : SHOW ENCRYPT (TABLE tableRule | RULES) (FROM schemaName)?
+HEX
+    : [0-9a-fA-F]
     ;
 
-tableRule
-    : RULE tableName
+NUMBER
+    : INT? DOT? INT (E (PLUS | MINUS)? INT)?
     ;
 
-schemaName
-    : IDENTIFIER
+HEXDIGIT
+    : '0x' HEX+ | 'X' SQ HEX+ SQ
     ;
-
-tableName
-    : IDENTIFIER
+    
+BITNUM
+    : '0b' ('0' | '1')+ | B SQ ('0' | '1')+ SQ
     ;
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RDLStatement.g4
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/imports/sharding/RDLStatement.g4
similarity index 50%
copy from 
shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RDLStatement.g4
copy to 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/imports/sharding/RDLStatement.g4
index 7a8f299..3c4234e 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RDLStatement.g4
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/imports/sharding/RDLStatement.g4
@@ -19,46 +19,6 @@ grammar RDLStatement;
 
 import Keyword, Literals, Symbol;
 
-addResource
-    : ADD RESOURCE dataSource (COMMA dataSource)*
-    ;
-
-dropResource
-    : DROP RESOURCE IDENTIFIER (COMMA IDENTIFIER)*
-    ;
-
-dataSource
-    : dataSourceName LP HOST EQ hostName COMMA PORT EQ port COMMA DB EQ dbName 
COMMA USER EQ user (COMMA PASSWORD EQ password)? RP
-    ;
-
-dataSourceName
-    : IDENTIFIER
-    ;
-
-hostName
-    : IDENTIFIER | ip
-    ;
-
-ip
-    : NUMBER+
-    ;
-
-port
-    : INT
-    ;
-
-dbName
-    : IDENTIFIER
-    ;
-
-user
-    : IDENTIFIER | NUMBER
-    ;
-
-password
-    : IDENTIFIER | INT | STRING
-    ;
-
 createShardingTableRule
     : CREATE SHARDING TABLE RULE shardingTableRuleDefinition (COMMA 
shardingTableRuleDefinition)*
     ;
@@ -67,10 +27,6 @@ createShardingBindingTableRules
     : CREATE SHARDING BINDING TABLE RULES LP bindTableRulesDefinition (COMMA 
bindTableRulesDefinition)* RP
     ;
 
-bindTableRulesDefinition
-    : LP tableName (COMMA tableName)* RP
-    ;
-
 createShardingBroadcastTableRules
     : CREATE SHARDING BROADCAST TABLE RULES LP IDENTIFIER (COMMA IDENTIFIER)* 
RP
     ;
@@ -87,24 +43,16 @@ alterShardingBroadcastTableRules
     : ALTER SHARDING BROADCAST TABLE RULES LP IDENTIFIER (COMMA IDENTIFIER)* RP
     ;
 
-createReadwriteSplittingRule
-    : CREATE READWRITE_SPLITTING RULE readwriteSplittingRuleDefinition (COMMA 
readwriteSplittingRuleDefinition)*
-    ;
-
-readwriteSplittingRuleDefinition
-    : ruleName LP (staticReadwriteSplittingRuleDefinition | 
dynamicReadwriteSplittingRuleDefinition) (COMMA functionDefinition)? RP
-    ;
-
-staticReadwriteSplittingRuleDefinition
-    : WRITE_RESOURCE EQ writeResourceName COMMA READ_RESOURCES LP resourceName 
(COMMA resourceName)* RP
+dropShardingTableRule
+    : DROP SHARDING TABLE RULE tableName (COMMA tableName)*
     ;
 
-dynamicReadwriteSplittingRuleDefinition
-    : AUTO_AWARE_RESOURCE EQ IDENTIFIER
+dropShardingBindingTableRules
+    : DROP SHARDING BINDING TABLE RULES
     ;
 
-alterReadwriteSplittingRule
-    : ALTER READWRITE_SPLITTING RULE readwriteSplittingRuleDefinition (COMMA 
readwriteSplittingRuleDefinition)*
+dropShardingBroadcastTableRules
+    : DROP SHARDING BROADCAST TABLE RULES
     ;
 
 shardingTableRuleDefinition
@@ -115,14 +63,6 @@ resources
     : RESOURCES LP IDENTIFIER (COMMA IDENTIFIER)* RP
     ;
 
-writeResourceName
-    : resourceName
-    ;
-
-resourceName
-    : IDENTIFIER
-    ;
-
 shardingColumn
     : SHARDING_COLUMN EQ columnName
     ;
@@ -131,10 +71,6 @@ keyGenerateStrategy
     : GENERATED_KEY LP COLUMN EQ columnName COMMA functionDefinition RP
     ;
 
-ruleName
-    : IDENTIFIER
-    ;
-
 tableName
     : IDENTIFIER
     ;
@@ -143,30 +79,6 @@ columnName
     : IDENTIFIER
     ;
 
-dropReadwriteSplittingRule
-    : DROP READWRITE_SPLITTING RULE IDENTIFIER (COMMA IDENTIFIER)*
-    ;
-
-dropShardingTableRule
-    : DROP SHARDING TABLE RULE tableName (COMMA tableName)*
-    ;
-
-dropShardingBindingTableRules
-    : DROP SHARDING BINDING TABLE RULES
-    ;
-
-dropShardingBroadcastTableRules
-    : DROP SHARDING BROADCAST TABLE RULES
-    ;
-
-schemaNames
-    : schemaName (COMMA schemaName)*
-    ;
-
-schemaName
-    : IDENTIFIER
-    ;
-
 functionDefinition
     : TYPE LP NAME EQ functionName (COMMA PROPERTIES LP algorithmProperties? 
RP)? RP
     ;
@@ -183,46 +95,6 @@ algorithmProperty
     : key=(IDENTIFIER | STRING) EQ value=(NUMBER | INT | STRING)
     ;
 
-createDatabaseDiscoveryRule
-    : CREATE DB_DISCOVERY RULE databaseDiscoveryRuleDefinition  (COMMA 
databaseDiscoveryRuleDefinition)*
-    ;
-
-databaseDiscoveryRuleDefinition
-    : ruleName LP resources COMMA functionDefinition RP
-    ;
-
-alterDatabaseDiscoveryRule
-    : ALTER DB_DISCOVERY RULE databaseDiscoveryRuleDefinition  (COMMA 
databaseDiscoveryRuleDefinition)*
-    ;
-
-dropDatabaseDiscoveryRule
-    : DROP DB_DISCOVERY RULE IDENTIFIER (COMMA IDENTIFIER)*
-    ;
-
-createEncryptRule
-    : CREATE ENCRYPT RULE encryptRuleDefinition (COMMA encryptRuleDefinition)*
-    ;
-
-encryptRuleDefinition
-    : tableName LP (RESOURCE EQ resourceName COMMA)? COLUMNS LP 
columnDefinition (COMMA columnDefinition)*  RP RP
-    ;
-
-columnDefinition
-    : LP NAME EQ columnName (COMMA PLAIN EQ plainColumnName)? COMMA CIPHER EQ 
cipherColumnName COMMA functionDefinition RP
-    ;
-
-alterEncryptRule
-    : ALTER ENCRYPT RULE encryptRuleDefinition (COMMA encryptRuleDefinition)*
-    ;
-
-dropEncryptRule
-    : DROP ENCRYPT RULE IDENTIFIER (COMMA IDENTIFIER)*
-    ;
-
-plainColumnName
-    : IDENTIFIER
-    ;
-
-cipherColumnName
-    : IDENTIFIER
+bindTableRulesDefinition
+    : LP tableName (COMMA tableName)* RP
     ;
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/imports/sharding/RQLStatement.g4
similarity index 79%
copy from 
shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
copy to 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/imports/sharding/RQLStatement.g4
index 5102803..aa3e22f 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/imports/sharding/RQLStatement.g4
@@ -19,10 +19,6 @@ grammar RQLStatement;
 
 import Keyword, Literals, Symbol;
 
-showResources
-    : SHOW RESOURCES (FROM schemaName)?
-    ;
-
 showShardingTableRules
     : SHOW SHARDING TABLE (tableRule | RULES) (FROM schemaName)?
     ;
@@ -35,26 +31,14 @@ showShardingBroadcastTableRules
     : SHOW SHARDING BROADCAST TABLE RULES (FROM schemaName)?
     ;
 
-showReadwriteSplittingRules
-    : SHOW READWRITE_SPLITTING RULES (FROM schemaName)?
-    ;
-
-showDatabaseDiscoveryRules
-    : SHOW DB_DISCOVERY RULES (FROM schemaName)?
-    ;
-
-showEncryptRules
-    : SHOW ENCRYPT (TABLE tableRule | RULES) (FROM schemaName)?
-    ;
-
 tableRule
     : RULE tableName
     ;
 
-schemaName
+tableName
     : IDENTIFIER
     ;
 
-tableName
+schemaName
     : IDENTIFIER
     ;
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/imports/sharding/Symbol.g4
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/imports/sharding/Symbol.g4
new file mode 100644
index 0000000..a332bdd
--- /dev/null
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/imports/sharding/Symbol.g4
@@ -0,0 +1,61 @@
+/*
+ * 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.
+ */
+
+lexer grammar Symbol;
+
+AND:                '&&';
+OR:                 '||';
+NOT:                '!';
+TILDE:              '~';
+VERTICALBAR:       '|';
+AMPERSAND:          '&';
+SIGNEDLEFTSHIFT:  '<<';
+SIGNEDRIGHTSHIFT: '>>';
+CARET:              '^';
+MOD:                '%';
+COLON:              ':';
+PLUS:               '+';
+MINUS:              '-';
+ASTERISK:           '*';
+SLASH:              '/';
+BACKSLASH:          '\\';
+DOT:                '.';
+DOTASTERISK:       '.*';
+SAFEEQ:            '<=>';
+DEQ:                '==';
+EQ:                 '=';
+NEQ:                '<>' | '!=';
+GT:                 '>';
+GTE:                '>=';
+LT:                 '<';
+LTE:                '<=';
+POUND:              '#';
+LP:                 '(';
+RP:                 ')';
+LBE:                '{';
+RBE:                '}';
+LBT:                '[';
+RBT:                ']';
+COMMA:              ',';
+DQ:                 '"';
+SQ :                '\'';
+BQ:                 '`';
+QUESTION:           '?';
+AT:                 '@';
+SEMI:               ';';
+JSONSEPARATOR:      '->>';
+UL:                 '_';
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/DistSQLStatement.g4
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/ShardingRuleStatement.g4
similarity index 63%
copy from 
shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/DistSQLStatement.g4
copy to 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/ShardingRuleStatement.g4
index 7952d21..5e85e20 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/DistSQLStatement.g4
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/ShardingRuleStatement.g4
@@ -15,44 +15,22 @@
  * limitations under the License.
  */
 
-grammar DistSQLStatement;
+grammar ShardingRuleStatement;
 
-import Symbol, RDLStatement, RQLStatement, RALStatement;
+import Symbol, RDLStatement, RQLStatement;
 
 execute
-    : (addResource
-    | dropResource
-    | createShardingTableRule
+    : (createShardingTableRule
     | createShardingBindingTableRules
     | createShardingBroadcastTableRules
-    | createReadwriteSplittingRule
     | alterShardingTableRule
     | alterShardingBindingTableRules
     | alterShardingBroadcastTableRules
     | dropShardingTableRule
     | dropShardingBindingTableRules
     | dropShardingBroadcastTableRules
-    | alterReadwriteSplittingRule
-    | dropReadwriteSplittingRule
-    | createDatabaseDiscoveryRule
-    | alterDatabaseDiscoveryRule
-    | dropDatabaseDiscoveryRule
-    | createEncryptRule
-    | alterEncryptRule
-    | dropEncryptRule
-    | showResources
+    | showShardingTableRules
     | showShardingBindingTableRules
     | showShardingBroadcastTableRules
-    | showReadwriteSplittingRules
-    | showDatabaseDiscoveryRules
-    | showEncryptRules
-    | showShardingTableRules
-    | showScalingJobList
-    | showScalingJobStatus
-    | startScalingJob
-    | stopScalingJob
-    | dropScalingJob
-    | resetScalingJob
-    | checkScalingJob
     ) SEMI?
     ;
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleDistSQLStatementVisitor.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleDistSQLStatementVisitor.java
new file mode 100644
index 0000000..3f99b20
--- /dev/null
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleDistSQLStatementVisitor.java
@@ -0,0 +1,192 @@
+/*
+ * 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.
+ */
+
+package org.apache.shardingsphere.sharding.distsql.parser;
+
+import com.google.common.base.Joiner;
+import org.antlr.v4.runtime.tree.ParseTree;
+import org.antlr.v4.runtime.tree.TerminalNode;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementBaseVisitor;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser.AlgorithmPropertyContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser.AlterShardingBindingTableRulesContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser.AlterShardingBroadcastTableRulesContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser.AlterShardingTableRuleContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser.BindTableRulesDefinitionContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser.CreateShardingBindingTableRulesContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser.CreateShardingBroadcastTableRulesContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser.CreateShardingTableRuleContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser.DropShardingBindingTableRulesContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser.DropShardingBroadcastTableRulesContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser.DropShardingTableRuleContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser.FunctionDefinitionContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser.SchemaNameContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser.ShardingTableRuleDefinitionContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser.ShowShardingBindingTableRulesContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser.ShowShardingBroadcastTableRulesContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser.ShowShardingTableRulesContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser.TableNameContext;
+import org.apache.shardingsphere.distsql.parser.segment.FunctionSegment;
+import org.apache.shardingsphere.distsql.parser.segment.TableRuleSegment;
+import 
org.apache.shardingsphere.distsql.parser.segment.rdl.ShardingBindingTableRuleSegment;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.impl.AlterShardingBindingTableRulesStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.impl.AlterShardingBroadcastTableRulesStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.impl.AlterShardingTableRuleStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateShardingBindingTableRulesStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateShardingBroadcastTableRulesStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateShardingTableRuleStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropShardingBindingTableRulesStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropShardingBroadcastTableRulesStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropShardingTableRuleStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.impl.ShowShardingBindingTableRulesStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.impl.ShowShardingBroadcastTableRulesStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.impl.ShowShardingTableRulesStatement;
+import org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
+import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
+import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.SchemaSegment;
+import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.table.TableNameSegment;
+import 
org.apache.shardingsphere.sql.parser.sql.common.value.identifier.IdentifierValue;
+
+import java.util.Collection;
+import java.util.LinkedList;
+import java.util.Objects;
+import java.util.Properties;
+import java.util.stream.Collectors;
+
+/**
+ * SQL statement visitor for sharding rule.
+ */
+public final class ShardingRuleDistSQLStatementVisitor extends 
ShardingRuleStatementBaseVisitor<ASTNode> implements SQLVisitor {
+    
+    @Override
+    public ASTNode visitCreateShardingTableRule(final 
CreateShardingTableRuleContext ctx) {
+        return new 
CreateShardingTableRuleStatement(ctx.shardingTableRuleDefinition().stream().map(each
 -> (TableRuleSegment) visit(each)).collect(Collectors.toList()));
+    }
+    
+    @Override
+    public ASTNode visitCreateShardingBindingTableRules(final 
CreateShardingBindingTableRulesContext ctx) {
+        Collection<ShardingBindingTableRuleSegment> rules = new LinkedList<>();
+        for (BindTableRulesDefinitionContext each : 
ctx.bindTableRulesDefinition()) {
+            ShardingBindingTableRuleSegment segment = new 
ShardingBindingTableRuleSegment();
+            
segment.setTables(Joiner.on(",").join(each.tableName().stream().map(t -> new 
IdentifierValue(t.getText()).getValue()).collect(Collectors.toList())));
+            rules.add(segment);
+        }
+        return new CreateShardingBindingTableRulesStatement(rules);
+    }
+    
+    @Override
+    public ASTNode visitCreateShardingBroadcastTableRules(final 
CreateShardingBroadcastTableRulesContext ctx) {
+        return new 
CreateShardingBroadcastTableRulesStatement(ctx.IDENTIFIER().stream().map(ParseTree::getText).collect(Collectors.toList()));
+    }
+    
+    @Override
+    public ASTNode visitAlterShardingTableRule(final 
AlterShardingTableRuleContext ctx) {
+        return new 
AlterShardingTableRuleStatement(ctx.shardingTableRuleDefinition().stream().map(each
 -> (TableRuleSegment) visit(each)).collect(Collectors.toList()));
+    }
+    
+    @Override
+    public ASTNode visitShowShardingBroadcastTableRules(final 
ShowShardingBroadcastTableRulesContext ctx) {
+        return new 
ShowShardingBroadcastTableRulesStatement(Objects.nonNull(ctx.schemaName()) ? 
(SchemaSegment) visit(ctx.schemaName()) : null);
+    }
+    
+    @Override
+    public ASTNode visitAlterShardingBindingTableRules(final 
AlterShardingBindingTableRulesContext ctx) {
+        Collection<ShardingBindingTableRuleSegment> rules = new LinkedList<>();
+        for (BindTableRulesDefinitionContext each : 
ctx.bindTableRulesDefinition()) {
+            ShardingBindingTableRuleSegment segment = new 
ShardingBindingTableRuleSegment();
+            
segment.setTables(Joiner.on(",").join(each.tableName().stream().map(t -> new 
IdentifierValue(t.getText()).getValue()).collect(Collectors.toList())));
+            rules.add(segment);
+        }
+        return new AlterShardingBindingTableRulesStatement(rules);
+    }
+    
+    @Override
+    public ASTNode visitAlterShardingBroadcastTableRules(final 
AlterShardingBroadcastTableRulesContext ctx) {
+        return new 
AlterShardingBroadcastTableRulesStatement(ctx.IDENTIFIER().stream().map(ParseTree::getText).collect(Collectors.toList()));
+    }
+    
+    @Override
+    public ASTNode visitDropShardingTableRule(final 
DropShardingTableRuleContext ctx) {
+        return new 
DropShardingTableRuleStatement(ctx.tableName().stream().map(each -> 
(TableNameSegment) visit(each)).collect(Collectors.toList()));
+    }
+    
+    @Override
+    public ASTNode visitDropShardingBindingTableRules(final 
DropShardingBindingTableRulesContext ctx) {
+        return new DropShardingBindingTableRulesStatement();
+    }
+    
+    @Override
+    public ASTNode visitDropShardingBroadcastTableRules(final 
DropShardingBroadcastTableRulesContext ctx) {
+        return new DropShardingBroadcastTableRulesStatement();
+    }
+    
+    @Override
+    public ASTNode visitShardingTableRuleDefinition(final 
ShardingTableRuleDefinitionContext ctx) {
+        TableRuleSegment result = new TableRuleSegment();
+        result.setLogicTable(ctx.tableName().getText());
+        Collection<String> dataSources = new LinkedList<>();
+        if (null != ctx.resources()) {
+            for (TerminalNode each : ctx.resources().IDENTIFIER()) {
+                dataSources.add(new 
IdentifierValue(each.getText()).getValue());
+            }
+        }
+        result.setDataSources(dataSources);
+        if (null != ctx.functionDefinition()) {
+            result.setTableStrategy((FunctionSegment) 
visit(ctx.functionDefinition()));
+            
result.setTableStrategyColumn(ctx.shardingColumn().columnName().getText());
+        }
+        if (null != ctx.keyGenerateStrategy()) {
+            result.setKeyGenerateStrategy((FunctionSegment) 
visit(ctx.keyGenerateStrategy().functionDefinition()));
+            
result.setKeyGenerateStrategyColumn(ctx.keyGenerateStrategy().columnName().getText());
+        }
+        return result;
+    }
+    
+    @Override
+    public ASTNode visitFunctionDefinition(final FunctionDefinitionContext 
ctx) {
+        FunctionSegment result = new FunctionSegment();
+        result.setAlgorithmName(ctx.functionName().getText());
+        Properties algorithmProps = new Properties();
+        if (null != ctx.algorithmProperties()) {
+            for (AlgorithmPropertyContext each : 
ctx.algorithmProperties().algorithmProperty()) {
+                algorithmProps.setProperty(new 
IdentifierValue(each.key.getText()).getValue(), new 
IdentifierValue(each.value.getText()).getValue());
+            }
+        }
+        result.setAlgorithmProps(algorithmProps);
+        return result;
+    }
+    
+    @Override
+    public ASTNode visitTableName(final TableNameContext ctx) {
+        return new TableNameSegment(ctx.getStart().getStartIndex(), 
ctx.getStop().getStopIndex(), new IdentifierValue(ctx.getText()));
+    }
+    
+    @Override
+    public ASTNode visitShowShardingBindingTableRules(final 
ShowShardingBindingTableRulesContext ctx) {
+        return new 
ShowShardingBindingTableRulesStatement(Objects.nonNull(ctx.schemaName()) ? 
(SchemaSegment) visit(ctx.schemaName()) : null);
+    }
+    
+    @Override
+    public ASTNode visitSchemaName(final SchemaNameContext ctx) {
+        return new SchemaSegment(ctx.getStart().getStartIndex(), 
ctx.getStop().getStopIndex(), new IdentifierValue(ctx.getText()));
+    }
+    
+    @Override
+    public ASTNode visitShowShardingTableRules(final 
ShowShardingTableRulesContext ctx) {
+        return new 
ShowShardingTableRulesStatement(Objects.nonNull(ctx.tableRule()) ? 
ctx.tableRule().tableName().getText() : null,
+                Objects.nonNull(ctx.schemaName()) ? (SchemaSegment) 
visit(ctx.schemaName()) : null);
+    }
+}
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleLexer.java
similarity index 50%
copy from 
shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
copy to 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleLexer.java
index 5102803..a0657cd 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleLexer.java
@@ -15,46 +15,18 @@
  * limitations under the License.
  */
 
-grammar RQLStatement;
+package org.apache.shardingsphere.sharding.distsql.parser;
 
-import Keyword, Literals, Symbol;
+import org.antlr.v4.runtime.CharStream;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementLexer;
+import org.apache.shardingsphere.sql.parser.api.parser.SQLLexer;
 
-showResources
-    : SHOW RESOURCES (FROM schemaName)?
-    ;
-
-showShardingTableRules
-    : SHOW SHARDING TABLE (tableRule | RULES) (FROM schemaName)?
-    ;
-
-showShardingBindingTableRules
-    : SHOW SHARDING BINDING TABLE RULES (FROM schemaName)?
-    ;
-
-showShardingBroadcastTableRules
-    : SHOW SHARDING BROADCAST TABLE RULES (FROM schemaName)?
-    ;
-
-showReadwriteSplittingRules
-    : SHOW READWRITE_SPLITTING RULES (FROM schemaName)?
-    ;
-
-showDatabaseDiscoveryRules
-    : SHOW DB_DISCOVERY RULES (FROM schemaName)?
-    ;
-
-showEncryptRules
-    : SHOW ENCRYPT (TABLE tableRule | RULES) (FROM schemaName)?
-    ;
-
-tableRule
-    : RULE tableName
-    ;
-
-schemaName
-    : IDENTIFIER
-    ;
-
-tableName
-    : IDENTIFIER
-    ;
+/**
+ * SQL lexer for sharding rule.
+ */
+public final class ShardingRuleLexer extends ShardingRuleStatementLexer 
implements SQLLexer {
+    
+    public ShardingRuleLexer(final CharStream input) {
+        super(input);
+    }
+}
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleParser.java
similarity index 50%
copy from 
shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
copy to 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleParser.java
index 5102803..5726dac 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleParser.java
@@ -15,46 +15,25 @@
  * limitations under the License.
  */
 
-grammar RQLStatement;
+package org.apache.shardingsphere.sharding.distsql.parser;
 
-import Keyword, Literals, Symbol;
+import org.antlr.v4.runtime.TokenStream;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser;
+import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
+import org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
+import org.apache.shardingsphere.sql.parser.core.ParseASTNode;
 
-showResources
-    : SHOW RESOURCES (FROM schemaName)?
-    ;
-
-showShardingTableRules
-    : SHOW SHARDING TABLE (tableRule | RULES) (FROM schemaName)?
-    ;
-
-showShardingBindingTableRules
-    : SHOW SHARDING BINDING TABLE RULES (FROM schemaName)?
-    ;
-
-showShardingBroadcastTableRules
-    : SHOW SHARDING BROADCAST TABLE RULES (FROM schemaName)?
-    ;
-
-showReadwriteSplittingRules
-    : SHOW READWRITE_SPLITTING RULES (FROM schemaName)?
-    ;
-
-showDatabaseDiscoveryRules
-    : SHOW DB_DISCOVERY RULES (FROM schemaName)?
-    ;
-
-showEncryptRules
-    : SHOW ENCRYPT (TABLE tableRule | RULES) (FROM schemaName)?
-    ;
-
-tableRule
-    : RULE tableName
-    ;
-
-schemaName
-    : IDENTIFIER
-    ;
-
-tableName
-    : IDENTIFIER
-    ;
+/**
+ * SQL parser for sharding rule.
+ */
+public final class ShardingRuleParser extends ShardingRuleStatementParser 
implements SQLParser {
+    
+    public ShardingRuleParser(final TokenStream input) {
+        super(input);
+    }
+    
+    @Override
+    public ASTNode parse() {
+        return new ParseASTNode(execute());
+    }
+}
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleParserFacade.java
similarity index 50%
copy from 
shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
copy to 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleParserFacade.java
index 5102803..6eab658 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleParserFacade.java
@@ -15,46 +15,29 @@
  * limitations under the License.
  */
 
-grammar RQLStatement;
+package org.apache.shardingsphere.sharding.distsql.parser;
 
-import Keyword, Literals, Symbol;
+import org.apache.shardingsphere.distsql.parser.spi.RuleSQLParserFacade;
+import org.apache.shardingsphere.sql.parser.api.parser.SQLLexer;
+import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
 
-showResources
-    : SHOW RESOURCES (FROM schemaName)?
-    ;
-
-showShardingTableRules
-    : SHOW SHARDING TABLE (tableRule | RULES) (FROM schemaName)?
-    ;
-
-showShardingBindingTableRules
-    : SHOW SHARDING BINDING TABLE RULES (FROM schemaName)?
-    ;
-
-showShardingBroadcastTableRules
-    : SHOW SHARDING BROADCAST TABLE RULES (FROM schemaName)?
-    ;
-
-showReadwriteSplittingRules
-    : SHOW READWRITE_SPLITTING RULES (FROM schemaName)?
-    ;
-
-showDatabaseDiscoveryRules
-    : SHOW DB_DISCOVERY RULES (FROM schemaName)?
-    ;
-
-showEncryptRules
-    : SHOW ENCRYPT (TABLE tableRule | RULES) (FROM schemaName)?
-    ;
-
-tableRule
-    : RULE tableName
-    ;
-
-schemaName
-    : IDENTIFIER
-    ;
-
-tableName
-    : IDENTIFIER
-    ;
+/**
+ * SQL parser facade for sharding rule.
+ */
+public final class ShardingRuleParserFacade implements RuleSQLParserFacade {
+    
+    @Override
+    public Class<? extends SQLLexer> getLexerClass() {
+        return ShardingRuleLexer.class;
+    }
+    
+    @Override
+    public Class<? extends SQLParser> getParserClass() {
+        return ShardingRuleParser.class;
+    }
+    
+    @Override
+    public String getRuleType() {
+        return "Sharding";
+    }
+}
diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleSQLStatementVisitorFacade.java
similarity index 50%
copy from 
shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
copy to 
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleSQLStatementVisitorFacade.java
index 5102803..4089cc7 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleSQLStatementVisitorFacade.java
@@ -15,46 +15,23 @@
  * limitations under the License.
  */
 
-grammar RQLStatement;
+package org.apache.shardingsphere.sharding.distsql.parser;
 
-import Keyword, Literals, Symbol;
+import 
org.apache.shardingsphere.distsql.parser.spi.RuleSQLStatementVisitorFacade;
+import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
 
-showResources
-    : SHOW RESOURCES (FROM schemaName)?
-    ;
-
-showShardingTableRules
-    : SHOW SHARDING TABLE (tableRule | RULES) (FROM schemaName)?
-    ;
-
-showShardingBindingTableRules
-    : SHOW SHARDING BINDING TABLE RULES (FROM schemaName)?
-    ;
-
-showShardingBroadcastTableRules
-    : SHOW SHARDING BROADCAST TABLE RULES (FROM schemaName)?
-    ;
-
-showReadwriteSplittingRules
-    : SHOW READWRITE_SPLITTING RULES (FROM schemaName)?
-    ;
-
-showDatabaseDiscoveryRules
-    : SHOW DB_DISCOVERY RULES (FROM schemaName)?
-    ;
-
-showEncryptRules
-    : SHOW ENCRYPT (TABLE tableRule | RULES) (FROM schemaName)?
-    ;
-
-tableRule
-    : RULE tableName
-    ;
-
-schemaName
-    : IDENTIFIER
-    ;
-
-tableName
-    : IDENTIFIER
-    ;
+/**
+ * Sharding rule SQL statement visitor facade.
+ */
+public final class ShardingRuleSQLStatementVisitorFacade implements 
RuleSQLStatementVisitorFacade {
+    
+    @Override
+    public Class<? extends SQLVisitor> getVisitorClass() {
+        return ShardingRuleDistSQLStatementVisitor.class;
+    }
+    
+    @Override
+    public String getRuleType() {
+        return "Sharding";
+    }
+}
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.parser.spi.RuleSQLParserFacade
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.parser.spi.RuleSQLParserFacade
new file mode 100644
index 0000000..87d8dd8
--- /dev/null
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.parser.spi.RuleSQLParserFacade
@@ -0,0 +1,18 @@
+#
+# 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.sharding.distsql.parser.ShardingRuleParserFacade
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.parser.spi.RuleSQLStatementVisitorFacade
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.parser.spi.RuleSQLStatementVisitorFacade
new file mode 100644
index 0000000..ea02ff8
--- /dev/null
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.parser.spi.RuleSQLStatementVisitorFacade
@@ -0,0 +1,18 @@
+#
+# 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.sharding.distsql.parser.ShardingRuleSQLStatementVisitorFacade
diff --git 
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/test/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleStatementParserEngineTest.java
 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/test/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleStatementParserEngineTest.java
new file mode 100644
index 0000000..25bad0b
--- /dev/null
+++ 
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/test/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleStatementParserEngineTest.java
@@ -0,0 +1,216 @@
+/*
+ * 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.
+ */
+
+package org.apache.shardingsphere.sharding.distsql.parser;
+
+import 
org.apache.shardingsphere.distsql.parser.api.DistSQLStatementParserEngine;
+import org.apache.shardingsphere.distsql.parser.segment.TableRuleSegment;
+import 
org.apache.shardingsphere.distsql.parser.segment.rdl.ShardingBindingTableRuleSegment;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.impl.AlterShardingBindingTableRulesStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.impl.AlterShardingBroadcastTableRulesStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.impl.AlterShardingTableRuleStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateShardingBindingTableRulesStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateShardingBroadcastTableRulesStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateShardingTableRuleStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropShardingBindingTableRulesStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropShardingBroadcastTableRulesStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropShardingTableRuleStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.impl.ShowShardingBindingTableRulesStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.impl.ShowShardingBroadcastTableRulesStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.impl.ShowShardingTableRulesStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
+import org.junit.Test;
+
+import java.util.ArrayList;
+import java.util.Arrays;
+import java.util.List;
+import java.util.stream.Collectors;
+
+import static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+// TODO use Parameterized + XML instead of static test
+public final class ShardingRuleStatementParserEngineTest {
+    
+    private static final String RDL_CREATE_SHARDING_TABLE_RULE = "CREATE 
SHARDING TABLE RULE t_order (" 
+            + "RESOURCES(ms_group_0,ms_group_1)," 
+            + "SHARDING_COLUMN=order_id," 
+            + "TYPE(NAME=hash_mod,PROPERTIES('sharding-count'=4))," 
+            + 
"GENERATED_KEY(COLUMN=another_id,TYPE(NAME=snowflake,PROPERTIES(\"worker-id\"=123))))";
+    
+    private static final String RDL_CREATE_SHARDING_BINDING_TABLE_RULES = 
"CREATE SHARDING BINDING TABLE RULES (" 
+            + "(t_order,t_order_item), (t_1,t_2))";
+    
+    private static final String RDL_CREATE_SHARDING_BROADCAST_TABLE_RULES = 
"CREATE SHARDING BROADCAST TABLE RULES(t_1,t_2)";
+    
+    private static final String RDL_ALTER_SHARDING_TABLE_RULE = "ALTER 
SHARDING TABLE RULE t_order ("
+            + "RESOURCES(ms_group_0,ms_group_1),"
+            + "SHARDING_COLUMN=order_id,"
+            + "TYPE(NAME=hash_mod,PROPERTIES('sharding-count'=4)),"
+            + 
"GENERATED_KEY(COLUMN=another_id,TYPE(NAME=snowflake,PROPERTIES(\"worker-id\"=123))))";
+    
+    private static final String RDL_ALTER_SHARDING_BINDING_TABLE_RULES = 
"ALTER SHARDING BINDING TABLE RULES ("
+            + "(t_order,t_order_item), (t_1,t_2))";
+    
+    private static final String RDL_ALTER_SHARDING_BROADCAST_TABLE_RULES = 
"ALTER SHARDING BROADCAST TABLE RULES(t_1,t_2)";
+    
+    private static final String RDL_DROP_SHARDING_TABLE_RULE = "DROP SHARDING 
TABLE RULE t_order,t_order_item";
+    
+    private static final String RDL_DROP_SHARDING_BINDING_TABLE_RULES = "DROP 
SHARDING BINDING TABLE RULES";
+    
+    private static final String RDL_DROP_SHARDING_BROADCAST_TABLE_RULES = 
"DROP SHARDING BROADCAST TABLE RULES";
+    
+    private static final String RQL_SHOW_SHARDING_BINDING_TABLE_RULES = "SHOW 
SHARDING BINDING TABLE RULES FROM sharding_db";
+    
+    private static final String RQL_SHOW_SHARDING_BROADCAST_TABLE_RULES = 
"SHOW SHARDING BROADCAST TABLE RULES FROM sharding_db";
+    
+    private static final String RQL_SHOW_SHARDING_TABLE_RULES = "SHOW SHARDING 
TABLE RULES FROM schemaName";
+    
+    private static final String RQL_SHOW_SHARDING_TABLE_RULE = "SHOW SHARDING 
TABLE RULE t_order";
+    
+    private static final String RQL_SHOW_SHARDING_TABLE_RULE_FROM = "SHOW 
SHARDING TABLE RULE t_order FROM schemaName";
+    
+    private final DistSQLStatementParserEngine engine = new 
DistSQLStatementParserEngine();
+    
+    @Test
+    public void assertParseCreateShardingTableRule() {
+        SQLStatement sqlStatement = 
engine.parse(RDL_CREATE_SHARDING_TABLE_RULE);
+        assertTrue(sqlStatement instanceof CreateShardingTableRuleStatement);
+        assertThat(((CreateShardingTableRuleStatement) 
sqlStatement).getRules().size(), is(1));
+        TableRuleSegment tableRuleSegment = 
((CreateShardingTableRuleStatement) sqlStatement).getRules().iterator().next();
+        assertThat(tableRuleSegment.getLogicTable(), is("t_order"));
+        
assertTrue(tableRuleSegment.getDataSources().containsAll(Arrays.asList("ms_group_0",
 "ms_group_1")));
+        assertThat(tableRuleSegment.getTableStrategyColumn(), is("order_id"));
+        
assertThat(tableRuleSegment.getKeyGenerateStrategy().getAlgorithmName(), 
is("snowflake"));
+        
assertThat(tableRuleSegment.getKeyGenerateStrategy().getAlgorithmProps().getProperty("worker-id"),
 is("123"));
+        assertThat(tableRuleSegment.getKeyGenerateStrategyColumn(), 
is("another_id"));
+        assertThat(tableRuleSegment.getTableStrategy().getAlgorithmName(), 
is("hash_mod"));
+        
assertThat(tableRuleSegment.getTableStrategy().getAlgorithmProps().getProperty("sharding-count"),
 is("4"));
+    }
+    
+    @Test
+    public void assertParseCreateShardingBindingTableRules() {
+        SQLStatement sqlStatement = 
engine.parse(RDL_CREATE_SHARDING_BINDING_TABLE_RULES);
+        assertTrue(sqlStatement instanceof 
CreateShardingBindingTableRulesStatement);
+        List<ShardingBindingTableRuleSegment> shardingBindingTableRuleSegments 
= new ArrayList<>(((CreateShardingBindingTableRulesStatement) 
sqlStatement).getRules());
+        assertThat(shardingBindingTableRuleSegments.size(), is(2));
+        ShardingBindingTableRuleSegment segment = 
shardingBindingTableRuleSegments.get(0);
+        assertThat(segment.getTables(), is("t_order,t_order_item"));
+        segment = shardingBindingTableRuleSegments.get(1);
+        assertThat(segment.getTables(), is("t_1,t_2"));
+    }
+    
+    @Test
+    public void assertParseCreateShardingBroadcastTableRules() {
+        SQLStatement sqlStatement = 
engine.parse(RDL_CREATE_SHARDING_BROADCAST_TABLE_RULES);
+        System.out.println(sqlStatement);
+        assertTrue(sqlStatement instanceof 
CreateShardingBroadcastTableRulesStatement);
+        assertThat(((CreateShardingBroadcastTableRulesStatement) 
sqlStatement).getTables(), is(Arrays.asList("t_1", "t_2")));
+    }
+    
+    @Test
+    public void assertParseAlterShardingTableRule() {
+        SQLStatement sqlStatement = 
engine.parse(RDL_ALTER_SHARDING_TABLE_RULE);
+        assertTrue(sqlStatement instanceof AlterShardingTableRuleStatement);
+        assertThat(((AlterShardingTableRuleStatement) 
sqlStatement).getRules().size(), is(1));
+        TableRuleSegment tableRuleSegment = ((AlterShardingTableRuleStatement) 
sqlStatement).getRules().iterator().next();
+        assertThat(tableRuleSegment.getLogicTable(), is("t_order"));
+        
assertTrue(tableRuleSegment.getDataSources().containsAll(Arrays.asList("ms_group_0",
 "ms_group_1")));
+        assertThat(tableRuleSegment.getTableStrategyColumn(), is("order_id"));
+        
assertThat(tableRuleSegment.getKeyGenerateStrategy().getAlgorithmName(), 
is("snowflake"));
+        
assertThat(tableRuleSegment.getKeyGenerateStrategy().getAlgorithmProps().getProperty("worker-id"),
 is("123"));
+        assertThat(tableRuleSegment.getKeyGenerateStrategyColumn(), 
is("another_id"));
+        assertThat(tableRuleSegment.getTableStrategy().getAlgorithmName(), 
is("hash_mod"));
+        
assertThat(tableRuleSegment.getTableStrategy().getAlgorithmProps().getProperty("sharding-count"),
 is("4"));
+    }
+    
+    @Test
+    public void assertParseAlterShardingBindingTableRules() {
+        SQLStatement sqlStatement = 
engine.parse(RDL_ALTER_SHARDING_BINDING_TABLE_RULES);
+        assertTrue(sqlStatement instanceof 
AlterShardingBindingTableRulesStatement);
+        List<ShardingBindingTableRuleSegment> shardingBindingTableRuleSegments 
= new ArrayList<>(((AlterShardingBindingTableRulesStatement) 
sqlStatement).getRules());
+        assertThat(shardingBindingTableRuleSegments.size(), is(2));
+        ShardingBindingTableRuleSegment segment = 
shardingBindingTableRuleSegments.get(0);
+        assertThat(segment.getTables(), is("t_order,t_order_item"));
+        segment = shardingBindingTableRuleSegments.get(1);
+        assertThat(segment.getTables(), is("t_1,t_2"));
+    }
+
+    @Test
+    public void assertParseAlterShardingBroadcastTableRules() {
+        SQLStatement sqlStatement = 
engine.parse(RDL_ALTER_SHARDING_BROADCAST_TABLE_RULES);
+        assertTrue(sqlStatement instanceof 
AlterShardingBroadcastTableRulesStatement);
+        assertThat(((AlterShardingBroadcastTableRulesStatement) 
sqlStatement).getTables(), is(Arrays.asList("t_1", "t_2")));
+    }
+    
+    @Test
+    public void assertParseDropShardingTableRule() {
+        SQLStatement sqlStatement = engine.parse(RDL_DROP_SHARDING_TABLE_RULE);
+        assertTrue(sqlStatement instanceof DropShardingTableRuleStatement);
+        assertThat(((DropShardingTableRuleStatement) 
sqlStatement).getTableNames().stream().map(each -> 
each.getIdentifier().getValue()).collect(Collectors.toList()),
+                is(Arrays.asList("t_order", "t_order_item")));
+    }
+    
+    @Test
+    public void assertParseDropShardingBindingTableRules() {
+        SQLStatement sqlStatement = 
engine.parse(RDL_DROP_SHARDING_BINDING_TABLE_RULES);
+        assertTrue(sqlStatement instanceof 
DropShardingBindingTableRulesStatement);
+    }
+    
+    @Test
+    public void assertParseDropShardingBroadcastTableRules() {
+        SQLStatement sqlStatement = 
engine.parse(RDL_DROP_SHARDING_BROADCAST_TABLE_RULES);
+        assertTrue(sqlStatement instanceof 
DropShardingBroadcastTableRulesStatement);
+    }
+    
+    @Test
+    public void assertParseShowShardingTableRules() {
+        SQLStatement sqlStatement = 
engine.parse(RQL_SHOW_SHARDING_TABLE_RULES);
+        assertTrue(sqlStatement instanceof ShowShardingTableRulesStatement);
+        assertThat(((ShowShardingTableRulesStatement) 
sqlStatement).getSchema().get().getIdentifier().getValue(), is("schemaName"));
+    }
+    
+    @Test
+    public void assertParseShowShardingTableRule() {
+        SQLStatement sqlStatement = engine.parse(RQL_SHOW_SHARDING_TABLE_RULE);
+        assertTrue(sqlStatement instanceof ShowShardingTableRulesStatement);
+        assertThat(((ShowShardingTableRulesStatement) 
sqlStatement).getTableName(), is("t_order"));
+    }
+    
+    @Test
+    public void assertParseShowShardingTableRuleFrom() {
+        SQLStatement sqlStatement = 
engine.parse(RQL_SHOW_SHARDING_TABLE_RULE_FROM);
+        assertTrue(sqlStatement instanceof ShowShardingTableRulesStatement);
+        assertThat(((ShowShardingTableRulesStatement) 
sqlStatement).getTableName(), is("t_order"));
+        assertThat(((ShowShardingTableRulesStatement) 
sqlStatement).getSchema().get().getIdentifier().getValue(), is("schemaName"));
+    }
+    
+    @Test
+    public void assertParseShowShardingBindingTableRules() {
+        SQLStatement sqlStatement = 
engine.parse(RQL_SHOW_SHARDING_BINDING_TABLE_RULES);
+        assertTrue(sqlStatement instanceof 
ShowShardingBindingTableRulesStatement);
+        assertThat(((ShowShardingBindingTableRulesStatement) 
sqlStatement).getSchema().get().getIdentifier().getValue(), is("sharding_db"));
+    }
+    
+    @Test
+    public void assertParseShowShardingBroadcastTableRules() {
+        SQLStatement sqlStatement = 
engine.parse(RQL_SHOW_SHARDING_BROADCAST_TABLE_RULES);
+        assertTrue(sqlStatement instanceof 
ShowShardingBroadcastTableRulesStatement);
+        assertThat(((ShowShardingBroadcastTableRulesStatement) 
sqlStatement).getSchema().get().getIdentifier().getValue(), is("sharding_db"));
+    }
+}

Reply via email to