You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2021/06/15 01:44:22 UTC

[shardingsphere] branch master updated: Split readwrite-splitting ANTLR g4 file and visitor (#10809)

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

duanzhengqiang 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 c7c0507  Split readwrite-splitting ANTLR g4 file and visitor (#10809)
c7c0507 is described below

commit c7c05070675c9a5cc85987dc3f93a7d46aa58855
Author: Liang Zhang <te...@163.com>
AuthorDate: Tue Jun 15 09:43:40 2021 +0800

    Split readwrite-splitting ANTLR g4 file and visitor (#10809)
    
    * Split g4 files
    
    * Split readwrite-splitting ANTLR g4 file and visitor
    
    * Split readwrite-splitting ANTLR g4 file and visitor
    
    * Fix readwrite-splitting RQL NPE
    
    * Remove useless method
---
 .../mysql/constant/MySQLServerErrorCode.java       |   2 +-
 .../src/main/antlr4/imports/Keyword.g4             |  44 +------
 .../src/main/antlr4/imports/RDLStatement.g4        |  28 -----
 .../src/main/antlr4/imports/RQLStatement.g4        |   4 -
 .../distsql/parser/autogen/DistSQLStatement.g4     |   4 -
 .../parser/api/DistSQLStatementParserEngine.java   |   3 +-
 .../resource/ResourceDistSQLStatementVisitor.java  |  63 ----------
 .../resource/ResourceSQLStatementParserEngine.java |   7 +-
 .../core/rule/RuleSQLStatementParserEngine.java    |   2 +-
 .../api/DistSQLStatementParserEngineTest.java      |  97 ---------------
 .../shardingsphere-readwrite-splitting/pom.xml     |   1 +
 .../pom.xml                                        |   5 +
 .../rule/ReadwriteSplittingRule.java               |   9 --
 .../pom.xml                                        |  14 +--
 .../imports/readwrite-splitting/Alphabet.g4}       |  47 +++++---
 .../antlr4/imports/readwrite-splitting/Keyword.g4  |  64 +++++++---
 .../antlr4/imports/readwrite-splitting/Literals.g4 |  39 +++---
 .../imports/readwrite-splitting}/RDLStatement.g4   |  96 ---------------
 .../imports/readwrite-splitting}/RQLStatement.g4   |  20 ----
 .../antlr4/imports/readwrite-splitting/Symbol.g4   |  61 ++++++++++
 .../autogen/ReadwriteSplittingRuleStatement.g4}    |  22 ++--
 ...dwriteSplittingRuleDistSQLStatementVisitor.java | 121 +++++++++++++++++++
 .../parser/core/ReadwriteSplittingRuleLexer.java}  |  10 +-
 .../parser/core/ReadwriteSplittingRuleParser.java} |  10 +-
 .../ReadwriteSplittingRuleParserFacade.java}       |  14 ++-
 ...iteSplittingRuleSQLStatementVisitorFacade.java} |  11 +-
 ...ngsphere.distsql.parser.spi.RuleSQLParserFacade |   2 +-
 ...istsql.parser.spi.RuleSQLStatementVisitorFacade |   2 +-
 ...riteSplittingRuleStatementParserEngineTest.java | 133 +++++++++++++++++++++
 .../shardingsphere-sharding-distsql/pom.xml        |  10 +-
 .../ShardingRuleDistSQLStatementVisitor.java       |   2 +-
 .../parser/{ => core}/ShardingRuleLexer.java       |   2 +-
 .../parser/{ => core}/ShardingRuleParser.java      |   2 +-
 .../{ => facade}/ShardingRuleParserFacade.java     |   4 +-
 .../ShardingRuleSQLStatementVisitorFacade.java     |   5 +-
 ...ngsphere.distsql.parser.spi.RuleSQLParserFacade |   2 +-
 ...istsql.parser.spi.RuleSQLStatementVisitorFacade |   2 +-
 .../ShardingRuleStatementParserEngineTest.java     |   2 +-
 ...ReadwriteSplittingRulesQueryBackendHandler.java |   2 +-
 .../mysql/err/MySQLErrPacketFactoryTest.java       |   2 +-
 .../sql/parser/core/SQLParserFactory.java          |   6 +-
 .../core/database/parser/SQLParserExecutor.java    |  10 +-
 42 files changed, 496 insertions(+), 490 deletions(-)

diff --git a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLServerErrorCode.java b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLServerErrorCode.java
index f6c3a71..f45ef00 100644
--- a/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLServerErrorCode.java
+++ b/shardingsphere-db-protocol/shardingsphere-db-protocol-mysql/src/main/java/org/apache/shardingsphere/db/protocol/mysql/constant/MySQLServerErrorCode.java
@@ -50,7 +50,7 @@ public enum MySQLServerErrorCode implements SQLErrorCode {
     
     ER_NO_SUCH_TABLE(1146, "42S02", "Table '%s' doesn't exist"),
     
-    ER_NOT_SUPPORTED_YET(1235, "42000", "This version of ShardingProxy doesn't yet support this SQL. '%s'"),
+    ER_NOT_SUPPORTED_YET(1235, "42000", "This version of ShardingSphere-Proxy doesn't yet support this SQL. '%s'"),
     
     ER_SP_DOES_NOT_EXIST(1305, "42000", "Message: Datasource or ShardingSphere rule does not exist"),
     
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 26e136d..e36cc59 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
@@ -35,10 +35,6 @@ ALTER
     : A L T E R
     ;
 
-MODIFY
-    : M O D I F Y
-    ;
-
 DROP
     : D R O P
     ;
@@ -99,10 +95,6 @@ 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
     ;
@@ -111,22 +103,6 @@ SHADOW
     : S H A D O W
     ;
 
-PRIMARY
-    : P R I M A R Y
-    ;
-
-REPLICA
-    : R E P L I C A
-    ;
-
-GENERATED_KEY
-    : G E N E R A T E D UL_ K E Y
-    ;
-
-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
     ;
@@ -146,19 +122,19 @@ STATUS
 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
     ;
@@ -167,10 +143,6 @@ TABLE
     : T A B L E
     ;
 
-SHARDING_COLUMN
-    : S H A R D I N G UL_ C O L U M N
-    ;
-    
 TYPE
     : T Y P E
     ;
@@ -187,18 +159,10 @@ COLUMN
     : C O L U M N
     ;
 
-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
     ;
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 6d78bf3..a6e48a2 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,10 @@ password
     : IDENTIFIER | INT | STRING
     ;
 
-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
-    ;
-
-dynamicReadwriteSplittingRuleDefinition
-    : AUTO_AWARE_RESOURCE EQ IDENTIFIER
-    ;
-
-alterReadwriteSplittingRule
-    : ALTER READWRITE_SPLITTING RULE readwriteSplittingRuleDefinition (COMMA readwriteSplittingRuleDefinition)*
-    ;
-
 resources
     : RESOURCES LP IDENTIFIER (COMMA IDENTIFIER)* RP
     ;
 
-writeResourceName
-    : resourceName
-    ;
-
 resourceName
     : IDENTIFIER
     ;
@@ -103,10 +79,6 @@ columnName
     : IDENTIFIER
     ;
 
-dropReadwriteSplittingRule
-    : DROP READWRITE_SPLITTING RULE IDENTIFIER (COMMA 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 29087f4..ae555b4 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,10 +23,6 @@ showResources
     : SHOW RESOURCES (FROM schemaName)?
     ;
 
-showReadwriteSplittingRules
-    : SHOW READWRITE_SPLITTING RULES (FROM schemaName)?
-    ;
-
 showDatabaseDiscoveryRules
     : SHOW DB_DISCOVERY 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 1f17379..c857a31 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,9 +22,6 @@ import Symbol, RDLStatement, RQLStatement, RALStatement;
 execute
     : (addResource
     | dropResource
-    | createReadwriteSplittingRule
-    | alterReadwriteSplittingRule
-    | dropReadwriteSplittingRule
     | createDatabaseDiscoveryRule
     | alterDatabaseDiscoveryRule
     | dropDatabaseDiscoveryRule
@@ -32,7 +29,6 @@ execute
     | alterEncryptRule
     | dropEncryptRule
     | showResources
-    | showReadwriteSplittingRules
     | showDatabaseDiscoveryRules
     | showEncryptRules
     | showScalingJobList
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 82453e3..22e41bb 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
@@ -20,6 +20,7 @@ package org.apache.shardingsphere.distsql.parser.api;
 import org.antlr.v4.runtime.misc.ParseCancellationException;
 import org.apache.shardingsphere.distsql.parser.core.resource.ResourceSQLStatementParserEngine;
 import org.apache.shardingsphere.distsql.parser.core.rule.RuleSQLStatementParserEngine;
+import org.apache.shardingsphere.sql.parser.exception.SQLParsingException;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
 
 /**
@@ -36,7 +37,7 @@ public final class DistSQLStatementParserEngine {
     public SQLStatement parse(final String sql) {
         try {
             return new ResourceSQLStatementParserEngine().parse(sql);
-        } catch (final ParseCancellationException ignored) {
+        } catch (final ParseCancellationException | SQLParsingException ignored) {
             return new RuleSQLStatementParserEngine().parse(sql);
         }
     }
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 ab166b9..28d6498 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 org.antlr.v4.runtime.RuleContext;
 import org.antlr.v4.runtime.tree.ParseTree;
 import org.antlr.v4.runtime.tree.TerminalNode;
 import org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementBaseVisitor;
@@ -26,33 +25,26 @@ import org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.A
 import org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.AlgorithmPropertyContext;
 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.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.DataSourceContext;
 import org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.DatabaseDiscoveryRuleDefinitionContext;
 import org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.DropDatabaseDiscoveryRuleContext;
 import org.apache.shardingsphere.distsql.parser.autogen.DistSQLStatementParser.DropEncryptRuleContext;
-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.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.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.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;
@@ -60,7 +52,6 @@ import org.apache.shardingsphere.distsql.parser.segment.FunctionSegment;
 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.statement.ral.impl.CheckScalingJobStatement;
 import org.apache.shardingsphere.distsql.parser.statement.ral.impl.DropScalingJobStatement;
 import org.apache.shardingsphere.distsql.parser.statement.ral.impl.ResetScalingJobStatement;
@@ -70,19 +61,15 @@ import org.apache.shardingsphere.distsql.parser.statement.ral.impl.StartScalingJ
 import org.apache.shardingsphere.distsql.parser.statement.ral.impl.StopScalingJobStatement;
 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.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.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.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.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;
@@ -121,46 +108,6 @@ public final class ResourceDistSQLStatementVisitor extends DistSQLStatementBaseV
     }
     
     @Override
-    public ASTNode visitCreateReadwriteSplittingRule(final CreateReadwriteSplittingRuleContext ctx) {
-        return new CreateReadwriteSplittingRuleStatement(ctx.readwriteSplittingRuleDefinition().stream().map(each -> (ReadwriteSplittingRuleSegment) visit(each)).collect(Collectors.toList()));
-    }
-    
-    @Override
-    public ASTNode visitReadwriteSplittingRuleDefinition(final ReadwriteSplittingRuleDefinitionContext ctx) {
-        ReadwriteSplittingRuleSegment result = (ReadwriteSplittingRuleSegment) (null != ctx.dynamicReadwriteSplittingRuleDefinition()
-                        ? visit(ctx.dynamicReadwriteSplittingRuleDefinition()) : visit(ctx.staticReadwriteSplittingRuleDefinition()));
-        Properties props = new Properties();
-        if (null != ctx.functionDefinition().algorithmProperties()) {
-            ctx.functionDefinition().algorithmProperties().algorithmProperty()
-                    .forEach(each -> props.setProperty(each.key.getText(), each.value.getText()));
-        }
-        result.setName(ctx.ruleName().getText());
-        result.setLoadBalancer(ctx.functionDefinition().functionName().getText());
-        result.setProps(props);
-        return result;
-    }
-    
-    @Override
-    public ASTNode visitStaticReadwriteSplittingRuleDefinition(final StaticReadwriteSplittingRuleDefinitionContext ctx) {
-        ReadwriteSplittingRuleSegment result = new ReadwriteSplittingRuleSegment();
-        result.setWriteDataSource(ctx.writeResourceName().getText());
-        result.setReadDataSources(ctx.resourceName().stream().map(RuleContext::getText).collect(Collectors.toList()));
-        return result;
-    }
-    
-    @Override
-    public ASTNode visitDynamicReadwriteSplittingRuleDefinition(final DynamicReadwriteSplittingRuleDefinitionContext ctx) {
-        ReadwriteSplittingRuleSegment result = new ReadwriteSplittingRuleSegment();
-        result.setAutoAwareResource(ctx.IDENTIFIER().getText());
-        return result;
-    }
-    
-    @Override
-    public ASTNode visitAlterReadwriteSplittingRule(final AlterReadwriteSplittingRuleContext ctx) {
-        return new AlterReadwriteSplittingRuleStatement(ctx.readwriteSplittingRuleDefinition().stream().map(each -> (ReadwriteSplittingRuleSegment) visit(each)).collect(Collectors.toList()));
-    }
-    
-    @Override
     public ASTNode visitFunctionDefinition(final FunctionDefinitionContext ctx) {
         FunctionSegment result = new FunctionSegment();
         result.setAlgorithmName(ctx.functionName().getText());
@@ -237,11 +184,6 @@ public final class ResourceDistSQLStatementVisitor extends DistSQLStatementBaseV
     }
     
     @Override
-    public ASTNode visitDropReadwriteSplittingRule(final DropReadwriteSplittingRuleContext ctx) {
-        return new DropReadwriteSplittingRuleStatement(ctx.IDENTIFIER().stream().map(TerminalNode::getText).collect(Collectors.toList()));
-    }
-    
-    @Override
     public ASTNode visitShowResources(final ShowResourcesContext ctx) {
         return new ShowResourcesStatement(null == ctx.schemaName() ? null : (SchemaSegment) visit(ctx.schemaName()));
     }
@@ -277,11 +219,6 @@ public final class ResourceDistSQLStatementVisitor extends DistSQLStatementBaseV
     }
     
     @Override
-    public ASTNode visitShowReadwriteSplittingRules(final ShowReadwriteSplittingRulesContext ctx) {
-        return new ShowReadwriteSplittingRulesStatement(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 ccb08b2..3e72d56 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,10 +17,7 @@
 
 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;
@@ -39,9 +36,7 @@ public final class ResourceSQLStatementParserEngine {
      * @return SQL statement
      */
     public SQLStatement parse(final String sql) {
-        SQLParser sqlParser = SQLParserFactory.newInstance(sql, ResourceDistSQLLexer.class, ResourceDistSQLParser.class);
-        ((Parser) sqlParser).setErrorHandler(new BailErrorStrategy());
-        ASTNode astNode = sqlParser.parse();
+        ASTNode astNode = SQLParserFactory.newInstance(sql, ResourceDistSQLLexer.class, ResourceDistSQLParser.class).parse();
         return getSQLStatement(sql, (ParseASTNode) astNode);
     }
     
diff --git a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/rule/RuleSQLStatementParserEngine.java b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/rule/RuleSQLStatementParserEngine.java
index eb763ce..82dfeeb 100644
--- a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/rule/RuleSQLStatementParserEngine.java
+++ b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/java/org/apache/shardingsphere/distsql/parser/core/rule/RuleSQLStatementParserEngine.java
@@ -69,7 +69,7 @@ public final class RuleSQLStatementParserEngine {
             try {
                 ParseASTNode parseASTNode = (ParseASTNode) SQLParserFactory.newInstance(sql, each.getLexerClass(), each.getParserClass()).parse();
                 return new RuleParseASTNode(each.getRuleType(), parseASTNode);
-            } catch (final ParseCancellationException ignored) {
+            } catch (final ParseCancellationException | SQLParsingException ignored) {
             }
         }
         throw new SQLParsingException("You have an error in your SQL syntax.");
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 76b1595..4f81a90 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
@@ -21,21 +21,16 @@ import org.apache.shardingsphere.distsql.parser.segment.DataSourceSegment;
 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.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.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.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.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.sql.parser.sql.common.statement.SQLStatement;
 import org.junit.Test;
 
@@ -60,28 +55,6 @@ public final class DistSQLStatementParserEngineTest {
     
     private static final String RDL_DROP_RESOURCE = "DROP RESOURCE ds_0,ds_1";
     
-    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),"
-            + "TYPE(NAME=random)"
-            + ")";
-    
-    private static final String RDL_CREATE_DYNAMIC_READWRITE_SPLITTING_RULE = "CREATE READWRITE_SPLITTING RULE ms_group_1 ("
-            + "AUTO_AWARE_RESOURCE=group_0,"
-            + "TYPE(NAME=random,PROPERTIES(read_weight='2:1'))"
-            + ")";
-    
-    private static final String RDL_ALTER_READWRITE_SPLITTING_RULE = "ALTER READWRITE_SPLITTING RULE ms_group_0 ("
-            + "AUTO_AWARE_RESOURCE=group_0,"
-            + "TYPE(NAME=random,PROPERTIES(read_weight='2:1'))),"
-            + "ms_group_1 ("
-            + "WRITE_RESOURCE=primary_ds,"
-            + "READ_RESOURCES(replica_ds_0,replica_ds_1),"
-            + "TYPE(NAME=random)"
-            + ")";
-    
-    private static final String RDL_DROP_READWRITE_SPLITTING_RULE = "DROP READWRITE_SPLITTING RULE ms_group_0,ms_group_1";
-    
     private static final String RDL_CREATE_DATABASE_DISCOVERY_RULE = "CREATE DB_DISCOVERY RULE ha_group_0 ("
             + "RESOURCES(resource0,resource1),"
             + "TYPE(NAME=mgr,PROPERTIES(groupName='92504d5b-6dec',keepAliveCron=''))),"
@@ -114,8 +87,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_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";
     
     private static final String RQL_SHOW_ENCRYPT_RULES = "SHOW ENCRYPT RULES FROM encrypt_db";
@@ -182,67 +153,6 @@ public final class DistSQLStatementParserEngineTest {
     }
     
     @Test
-    public void assertParseStaticReadwriteSplittingRule() {
-        SQLStatement sqlStatement = engine.parse(RDL_CREATE_STATIC_READWRITE_SPLITTING_RULE);
-        assertTrue(sqlStatement instanceof CreateReadwriteSplittingRuleStatement);
-        CreateReadwriteSplittingRuleStatement statement = (CreateReadwriteSplittingRuleStatement) sqlStatement;
-        assertThat(statement.getRules().size(), is(1));
-        List<ReadwriteSplittingRuleSegment> readwriteSplittingRuleSegments
-                = new ArrayList<>(((CreateReadwriteSplittingRuleStatement) sqlStatement).getRules());
-        assertThat(readwriteSplittingRuleSegments.get(0).getName(), is("ms_group_0"));
-        assertThat(readwriteSplittingRuleSegments.get(0).getWriteDataSource(), is("primary_ds"));
-        assertThat(readwriteSplittingRuleSegments.get(0).getReadDataSources(), is(Arrays.asList("replica_ds_0", "replica_ds_1")));
-        assertThat(readwriteSplittingRuleSegments.get(0).getLoadBalancer(), is("random"));
-        assertThat(readwriteSplittingRuleSegments.get(0).getProps().size(), is(0));
-    }
-    
-    @Test
-    public void assertParseDynamicReadwriteSplittingRule() {
-        SQLStatement sqlStatement = engine.parse(RDL_CREATE_DYNAMIC_READWRITE_SPLITTING_RULE);
-        assertTrue(sqlStatement instanceof CreateReadwriteSplittingRuleStatement);
-        CreateReadwriteSplittingRuleStatement statement = (CreateReadwriteSplittingRuleStatement) sqlStatement;
-        assertThat(statement.getRules().size(), is(1));
-        List<ReadwriteSplittingRuleSegment> readwriteSplittingRuleSegments
-                = new ArrayList<>(((CreateReadwriteSplittingRuleStatement) sqlStatement).getRules());
-        assertThat(readwriteSplittingRuleSegments.get(0).getName(), is("ms_group_1"));
-        assertThat(readwriteSplittingRuleSegments.get(0).getAutoAwareResource(), is("group_0"));
-        assertNull(readwriteSplittingRuleSegments.get(0).getWriteDataSource());
-        assertNull(readwriteSplittingRuleSegments.get(0).getReadDataSources());
-        assertThat(readwriteSplittingRuleSegments.get(0).getLoadBalancer(), is("random"));
-        assertThat(readwriteSplittingRuleSegments.get(0).getProps().size(), is(1));
-        assertThat(readwriteSplittingRuleSegments.get(0).getProps().getProperty("read_weight"), is("'2:1'"));
-    }
-    
-    @Test
-    public void assertParseAlterReadwriteSplittingRule() {
-        SQLStatement sqlStatement = engine.parse(RDL_ALTER_READWRITE_SPLITTING_RULE);
-        assertTrue(sqlStatement instanceof AlterReadwriteSplittingRuleStatement);
-        AlterReadwriteSplittingRuleStatement statement = (AlterReadwriteSplittingRuleStatement) sqlStatement;
-        assertThat(statement.getRules().size(), is(2));
-        List<ReadwriteSplittingRuleSegment> readwriteSplittingRuleSegments
-                = new ArrayList<>(((AlterReadwriteSplittingRuleStatement) sqlStatement).getRules());
-        assertThat(readwriteSplittingRuleSegments.get(0).getName(), is("ms_group_0"));
-        assertThat(readwriteSplittingRuleSegments.get(0).getAutoAwareResource(), is("group_0"));
-        assertNull(readwriteSplittingRuleSegments.get(0).getWriteDataSource());
-        assertNull(readwriteSplittingRuleSegments.get(0).getReadDataSources());
-        assertThat(readwriteSplittingRuleSegments.get(0).getLoadBalancer(), is("random"));
-        assertThat(readwriteSplittingRuleSegments.get(0).getProps().size(), is(1));
-        assertThat(readwriteSplittingRuleSegments.get(0).getProps().getProperty("read_weight"), is("'2:1'"));
-        assertThat(readwriteSplittingRuleSegments.get(1).getName(), is("ms_group_1"));
-        assertThat(readwriteSplittingRuleSegments.get(1).getWriteDataSource(), is("primary_ds"));
-        assertThat(readwriteSplittingRuleSegments.get(1).getReadDataSources(), is(Arrays.asList("replica_ds_0", "replica_ds_1")));
-        assertThat(readwriteSplittingRuleSegments.get(1).getLoadBalancer(), is("random"));
-        assertThat(readwriteSplittingRuleSegments.get(1).getProps().size(), is(0));
-    }
-    
-    @Test
-    public void assertParseDropReadwriteSplittingRule() {
-        SQLStatement sqlStatement = engine.parse(RDL_DROP_READWRITE_SPLITTING_RULE);
-        assertTrue(sqlStatement instanceof DropReadwriteSplittingRuleStatement);
-        assertThat(((DropReadwriteSplittingRuleStatement) sqlStatement).getRuleNames(), is(Arrays.asList("ms_group_0", "ms_group_1")));
-    }
-    
-    @Test
     public void assertParseCreateDatabaseDiscoveryRule() {
         SQLStatement sqlStatement = engine.parse(RDL_CREATE_DATABASE_DISCOVERY_RULE);
         assertTrue(sqlStatement instanceof CreateDatabaseDiscoveryRuleStatement);
@@ -332,13 +242,6 @@ public final class DistSQLStatementParserEngineTest {
     }
     
     @Test
-    public void assertParseShowReadwriteSplittingRules() {
-        SQLStatement sqlStatement = engine.parse(RQL_SHOW_READWRITE_SPLITTING_RULES);
-        assertTrue(sqlStatement instanceof ShowReadwriteSplittingRulesStatement);
-        assertThat(((ShowReadwriteSplittingRulesStatement) sqlStatement).getSchema().get().getIdentifier().getValue(), is("readwrite_splitting_db"));
-    }
-    
-    @Test
     public void assertParseShowDatabaseDiscoveryRules() {
         SQLStatement sqlStatement = engine.parse(RQL_SHOW_DB_DISCOVERY_RULES);
         assertTrue(sqlStatement instanceof ShowDatabaseDiscoveryRulesStatement);
diff --git a/shardingsphere-features/shardingsphere-readwrite-splitting/pom.xml b/shardingsphere-features/shardingsphere-readwrite-splitting/pom.xml
index 5e98371..4b30007 100644
--- a/shardingsphere-features/shardingsphere-readwrite-splitting/pom.xml
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/pom.xml
@@ -32,6 +32,7 @@
     <modules>
         <module>shardingsphere-readwrite-splitting-api</module>
         <module>shardingsphere-readwrite-splitting-core</module>
+        <module>shardingsphere-readwrite-splitting-distsql</module>
         <module>shardingsphere-readwrite-splitting-spring</module>
     </modules>
 </project>
diff --git a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/pom.xml b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/pom.xml
index b9da455..07b47e8 100644
--- a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/pom.xml
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/pom.xml
@@ -34,6 +34,11 @@
             <artifactId>shardingsphere-readwrite-splitting-api</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-readwrite-splitting-distsql</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
diff --git a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/ReadwriteSplittingRule.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/ReadwriteSplittingRule.java
index 6a169ab..103ed06 100644
--- a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/ReadwriteSplittingRule.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-core/src/main/java/org/apache/shardingsphere/readwritesplitting/rule/ReadwriteSplittingRule.java
@@ -78,15 +78,6 @@ public final class ReadwriteSplittingRule implements FeatureRule, SchemaRule, Da
     }
     
     /**
-     * Get all logic data source names.
-     *
-     * @return all logic data source names
-     */
-    public Collection<String> getAllLogicDataSourceNames() {
-        return dataSourceRules.keySet();
-    }
-    
-    /**
      * Get single data source rule.
      *
      * @return replica query data source rule
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/pom.xml b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/pom.xml
similarity index 93%
copy from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/pom.xml
copy to shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/pom.xml
index 8161ead..8913f9b 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/pom.xml
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/pom.xml
@@ -21,11 +21,11 @@
          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>
+        <artifactId>shardingsphere-readwrite-splitting</artifactId>
         <version>5.0.0-RC1-SNAPSHOT</version>
     </parent>
-    <artifactId>shardingsphere-sharding-distsql</artifactId>
+    <artifactId>shardingsphere-readwrite-splitting-distsql</artifactId>
     <name>${project.artifactId}</name>
     
     <dependencies>
@@ -36,13 +36,13 @@
         </dependency>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-distsql-parser-statement</artifactId>
-            <version>5.0.0-RC1-SNAPSHOT</version>
+            <artifactId>shardingsphere-distsql-parser-engine</artifactId>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-distsql-parser-engine</artifactId>
-            <version>${project.version}</version>
+            <artifactId>shardingsphere-distsql-parser-statement</artifactId>
+            <version>5.0.0-RC1-SNAPSHOT</version>
         </dependency>
     </dependencies>
     
@@ -55,7 +55,7 @@
                     <execution>
                         <id>antlr</id>
                         <configuration>
-                            <libDirectory>src/main/antlr4/imports/sharding/</libDirectory>
+                            <libDirectory>src/main/antlr4/imports/readwrite-splitting/</libDirectory>
                             <listener>false</listener>
                             <visitor>true</visitor>
                         </configuration>
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleSQLStatementVisitorFacade.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/imports/readwrite-splitting/Alphabet.g4
similarity index 56%
copy from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleSQLStatementVisitorFacade.java
copy to shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/imports/readwrite-splitting/Alphabet.g4
index 4089cc7..f7603cc 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleSQLStatementVisitorFacade.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/imports/readwrite-splitting/Alphabet.g4
@@ -15,23 +15,34 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.distsql.parser;
+lexer grammar Alphabet;
 
-import org.apache.shardingsphere.distsql.parser.spi.RuleSQLStatementVisitorFacade;
-import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
+FOR_GENERATOR: 'DO NOT MATCH ANY THING, JUST FOR GENERATOR';
 
-/**
- * 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";
-    }
-}
+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/RQLStatement.g4 b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/imports/readwrite-splitting/Keyword.g4
similarity index 59%
copy from shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
copy to shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/imports/readwrite-splitting/Keyword.g4
index 29087f4..b222a80 100644
--- a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/imports/readwrite-splitting/Keyword.g4
@@ -15,34 +15,66 @@
  * limitations under the License.
  */
 
-grammar RQLStatement;
+lexer grammar Keyword;
 
-import Keyword, Literals, Symbol;
+import Alphabet;
 
-showResources
-    : SHOW RESOURCES (FROM schemaName)?
+WS
+    : [ \t\r\n] + ->skip
     ;
 
-showReadwriteSplittingRules
-    : SHOW READWRITE_SPLITTING RULES (FROM schemaName)?
+CREATE
+    : C R E A T E
     ;
 
-showDatabaseDiscoveryRules
-    : SHOW DB_DISCOVERY RULES (FROM schemaName)?
+ALTER
+    : A L T E R
     ;
 
-showEncryptRules
-    : SHOW ENCRYPT (TABLE tableRule | RULES) (FROM schemaName)?
+DROP
+    : D R O P
     ;
 
-tableRule
-    : RULE tableName
+SHOW
+    : S H O W
     ;
 
-schemaName
-    : IDENTIFIER
+RULE
+    :  R U L E
     ;
 
-tableName
-    : IDENTIFIER
+FROM
+    : F R O M
+    ;
+
+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
+    ;
+    
+TYPE
+    : T Y P E
+    ;
+    
+NAME
+    : N A M E
+    ;
+
+PROPERTIES
+    : P R O P E R T I E S
+    ;
+
+RULES
+    : R U L E S
     ;
diff --git a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4 b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/imports/readwrite-splitting/Literals.g4
similarity index 65%
copy from shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
copy to shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/imports/readwrite-splitting/Literals.g4
index 29087f4..e5f807b 100644
--- a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/imports/readwrite-splitting/Literals.g4
@@ -15,34 +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)
     ;
-
-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-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/imports/readwrite-splitting/RDLStatement.g4
similarity index 53%
copy from shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RDLStatement.g4
copy to shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/imports/readwrite-splitting/RDLStatement.g4
index 6d78bf3..6f4c8a6 100644
--- a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RDLStatement.g4
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/imports/readwrite-splitting/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
-    ;
-
 createReadwriteSplittingRule
     : CREATE READWRITE_SPLITTING RULE readwriteSplittingRuleDefinition (COMMA readwriteSplittingRuleDefinition)*
     ;
@@ -79,10 +39,6 @@ alterReadwriteSplittingRule
     : ALTER READWRITE_SPLITTING RULE readwriteSplittingRuleDefinition (COMMA readwriteSplittingRuleDefinition)*
     ;
 
-resources
-    : RESOURCES LP IDENTIFIER (COMMA IDENTIFIER)* RP
-    ;
-
 writeResourceName
     : resourceName
     ;
@@ -95,14 +51,6 @@ ruleName
     : IDENTIFIER
     ;
 
-tableName
-    : IDENTIFIER
-    ;
-
-columnName
-    : IDENTIFIER
-    ;
-
 dropReadwriteSplittingRule
     : DROP READWRITE_SPLITTING RULE IDENTIFIER (COMMA IDENTIFIER)*
     ;
@@ -122,47 +70,3 @@ algorithmProperties
 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
-    ;
diff --git a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4 b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/imports/readwrite-splitting/RQLStatement.g4
similarity index 76%
copy from shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
copy to shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/imports/readwrite-splitting/RQLStatement.g4
index 29087f4..4c1257f 100644
--- a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/main/antlr4/imports/RQLStatement.g4
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/imports/readwrite-splitting/RQLStatement.g4
@@ -19,30 +19,10 @@ grammar RQLStatement;
 
 import Keyword, Literals, Symbol;
 
-showResources
-    : SHOW RESOURCES (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
-    ;
diff --git a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/imports/readwrite-splitting/Symbol.g4 b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/imports/readwrite-splitting/Symbol.g4
new file mode 100644
index 0000000..a332bdd
--- /dev/null
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/imports/readwrite-splitting/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-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleLexer.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/ReadwriteSplittingRuleStatement.g4
similarity index 63%
copy from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleLexer.java
copy to shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/ReadwriteSplittingRuleStatement.g4
index a0657cd..d6ce029 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleLexer.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/ReadwriteSplittingRuleStatement.g4
@@ -15,18 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.distsql.parser;
+grammar ReadwriteSplittingRuleStatement;
 
-import org.antlr.v4.runtime.CharStream;
-import org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementLexer;
-import org.apache.shardingsphere.sql.parser.api.parser.SQLLexer;
+import Symbol, RDLStatement, RQLStatement;
 
-/**
- * SQL lexer for sharding rule.
- */
-public final class ShardingRuleLexer extends ShardingRuleStatementLexer implements SQLLexer {
-    
-    public ShardingRuleLexer(final CharStream input) {
-        super(input);
-    }
-}
+execute
+    : (createReadwriteSplittingRule
+    | alterReadwriteSplittingRule
+    | dropReadwriteSplittingRule
+    | showReadwriteSplittingRules
+    ) SEMI?
+    ;
diff --git a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingRuleDistSQLStatementVisitor.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingRuleDistSQLStatementVisitor.java
new file mode 100644
index 0000000..fc49abe
--- /dev/null
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingRuleDistSQLStatementVisitor.java
@@ -0,0 +1,121 @@
+/*
+ * 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.readwritesplitting.distsql.parser.core;
+
+import org.antlr.v4.runtime.RuleContext;
+import org.antlr.v4.runtime.tree.TerminalNode;
+import org.apache.shardingsphere.distsql.parser.autogen.ReadwriteSplittingRuleStatementBaseVisitor;
+import org.apache.shardingsphere.distsql.parser.autogen.ReadwriteSplittingRuleStatementParser.AlgorithmPropertyContext;
+import org.apache.shardingsphere.distsql.parser.autogen.ReadwriteSplittingRuleStatementParser.AlterReadwriteSplittingRuleContext;
+import org.apache.shardingsphere.distsql.parser.autogen.ReadwriteSplittingRuleStatementParser.CreateReadwriteSplittingRuleContext;
+import org.apache.shardingsphere.distsql.parser.autogen.ReadwriteSplittingRuleStatementParser.DropReadwriteSplittingRuleContext;
+import org.apache.shardingsphere.distsql.parser.autogen.ReadwriteSplittingRuleStatementParser.DynamicReadwriteSplittingRuleDefinitionContext;
+import org.apache.shardingsphere.distsql.parser.autogen.ReadwriteSplittingRuleStatementParser.FunctionDefinitionContext;
+import org.apache.shardingsphere.distsql.parser.autogen.ReadwriteSplittingRuleStatementParser.ReadwriteSplittingRuleDefinitionContext;
+import org.apache.shardingsphere.distsql.parser.autogen.ReadwriteSplittingRuleStatementParser.SchemaNameContext;
+import org.apache.shardingsphere.distsql.parser.autogen.ReadwriteSplittingRuleStatementParser.ShowReadwriteSplittingRulesContext;
+import org.apache.shardingsphere.distsql.parser.autogen.ReadwriteSplittingRuleStatementParser.StaticReadwriteSplittingRuleDefinitionContext;
+import org.apache.shardingsphere.distsql.parser.segment.FunctionSegment;
+import org.apache.shardingsphere.distsql.parser.segment.rdl.ReadwriteSplittingRuleSegment;
+import org.apache.shardingsphere.distsql.parser.statement.rdl.alter.impl.AlterReadwriteSplittingRuleStatement;
+import org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateReadwriteSplittingRuleStatement;
+import org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropReadwriteSplittingRuleStatement;
+import org.apache.shardingsphere.distsql.parser.statement.rql.show.impl.ShowReadwriteSplittingRulesStatement;
+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.value.identifier.IdentifierValue;
+
+import java.util.Objects;
+import java.util.Properties;
+import java.util.stream.Collectors;
+
+/**
+ * SQL statement visitor for readwrite-splitting rule.
+ */
+public final class ReadwriteSplittingRuleDistSQLStatementVisitor extends ReadwriteSplittingRuleStatementBaseVisitor<ASTNode> implements SQLVisitor {
+    
+    @Override
+    public ASTNode visitCreateReadwriteSplittingRule(final CreateReadwriteSplittingRuleContext ctx) {
+        return new CreateReadwriteSplittingRuleStatement(ctx.readwriteSplittingRuleDefinition().stream().map(each -> (ReadwriteSplittingRuleSegment) visit(each)).collect(Collectors.toList()));
+    }
+    
+    @Override
+    public ASTNode visitReadwriteSplittingRuleDefinition(final ReadwriteSplittingRuleDefinitionContext ctx) {
+        ReadwriteSplittingRuleSegment result = (ReadwriteSplittingRuleSegment) (null != ctx.dynamicReadwriteSplittingRuleDefinition()
+                ? visit(ctx.dynamicReadwriteSplittingRuleDefinition()) : visit(ctx.staticReadwriteSplittingRuleDefinition()));
+        Properties props = new Properties();
+        if (null != ctx.functionDefinition().algorithmProperties()) {
+            ctx.functionDefinition().algorithmProperties().algorithmProperty()
+                    .forEach(each -> props.setProperty(each.key.getText(), each.value.getText()));
+        }
+        result.setName(ctx.ruleName().getText());
+        result.setLoadBalancer(ctx.functionDefinition().functionName().getText());
+        result.setProps(props);
+        return result;
+    }
+    
+    @Override
+    public ASTNode visitStaticReadwriteSplittingRuleDefinition(final StaticReadwriteSplittingRuleDefinitionContext ctx) {
+        ReadwriteSplittingRuleSegment result = new ReadwriteSplittingRuleSegment();
+        result.setWriteDataSource(ctx.writeResourceName().getText());
+        result.setReadDataSources(ctx.resourceName().stream().map(RuleContext::getText).collect(Collectors.toList()));
+        return result;
+    }
+    
+    @Override
+    public ASTNode visitDynamicReadwriteSplittingRuleDefinition(final DynamicReadwriteSplittingRuleDefinitionContext ctx) {
+        ReadwriteSplittingRuleSegment result = new ReadwriteSplittingRuleSegment();
+        result.setAutoAwareResource(ctx.IDENTIFIER().getText());
+        return result;
+    }
+    
+    @Override
+    public ASTNode visitAlterReadwriteSplittingRule(final AlterReadwriteSplittingRuleContext ctx) {
+        return new AlterReadwriteSplittingRuleStatement(ctx.readwriteSplittingRuleDefinition().stream().map(each -> (ReadwriteSplittingRuleSegment) visit(each)).collect(Collectors.toList()));
+    }
+    
+    @Override
+    public ASTNode visitDropReadwriteSplittingRule(final DropReadwriteSplittingRuleContext ctx) {
+        return new DropReadwriteSplittingRuleStatement(ctx.IDENTIFIER().stream().map(TerminalNode::getText).collect(Collectors.toList()));
+    }
+    
+    @Override
+    public ASTNode visitShowReadwriteSplittingRules(final ShowReadwriteSplittingRulesContext ctx) {
+        return new ShowReadwriteSplittingRulesStatement(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 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;
+    }
+}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleLexer.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingRuleLexer.java
similarity index 70%
copy from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleLexer.java
copy to shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingRuleLexer.java
index a0657cd..ac43dcc 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleLexer.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingRuleLexer.java
@@ -15,18 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.distsql.parser;
+package org.apache.shardingsphere.readwritesplitting.distsql.parser.core;
 
 import org.antlr.v4.runtime.CharStream;
-import org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementLexer;
+import org.apache.shardingsphere.distsql.parser.autogen.ReadwriteSplittingRuleStatementLexer;
 import org.apache.shardingsphere.sql.parser.api.parser.SQLLexer;
 
 /**
- * SQL lexer for sharding rule.
+ * SQL lexer for readwrite-splitting rule.
  */
-public final class ShardingRuleLexer extends ShardingRuleStatementLexer implements SQLLexer {
+public final class ReadwriteSplittingRuleLexer extends ReadwriteSplittingRuleStatementLexer implements SQLLexer {
     
-    public ShardingRuleLexer(final CharStream input) {
+    public ReadwriteSplittingRuleLexer(final CharStream input) {
         super(input);
     }
 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleParser.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingRuleParser.java
similarity index 74%
copy from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleParser.java
copy to shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingRuleParser.java
index 5726dac..d595f38 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleParser.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingRuleParser.java
@@ -15,20 +15,20 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.distsql.parser;
+package org.apache.shardingsphere.readwritesplitting.distsql.parser.core;
 
 import org.antlr.v4.runtime.TokenStream;
-import org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser;
+import org.apache.shardingsphere.distsql.parser.autogen.ReadwriteSplittingRuleStatementParser;
 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;
 
 /**
- * SQL parser for sharding rule.
+ * SQL parser for readwrite-splitting rule.
  */
-public final class ShardingRuleParser extends ShardingRuleStatementParser implements SQLParser {
+public final class ReadwriteSplittingRuleParser extends ReadwriteSplittingRuleStatementParser implements SQLParser {
     
-    public ShardingRuleParser(final TokenStream input) {
+    public ReadwriteSplittingRuleParser(final TokenStream input) {
         super(input);
     }
     
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleParserFacade.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/facade/ReadwriteSplittingRuleParserFacade.java
similarity index 69%
copy from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleParserFacade.java
copy to shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/facade/ReadwriteSplittingRuleParserFacade.java
index 6eab658..74abc23 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleParserFacade.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/facade/ReadwriteSplittingRuleParserFacade.java
@@ -15,29 +15,31 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.distsql.parser;
+package org.apache.shardingsphere.readwritesplitting.distsql.parser.facade;
 
 import org.apache.shardingsphere.distsql.parser.spi.RuleSQLParserFacade;
+import org.apache.shardingsphere.readwritesplitting.distsql.parser.core.ReadwriteSplittingRuleLexer;
+import org.apache.shardingsphere.readwritesplitting.distsql.parser.core.ReadwriteSplittingRuleParser;
 import org.apache.shardingsphere.sql.parser.api.parser.SQLLexer;
 import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
 
 /**
- * SQL parser facade for sharding rule.
+ * SQL parser facade for readwrite-splitting rule.
  */
-public final class ShardingRuleParserFacade implements RuleSQLParserFacade {
+public final class ReadwriteSplittingRuleParserFacade implements RuleSQLParserFacade {
     
     @Override
     public Class<? extends SQLLexer> getLexerClass() {
-        return ShardingRuleLexer.class;
+        return ReadwriteSplittingRuleLexer.class;
     }
     
     @Override
     public Class<? extends SQLParser> getParserClass() {
-        return ShardingRuleParser.class;
+        return ReadwriteSplittingRuleParser.class;
     }
     
     @Override
     public String getRuleType() {
-        return "Sharding";
+        return "Readwrite-splitting";
     }
 }
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleSQLStatementVisitorFacade.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/facade/ReadwriteSplittingRuleSQLStatementVisitorFacade.java
similarity index 70%
copy from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleSQLStatementVisitorFacade.java
copy to shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/facade/ReadwriteSplittingRuleSQLStatementVisitorFacade.java
index 4089cc7..8741450 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleSQLStatementVisitorFacade.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/facade/ReadwriteSplittingRuleSQLStatementVisitorFacade.java
@@ -15,23 +15,24 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.distsql.parser;
+package org.apache.shardingsphere.readwritesplitting.distsql.parser.facade;
 
 import org.apache.shardingsphere.distsql.parser.spi.RuleSQLStatementVisitorFacade;
+import org.apache.shardingsphere.readwritesplitting.distsql.parser.core.ReadwriteSplittingRuleDistSQLStatementVisitor;
 import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
 
 /**
- * Sharding rule SQL statement visitor facade.
+ * SQL statement visitor facade for readwrite-splitting rule.
  */
-public final class ShardingRuleSQLStatementVisitorFacade implements RuleSQLStatementVisitorFacade {
+public final class ReadwriteSplittingRuleSQLStatementVisitorFacade implements RuleSQLStatementVisitorFacade {
     
     @Override
     public Class<? extends SQLVisitor> getVisitorClass() {
-        return ShardingRuleDistSQLStatementVisitor.class;
+        return ReadwriteSplittingRuleDistSQLStatementVisitor.class;
     }
     
     @Override
     public String getRuleType() {
-        return "Sharding";
+        return "Readwrite-splitting";
     }
 }
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-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.parser.spi.RuleSQLParserFacade
similarity index 88%
copy from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.parser.spi.RuleSQLParserFacade
copy to shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.parser.spi.RuleSQLParserFacade
index 87d8dd8..89cfc4e 100644
--- 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-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.parser.spi.RuleSQLParserFacade
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.sharding.distsql.parser.ShardingRuleParserFacade
+org.apache.shardingsphere.readwritesplitting.distsql.parser.facade.ReadwriteSplittingRuleParserFacade
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-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.parser.spi.RuleSQLStatementVisitorFacade
similarity index 87%
copy from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.parser.spi.RuleSQLStatementVisitorFacade
copy to shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.parser.spi.RuleSQLStatementVisitorFacade
index ea02ff8..45cc175 100644
--- 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-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.parser.spi.RuleSQLStatementVisitorFacade
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.sharding.distsql.parser.ShardingRuleSQLStatementVisitorFacade
+org.apache.shardingsphere.readwritesplitting.distsql.parser.facade.ReadwriteSplittingRuleSQLStatementVisitorFacade
diff --git a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingRuleStatementParserEngineTest.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingRuleStatementParserEngineTest.java
new file mode 100644
index 0000000..11372e7
--- /dev/null
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingRuleStatementParserEngineTest.java
@@ -0,0 +1,133 @@
+/*
+ * 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.readwritesplitting.distsql.parser.core;
+
+import org.apache.shardingsphere.distsql.parser.api.DistSQLStatementParserEngine;
+import org.apache.shardingsphere.distsql.parser.segment.rdl.ReadwriteSplittingRuleSegment;
+import org.apache.shardingsphere.distsql.parser.statement.rdl.alter.impl.AlterReadwriteSplittingRuleStatement;
+import org.apache.shardingsphere.distsql.parser.statement.rdl.create.impl.CreateReadwriteSplittingRuleStatement;
+import org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropReadwriteSplittingRuleStatement;
+import org.apache.shardingsphere.distsql.parser.statement.rql.show.impl.ShowReadwriteSplittingRulesStatement;
+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 static org.hamcrest.CoreMatchers.is;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertThat;
+import static org.junit.Assert.assertTrue;
+
+// TODO use Parameterized + XML instead of static test
+public final class ReadwriteSplittingRuleStatementParserEngineTest {
+    
+    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),"
+            + "TYPE(NAME=random)"
+            + ")";
+    
+    private static final String RDL_CREATE_DYNAMIC_READWRITE_SPLITTING_RULE = "CREATE READWRITE_SPLITTING RULE ms_group_1 ("
+            + "AUTO_AWARE_RESOURCE=group_0,"
+            + "TYPE(NAME=random,PROPERTIES(read_weight='2:1'))"
+            + ")";
+    
+    private static final String RDL_ALTER_READWRITE_SPLITTING_RULE = "ALTER READWRITE_SPLITTING RULE ms_group_0 ("
+            + "AUTO_AWARE_RESOURCE=group_0,"
+            + "TYPE(NAME=random,PROPERTIES(read_weight='2:1'))),"
+            + "ms_group_1 ("
+            + "WRITE_RESOURCE=primary_ds,"
+            + "READ_RESOURCES(replica_ds_0,replica_ds_1),"
+            + "TYPE(NAME=random)"
+            + ")";
+    
+    private static final String RDL_DROP_READWRITE_SPLITTING_RULE = "DROP READWRITE_SPLITTING RULE ms_group_0,ms_group_1";
+    
+    private static final String RQL_SHOW_READWRITE_SPLITTING_RULES = "SHOW READWRITE_SPLITTING RULES FROM readwrite_splitting_db";
+    
+    private final DistSQLStatementParserEngine engine = new DistSQLStatementParserEngine();
+    
+    @Test
+    public void assertParseStaticReadwriteSplittingRule() {
+        SQLStatement sqlStatement = engine.parse(RDL_CREATE_STATIC_READWRITE_SPLITTING_RULE);
+        assertTrue(sqlStatement instanceof CreateReadwriteSplittingRuleStatement);
+        CreateReadwriteSplittingRuleStatement statement = (CreateReadwriteSplittingRuleStatement) sqlStatement;
+        assertThat(statement.getRules().size(), is(1));
+        List<ReadwriteSplittingRuleSegment> readwriteSplittingRuleSegments
+                = new ArrayList<>(((CreateReadwriteSplittingRuleStatement) sqlStatement).getRules());
+        assertThat(readwriteSplittingRuleSegments.get(0).getName(), is("ms_group_0"));
+        assertThat(readwriteSplittingRuleSegments.get(0).getWriteDataSource(), is("primary_ds"));
+        assertThat(readwriteSplittingRuleSegments.get(0).getReadDataSources(), is(Arrays.asList("replica_ds_0", "replica_ds_1")));
+        assertThat(readwriteSplittingRuleSegments.get(0).getLoadBalancer(), is("random"));
+        assertThat(readwriteSplittingRuleSegments.get(0).getProps().size(), is(0));
+    }
+    
+    @Test
+    public void assertParseDynamicReadwriteSplittingRule() {
+        SQLStatement sqlStatement = engine.parse(RDL_CREATE_DYNAMIC_READWRITE_SPLITTING_RULE);
+        assertTrue(sqlStatement instanceof CreateReadwriteSplittingRuleStatement);
+        CreateReadwriteSplittingRuleStatement statement = (CreateReadwriteSplittingRuleStatement) sqlStatement;
+        assertThat(statement.getRules().size(), is(1));
+        List<ReadwriteSplittingRuleSegment> readwriteSplittingRuleSegments
+                = new ArrayList<>(((CreateReadwriteSplittingRuleStatement) sqlStatement).getRules());
+        assertThat(readwriteSplittingRuleSegments.get(0).getName(), is("ms_group_1"));
+        assertThat(readwriteSplittingRuleSegments.get(0).getAutoAwareResource(), is("group_0"));
+        assertNull(readwriteSplittingRuleSegments.get(0).getWriteDataSource());
+        assertNull(readwriteSplittingRuleSegments.get(0).getReadDataSources());
+        assertThat(readwriteSplittingRuleSegments.get(0).getLoadBalancer(), is("random"));
+        assertThat(readwriteSplittingRuleSegments.get(0).getProps().size(), is(1));
+        assertThat(readwriteSplittingRuleSegments.get(0).getProps().getProperty("read_weight"), is("'2:1'"));
+    }
+    
+    @Test
+    public void assertParseAlterReadwriteSplittingRule() {
+        SQLStatement sqlStatement = engine.parse(RDL_ALTER_READWRITE_SPLITTING_RULE);
+        assertTrue(sqlStatement instanceof AlterReadwriteSplittingRuleStatement);
+        AlterReadwriteSplittingRuleStatement statement = (AlterReadwriteSplittingRuleStatement) sqlStatement;
+        assertThat(statement.getRules().size(), is(2));
+        List<ReadwriteSplittingRuleSegment> readwriteSplittingRuleSegments = new ArrayList<>(((AlterReadwriteSplittingRuleStatement) sqlStatement).getRules());
+        assertThat(readwriteSplittingRuleSegments.get(0).getName(), is("ms_group_0"));
+        assertThat(readwriteSplittingRuleSegments.get(0).getAutoAwareResource(), is("group_0"));
+        assertNull(readwriteSplittingRuleSegments.get(0).getWriteDataSource());
+        assertNull(readwriteSplittingRuleSegments.get(0).getReadDataSources());
+        assertThat(readwriteSplittingRuleSegments.get(0).getLoadBalancer(), is("random"));
+        assertThat(readwriteSplittingRuleSegments.get(0).getProps().size(), is(1));
+        assertThat(readwriteSplittingRuleSegments.get(0).getProps().getProperty("read_weight"), is("'2:1'"));
+        assertThat(readwriteSplittingRuleSegments.get(1).getName(), is("ms_group_1"));
+        assertThat(readwriteSplittingRuleSegments.get(1).getWriteDataSource(), is("primary_ds"));
+        assertThat(readwriteSplittingRuleSegments.get(1).getReadDataSources(), is(Arrays.asList("replica_ds_0", "replica_ds_1")));
+        assertThat(readwriteSplittingRuleSegments.get(1).getLoadBalancer(), is("random"));
+        assertThat(readwriteSplittingRuleSegments.get(1).getProps().size(), is(0));
+    }
+    
+    @Test
+    public void assertParseDropReadwriteSplittingRule() {
+        SQLStatement sqlStatement = engine.parse(RDL_DROP_READWRITE_SPLITTING_RULE);
+        assertTrue(sqlStatement instanceof DropReadwriteSplittingRuleStatement);
+        assertThat(((DropReadwriteSplittingRuleStatement) sqlStatement).getRuleNames(), is(Arrays.asList("ms_group_0", "ms_group_1")));
+    }
+    
+    @Test
+    public void assertParseShowReadwriteSplittingRules() {
+        SQLStatement sqlStatement = engine.parse(RQL_SHOW_READWRITE_SPLITTING_RULES);
+        assertTrue(sqlStatement instanceof ShowReadwriteSplittingRulesStatement);
+        assertThat(((ShowReadwriteSplittingRulesStatement) sqlStatement).getSchema().get().getIdentifier().getValue(), is("readwrite_splitting_db"));
+    }
+}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/pom.xml b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/pom.xml
index 8161ead..a51696d 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/pom.xml
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/pom.xml
@@ -21,8 +21,8 @@
          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>
+        <artifactId>shardingsphere-sharding</artifactId>
         <version>5.0.0-RC1-SNAPSHOT</version>
     </parent>
     <artifactId>shardingsphere-sharding-distsql</artifactId>
@@ -36,13 +36,13 @@
         </dependency>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-distsql-parser-statement</artifactId>
-            <version>5.0.0-RC1-SNAPSHOT</version>
+            <artifactId>shardingsphere-distsql-parser-engine</artifactId>
+            <version>${project.version}</version>
         </dependency>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-distsql-parser-engine</artifactId>
-            <version>${project.version}</version>
+            <artifactId>shardingsphere-distsql-parser-statement</artifactId>
+            <version>5.0.0-RC1-SNAPSHOT</version>
         </dependency>
     </dependencies>
     
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/core/ShardingRuleDistSQLStatementVisitor.java
similarity index 99%
rename from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleDistSQLStatementVisitor.java
rename to shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingRuleDistSQLStatementVisitor.java
index 3f99b20..b267a27 100644
--- 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/core/ShardingRuleDistSQLStatementVisitor.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.distsql.parser;
+package org.apache.shardingsphere.sharding.distsql.parser.core;
 
 import com.google.common.base.Joiner;
 import org.antlr.v4.runtime.tree.ParseTree;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleLexer.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingRuleLexer.java
similarity index 95%
rename from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleLexer.java
rename to shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingRuleLexer.java
index a0657cd..a5e47eb 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleLexer.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingRuleLexer.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.distsql.parser;
+package org.apache.shardingsphere.sharding.distsql.parser.core;
 
 import org.antlr.v4.runtime.CharStream;
 import org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementLexer;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleParser.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingRuleParser.java
similarity index 95%
rename from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleParser.java
rename to shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingRuleParser.java
index 5726dac..a6a624d 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleParser.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingRuleParser.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.distsql.parser;
+package org.apache.shardingsphere.sharding.distsql.parser.core;
 
 import org.antlr.v4.runtime.TokenStream;
 import org.apache.shardingsphere.distsql.parser.autogen.ShardingRuleStatementParser;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleParserFacade.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/facade/ShardingRuleParserFacade.java
similarity index 86%
rename from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleParserFacade.java
rename to shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/facade/ShardingRuleParserFacade.java
index 6eab658..446be52 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleParserFacade.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/facade/ShardingRuleParserFacade.java
@@ -15,9 +15,11 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.distsql.parser;
+package org.apache.shardingsphere.sharding.distsql.parser.facade;
 
 import org.apache.shardingsphere.distsql.parser.spi.RuleSQLParserFacade;
+import org.apache.shardingsphere.sharding.distsql.parser.core.ShardingRuleLexer;
+import org.apache.shardingsphere.sharding.distsql.parser.core.ShardingRuleParser;
 import org.apache.shardingsphere.sql.parser.api.parser.SQLLexer;
 import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
 
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleSQLStatementVisitorFacade.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/facade/ShardingRuleSQLStatementVisitorFacade.java
similarity index 85%
rename from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleSQLStatementVisitorFacade.java
rename to shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/facade/ShardingRuleSQLStatementVisitorFacade.java
index 4089cc7..74958fa 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleSQLStatementVisitorFacade.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/facade/ShardingRuleSQLStatementVisitorFacade.java
@@ -15,13 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.distsql.parser;
+package org.apache.shardingsphere.sharding.distsql.parser.facade;
 
 import org.apache.shardingsphere.distsql.parser.spi.RuleSQLStatementVisitorFacade;
+import org.apache.shardingsphere.sharding.distsql.parser.core.ShardingRuleDistSQLStatementVisitor;
 import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
 
 /**
- * Sharding rule SQL statement visitor facade.
+ * SQL statement visitor facade for sharding rule .
  */
 public final class ShardingRuleSQLStatementVisitorFacade implements RuleSQLStatementVisitorFacade {
     
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
index 87d8dd8..319ee6b 100644
--- 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
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.sharding.distsql.parser.ShardingRuleParserFacade
+org.apache.shardingsphere.sharding.distsql.parser.facade.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
index ea02ff8..3516303 100644
--- 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
@@ -15,4 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.sharding.distsql.parser.ShardingRuleSQLStatementVisitorFacade
+org.apache.shardingsphere.sharding.distsql.parser.facade.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/core/ShardingRuleStatementParserEngineTest.java
similarity index 99%
rename from shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/test/java/org/apache/shardingsphere/sharding/distsql/parser/ShardingRuleStatementParserEngineTest.java
rename to shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/src/test/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingRuleStatementParserEngineTest.java
index 25bad0b..15e671d 100644
--- 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/core/ShardingRuleStatementParserEngineTest.java
@@ -15,7 +15,7 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.sharding.distsql.parser;
+package org.apache.shardingsphere.sharding.distsql.parser.core;
 
 import org.apache.shardingsphere.distsql.parser.api.DistSQLStatementParserEngine;
 import org.apache.shardingsphere.distsql.parser.segment.TableRuleSegment;
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/impl/ReadwriteSplittingRulesQueryBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/impl/ReadwriteSplittingRulesQueryBackendHandler.java
index 86a8043..ee82a49 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/impl/ReadwriteSplittingRulesQueryBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rql/impl/ReadwriteSplittingRulesQueryBackendHandler.java
@@ -92,7 +92,7 @@ public final class ReadwriteSplittingRulesQueryBackendHandler extends SchemaRequ
                 ? loadBalancers.get(ruleConfig.getLoadBalancerName()).getProps() : null;
         return Arrays.asList(ruleConfig.getName(), ruleConfig.getAutoAwareDataSourceName(),
                 ruleConfig.getWriteDataSourceName(), Joiner.on(",").join(ruleConfig.getReadDataSourceNames()),
-                loadBalancers.get(ruleConfig.getLoadBalancerName()).getType(),
+                null == loadBalancers.get(ruleConfig.getLoadBalancerName()) ? null : loadBalancers.get(ruleConfig.getLoadBalancerName()).getType(),
                 Objects.nonNull(loadBalancerProps) ? Joiner.on(",").join(loadBalancerProps.entrySet().stream()
                         .map(each -> Joiner.on("=").join(each.getKey(), each.getValue())).collect(Collectors.toList())) : "");
     }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactoryTest.java b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactoryTest.java
index fe47a61..b06d8fa 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactoryTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-frontend/shardingsphere-proxy-frontend-mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/err/MySQLErrPacketFactoryTest.java
@@ -172,7 +172,7 @@ public final class MySQLErrPacketFactoryTest {
         assertThat(actual.getSequenceId(), is(1));
         assertThat(actual.getErrorCode(), is(1235));
         assertThat(actual.getSqlState(), is("42000"));
-        assertThat(actual.getErrorMessage(), is("This version of ShardingProxy doesn't yet support this SQL. 'No reason'"));
+        assertThat(actual.getErrorMessage(), is("This version of ShardingSphere-Proxy doesn't yet support this SQL. 'No reason'"));
     }
     
     @Test
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/SQLParserFactory.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/SQLParserFactory.java
index ca8d0db..7dd59c4 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/SQLParserFactory.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/SQLParserFactory.java
@@ -20,11 +20,13 @@ package org.apache.shardingsphere.sql.parser.core;
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
 import lombok.SneakyThrows;
+import org.antlr.v4.runtime.BailErrorStrategy;
 import org.antlr.v4.runtime.CharStream;
 import org.antlr.v4.runtime.CodePointBuffer;
 import org.antlr.v4.runtime.CodePointCharStream;
 import org.antlr.v4.runtime.CommonTokenStream;
 import org.antlr.v4.runtime.Lexer;
+import org.antlr.v4.runtime.Parser;
 import org.antlr.v4.runtime.TokenStream;
 import org.apache.shardingsphere.sql.parser.api.parser.SQLLexer;
 import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
@@ -51,7 +53,9 @@ public final class SQLParserFactory {
     
     @SneakyThrows(ReflectiveOperationException.class)
     private static SQLParser createSQLParser(final TokenStream tokenStream, final Class<? extends SQLParser> parserClass) {
-        return parserClass.getConstructor(TokenStream.class).newInstance(tokenStream);
+        SQLParser result = parserClass.getConstructor(TokenStream.class).newInstance(tokenStream);
+        ((Parser) result).setErrorHandler(new BailErrorStrategy());
+        return result;
     }
     
     @SneakyThrows(ReflectiveOperationException.class)
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/parser/SQLParserExecutor.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/parser/SQLParserExecutor.java
index 848f481..e1aaf0b 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/parser/SQLParserExecutor.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/parser/SQLParserExecutor.java
@@ -18,7 +18,6 @@
 package org.apache.shardingsphere.sql.parser.core.database.parser;
 
 import lombok.RequiredArgsConstructor;
-import org.antlr.v4.runtime.BailErrorStrategy;
 import org.antlr.v4.runtime.Parser;
 import org.antlr.v4.runtime.atn.PredictionMode;
 import org.antlr.v4.runtime.misc.ParseCancellationException;
@@ -56,11 +55,11 @@ public final class SQLParserExecutor {
         DatabaseTypedSQLParserFacade sqlParserFacade = DatabaseTypedSQLParserFacadeRegistry.getFacade(databaseType);
         SQLParser sqlParser = SQLParserFactory.newInstance(sql, sqlParserFacade.getLexerClass(), sqlParserFacade.getParserClass());
         try {
-            setPredictionMode((Parser) sqlParser, PredictionMode.SLL);
+            ((Parser) sqlParser).getInterpreter().setPredictionMode(PredictionMode.SLL);
             return (ParseASTNode) sqlParser.parse();
         } catch (final ParseCancellationException ex) {
             ((Parser) sqlParser).reset();
-            setPredictionMode((Parser) sqlParser, PredictionMode.LL);
+            ((Parser) sqlParser).getInterpreter().setPredictionMode(PredictionMode.LL);
             try {
                 return (ParseASTNode) sqlParser.parse();
             } catch (final ParseCancellationException e) {
@@ -68,9 +67,4 @@ public final class SQLParserExecutor {
             }
         }
     }
-    
-    private void setPredictionMode(final Parser sqlParser, final PredictionMode mode) {
-        sqlParser.setErrorHandler(new BailErrorStrategy());
-        sqlParser.getInterpreter().setPredictionMode(mode);
-    }
 }