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

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


The following commit(s) were added to refs/heads/master by this push:
     new e2e93aeb907 Migrate global rules (queries in TrafficRule) to the 
shardingsphere-traffic-distsql module. (#20277)
e2e93aeb907 is described below

commit e2e93aeb907c224d18f05eff08de918ecbdcc331
Author: yx9o <[email protected]>
AuthorDate: Fri Aug 19 21:04:13 2022 +0800

    Migrate global rules (queries in TrafficRule) to the 
shardingsphere-traffic-distsql module. (#20277)
---
 .../src/main/antlr4/imports/RALStatement.g4        |  4 -
 .../parser/autogen/KernelDistSQLStatement.g4       |  1 -
 .../core/kernel/KernelDistSQLStatementVisitor.java |  7 --
 .../handler/AuthorityRuleQueryResultSetTest.java   |  7 +-
 .../shardingsphere-traffic/pom.xml                 |  1 +
 .../{ => shardingsphere-traffic-distsql}/pom.xml   |  9 +-
 .../pom.xml                                        | 26 ++++--
 .../handler/query/TrafficRulesQueryResultSet.java  | 96 ++++++++++++++++++++++
 ...dingsphere.infra.distsql.query.DistSQLResultSet | 18 ++++
 .../query/TrafficRulesQueryResultSetTest.java      | 56 ++++++-------
 .../shardingsphere-traffic-distsql-parser/pom.xml  | 69 ++++++++++++++++
 .../src/main/antlr4/imports/traffic/Alphabet.g4    | 42 +++++++---
 .../src/main/antlr4/imports/traffic/Keyword.g4     | 34 +++++---
 .../src/main/antlr4/imports/traffic/Literals.g4    | 24 +++---
 .../main/antlr4/imports/traffic/RALStatement.g4    | 22 ++---
 .../src/main/antlr4/imports/traffic/Symbol.g4      | 62 ++++++++++++++
 .../parser/autogen/TrafficDistSQLStatement.g4      | 18 ++--
 .../distsql/parser/core/TrafficDistSQLLexer.java   | 18 ++--
 .../distsql/parser/core/TrafficDistSQLParser.java  | 26 ++++--
 .../core/TrafficDistSQLStatementVisitor.java       | 41 +++++++++
 .../TrafficDistSQLStatementParserFacade.java       | 52 ++++++++++++
 ...engine.spi.FeaturedDistSQLStatementParserFacade | 18 ++++
 .../pom.xml                                        | 16 ++--
 .../queryable/ShowTrafficRulesStatement.java       |  6 +-
 .../shardingsphere-proxy-backend/pom.xml           |  5 ++
 .../distsql/ral/RALBackendHandlerFactory.java      |  3 -
 .../ral/queryable/ShowTrafficRulesHandler.java     | 78 ------------------
 .../shardingsphere-parser-test/pom.xml             |  5 ++
 .../ral/impl/QueryableRALStatementAssert.java      |  2 +-
 .../queryable/ShowTrafficRulesStatementAssert.java |  2 +-
 30 files changed, 537 insertions(+), 231 deletions(-)

diff --git 
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RALStatement.g4
 
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RALStatement.g4
index 36291695732..8b4395f4fab 100644
--- 
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RALStatement.g4
+++ 
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RALStatement.g4
@@ -91,10 +91,6 @@ alterTrafficRule
     : ALTER TRAFFIC RULE trafficRuleDefinition (COMMA trafficRuleDefinition)* 
     ;
 
-showTrafficRules
-    : SHOW TRAFFIC (RULES | RULE ruleName)
-    ;
-
 dropTrafficRule
     : DROP TRAFFIC RULE ifExists? ruleName (COMMA ruleName)*
     ;
diff --git 
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
 
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
index 6a730e9c1eb..02dcbca117d 100644
--- 
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
+++ 
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
@@ -53,7 +53,6 @@ execute
     | alterSQLParserRule
     | showTransactionRule
     | alterTransactionRule
-    | showTrafficRules
     | dropTrafficRule
     | createTrafficRule
     | alterTrafficRule
diff --git 
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
 
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
index 59bbb4a2da8..3e7d5820f0b 100644
--- 
a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
+++ 
b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
@@ -68,7 +68,6 @@ import 
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementPa
 import 
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowSingleTableContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowSingleTableRulesContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowTableMetadataContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowTrafficRulesContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowTransactionRuleContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowUnusedResourcesContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ShowVariableContext;
@@ -93,7 +92,6 @@ import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowMode
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowSQLParserRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowSQLTranslatorRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowTableMetadataStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowTrafficRulesStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowTransactionRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowVariableStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.updatable.AlterInstanceStatement;
@@ -391,11 +389,6 @@ public final class KernelDistSQLStatementVisitor extends 
KernelDistSQLStatementB
         return new 
AlterTrafficRuleStatement(ctx.trafficRuleDefinition().stream().map(each -> 
(TrafficRuleSegment) visit(each)).collect(Collectors.toList()));
     }
     
-    @Override
-    public ASTNode visitShowTrafficRules(final ShowTrafficRulesContext ctx) {
-        return new ShowTrafficRulesStatement(null == ctx.ruleName() ? null : 
getIdentifierValue(ctx.ruleName()));
-    }
-    
     @Override
     public ASTNode visitTrafficRuleDefinition(final 
TrafficRuleDefinitionContext ctx) {
         AlgorithmSegment loadBalancerSegment = null;
diff --git 
a/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-distsql/shardingsphere-authority-distsql-handler/src/test/java/org/apache/shardingsphere/authority/distsql/handler/AuthorityRuleQueryResultSetTest.java
 
b/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-distsql/shardingsphere-authority-distsql-handler/src/test/java/org/apache/shardingsphere/authority/distsql/handler/AuthorityRuleQueryResultSetTest.java
index 4e57391ad3d..335bbf6eb13 100644
--- 
a/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-distsql/shardingsphere-authority-distsql-handler/src/test/java/org/apache/shardingsphere/authority/distsql/handler/AuthorityRuleQueryResultSetTest.java
+++ 
b/shardingsphere-kernel/shardingsphere-authority/shardingsphere-authority-distsql/shardingsphere-authority-distsql-handler/src/test/java/org/apache/shardingsphere/authority/distsql/handler/AuthorityRuleQueryResultSetTest.java
@@ -40,7 +40,7 @@ import static org.mockito.Mockito.when;
 public final class AuthorityRuleQueryResultSetTest {
     
     @Test
-    public void assertAuthorityRule() {
+    public void assertExecute() {
         ShardingSphereRuleMetaData ruleMetaData = mockRuleMetaData();
         GlobalRuleDistSQLResultSet resultSet = new 
AuthorityRuleQueryResultSet();
         resultSet.init(ruleMetaData, mock(ShowAuthorityRuleStatement.class));
@@ -52,13 +52,14 @@ public final class AuthorityRuleQueryResultSetTest {
     }
     
     private ShardingSphereRuleMetaData mockRuleMetaData() {
-        AuthorityRule authorityRule = new 
AuthorityRule(getAuthorityRuleConfiguration(), Collections.emptyMap());
+        AuthorityRule authorityRule = mock(AuthorityRule.class);
+        
when(authorityRule.getConfiguration()).thenReturn(createAuthorityRuleConfiguration());
         ShardingSphereRuleMetaData result = 
mock(ShardingSphereRuleMetaData.class);
         
when(result.findSingleRule(AuthorityRule.class)).thenReturn(Optional.of(authorityRule));
         return result;
     }
     
-    private AuthorityRuleConfiguration getAuthorityRuleConfiguration() {
+    private AuthorityRuleConfiguration createAuthorityRuleConfiguration() {
         ShardingSphereUser root = new ShardingSphereUser("root", "", 
"localhost");
         return new AuthorityRuleConfiguration(Collections.singleton(root), new 
AlgorithmConfiguration("ALL_PERMITTED", new Properties()));
     }
diff --git a/shardingsphere-kernel/shardingsphere-traffic/pom.xml 
b/shardingsphere-kernel/shardingsphere-traffic/pom.xml
index e2a674f7749..c04b2c97007 100644
--- a/shardingsphere-kernel/shardingsphere-traffic/pom.xml
+++ b/shardingsphere-kernel/shardingsphere-traffic/pom.xml
@@ -31,5 +31,6 @@
     <modules>
         <module>shardingsphere-traffic-api</module>
         <module>shardingsphere-traffic-core</module>
+        <module>shardingsphere-traffic-distsql</module>
     </modules>
 </project>
diff --git a/shardingsphere-kernel/shardingsphere-traffic/pom.xml 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/pom.xml
similarity index 81%
copy from shardingsphere-kernel/shardingsphere-traffic/pom.xml
copy to 
shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/pom.xml
index e2a674f7749..e41b14c1dc2 100644
--- a/shardingsphere-kernel/shardingsphere-traffic/pom.xml
+++ 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/pom.xml
@@ -21,15 +21,16 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere-kernel</artifactId>
+        <artifactId>shardingsphere-traffic</artifactId>
         <version>5.1.3-SNAPSHOT</version>
     </parent>
-    <artifactId>shardingsphere-traffic</artifactId>
+    <artifactId>shardingsphere-traffic-distsql</artifactId>
     <packaging>pom</packaging>
     <name>${project.artifactId}</name>
     
     <modules>
-        <module>shardingsphere-traffic-api</module>
-        <module>shardingsphere-traffic-core</module>
+        <module>shardingsphere-traffic-distsql-statement</module>
+        <module>shardingsphere-traffic-distsql-parser</module>
+        <module>shardingsphere-traffic-distsql-handler</module>
     </modules>
 </project>
diff --git a/shardingsphere-kernel/shardingsphere-traffic/pom.xml 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/pom.xml
similarity index 60%
copy from shardingsphere-kernel/shardingsphere-traffic/pom.xml
copy to 
shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/pom.xml
index e2a674f7749..d93526f5198 100644
--- a/shardingsphere-kernel/shardingsphere-traffic/pom.xml
+++ 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/pom.xml
@@ -21,15 +21,27 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere-kernel</artifactId>
+        <artifactId>shardingsphere-traffic-distsql</artifactId>
         <version>5.1.3-SNAPSHOT</version>
     </parent>
-    <artifactId>shardingsphere-traffic</artifactId>
-    <packaging>pom</packaging>
+    <artifactId>shardingsphere-traffic-distsql-handler</artifactId>
     <name>${project.artifactId}</name>
     
-    <modules>
-        <module>shardingsphere-traffic-api</module>
-        <module>shardingsphere-traffic-core</module>
-    </modules>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-traffic-core</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-traffic-distsql-statement</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-traffic-distsql-parser</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
 </project>
diff --git 
a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/main/java/org/apache/shardingsphere/traffic/distsql/handler/query/TrafficRulesQueryResultSet.java
 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/main/java/org/apache/shardingsphere/traffic/distsql/handler/query/TrafficRulesQueryResultSet.java
new file mode 100644
index 00000000000..63c1b9f4f2c
--- /dev/null
+++ 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/main/java/org/apache/shardingsphere/traffic/distsql/handler/query/TrafficRulesQueryResultSet.java
@@ -0,0 +1,96 @@
+/*
+ * 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.traffic.distsql.handler.query;
+
+import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
+import 
org.apache.shardingsphere.infra.distsql.query.GlobalRuleDistSQLResultSet;
+import 
org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData;
+import org.apache.shardingsphere.infra.util.props.PropertiesConverter;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
+import org.apache.shardingsphere.traffic.api.config.TrafficRuleConfiguration;
+import 
org.apache.shardingsphere.traffic.api.config.TrafficStrategyConfiguration;
+import 
org.apache.shardingsphere.traffic.distsql.parser.statement.queryable.ShowTrafficRulesStatement;
+import org.apache.shardingsphere.traffic.rule.TrafficRule;
+
+import java.util.Arrays;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.Optional;
+
+/**
+ * Query result set for traffic rule..
+ */
+public final class TrafficRulesQueryResultSet implements 
GlobalRuleDistSQLResultSet {
+    
+    private static final String RULE_NAME = "name";
+    
+    private static final String LABELS = "labels";
+    
+    private static final String ALGORITHM_TYPE = "algorithm_type";
+    
+    private static final String ALGORITHM_PROPS = "algorithm_props";
+    
+    private static final String LOAD_BALANCER_TYPE = "load_balancer_type";
+    
+    private static final String LOAD_BALANCER_PROPS = "load_balancer_props";
+    
+    private Iterator<Collection<Object>> data = Collections.emptyIterator();
+    
+    @Override
+    public void init(final ShardingSphereRuleMetaData ruleMetaData, final 
SQLStatement sqlStatement) {
+        Optional<TrafficRule> rule = 
ruleMetaData.findSingleRule(TrafficRule.class);
+        ShowTrafficRulesStatement statement = (ShowTrafficRulesStatement) 
sqlStatement;
+        Optional<String> ruleName = 
Optional.ofNullable(statement.getRuleName());
+        rule.ifPresent(optional -> data = 
buildData(optional.getConfiguration(), ruleName).iterator());
+    }
+    
+    private Collection<Collection<Object>> buildData(final 
TrafficRuleConfiguration ruleConfig, final Optional<String> ruleName) {
+        Collection<Collection<Object>> result = new LinkedList<>();
+        ruleConfig.getTrafficStrategies().stream().filter(each -> 
!ruleName.isPresent() || each.getName().equals(ruleName.get()))
+                .forEach(each -> result.add(buildRow(each, 
ruleConfig.getTrafficAlgorithms().get(each.getAlgorithmName()), 
ruleConfig.getLoadBalancers().get(each.getLoadBalancerName()))));
+        return result;
+    }
+    
+    private Collection<Object> buildRow(final TrafficStrategyConfiguration 
strategy, final AlgorithmConfiguration trafficAlgorithm, final 
AlgorithmConfiguration loadBalancer) {
+        return Arrays.asList(strategy.getName(), String.join(",", 
strategy.getLabels()), null != trafficAlgorithm ? trafficAlgorithm.getType() : 
"",
+                null != trafficAlgorithm ? 
PropertiesConverter.convert(trafficAlgorithm.getProps()) : "", null != 
loadBalancer ? loadBalancer.getType() : "",
+                null != loadBalancer ? 
PropertiesConverter.convert(loadBalancer.getProps()) : "");
+    }
+    
+    @Override
+    public Collection<String> getColumnNames() {
+        return Arrays.asList(RULE_NAME, LABELS, ALGORITHM_TYPE, 
ALGORITHM_PROPS, LOAD_BALANCER_TYPE, LOAD_BALANCER_PROPS);
+    }
+    
+    @Override
+    public boolean next() {
+        return data.hasNext();
+    }
+    
+    @Override
+    public Collection<Object> getRowData() {
+        return data.next();
+    }
+    
+    @Override
+    public String getType() {
+        return ShowTrafficRulesStatement.class.getName();
+    }
+}
diff --git 
a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet
 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet
new file mode 100644
index 00000000000..2c585a64b23
--- /dev/null
+++ 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.apache.shardingsphere.traffic.distsql.handler.query.TrafficRulesQueryResultSet
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowTrafficRulesHandlerTest.java
 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/query/TrafficRulesQueryResultSetTest.java
similarity index 59%
rename from 
shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowTrafficRulesHandlerTest.java
rename to 
shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/query/TrafficRulesQueryResultSetTest.java
index 98efcd2192c..4ab5da5a041 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowTrafficRulesHandlerTest.java
+++ 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-handler/src/test/java/org/apache/shardingsphere/traffic/distsql/handler/query/TrafficRulesQueryResultSetTest.java
@@ -15,54 +15,52 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable;
+package org.apache.shardingsphere.traffic.distsql.handler.query;
 
-import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowTrafficRulesStatement;
 import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
+import 
org.apache.shardingsphere.infra.distsql.query.GlobalRuleDistSQLResultSet;
 import 
org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData;
-import org.apache.shardingsphere.mode.manager.ContextManager;
-import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import org.apache.shardingsphere.proxy.backend.util.ProxyContextRestorer;
 import org.apache.shardingsphere.traffic.api.config.TrafficRuleConfiguration;
 import 
org.apache.shardingsphere.traffic.api.config.TrafficStrategyConfiguration;
+import 
org.apache.shardingsphere.traffic.distsql.parser.statement.queryable.ShowTrafficRulesStatement;
 import org.apache.shardingsphere.traffic.rule.TrafficRule;
 import org.junit.Test;
 
-import java.sql.SQLException;
 import java.util.Arrays;
+import java.util.Collection;
 import java.util.Collections;
-import java.util.List;
+import java.util.Optional;
 import java.util.Properties;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertThat;
-import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
+import static org.junit.Assert.assertTrue;
 import static org.mockito.Mockito.mock;
 import static org.mockito.Mockito.when;
 
-public class ShowTrafficRulesHandlerTest extends ProxyContextRestorer {
+public final class TrafficRulesQueryResultSetTest {
     
     @Test
-    public void assertExecute() throws SQLException {
-        ShowTrafficRulesHandler handler = new ShowTrafficRulesHandler();
-        handler.init(new ShowTrafficRulesStatement("rule_name_1"), null);
-        ContextManager contextManager = mock(ContextManager.class, 
RETURNS_DEEP_STUBS);
-        TrafficRule rule = mock(TrafficRule.class);
-        
when(rule.getConfiguration()).thenReturn(createTrafficRuleConfiguration());
-        ShardingSphereRuleMetaData globalRuleMetaData = 
mock(ShardingSphereRuleMetaData.class);
-        
when(contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData()).thenReturn(globalRuleMetaData);
-        
when(globalRuleMetaData.getSingleRule(TrafficRule.class)).thenReturn(rule);
-        ProxyContext.init(contextManager);
-        handler.execute();
-        handler.next();
-        List<Object> data = handler.getRowData().getData();
-        assertThat(data.size(), is(6));
-        assertThat(data.get(0), is("rule_name_1"));
-        assertThat(data.get(1), is("olap,order_by"));
-        assertThat(data.get(2), is("SQL_MATCH"));
-        assertThat(data.get(3), is("sql=select * from t_order"));
-        assertThat(data.get(4), is("RANDOM"));
-        assertThat(data.get(5), is(""));
+    public void assertExecute() {
+        ShardingSphereRuleMetaData ruleMetaData = mockRuleMetaData();
+        GlobalRuleDistSQLResultSet resultSet = new 
TrafficRulesQueryResultSet();
+        resultSet.init(ruleMetaData, mock(ShowTrafficRulesStatement.class));
+        Collection<Object> actual = resultSet.getRowData();
+        assertThat(actual.size(), is(6));
+        assertTrue(actual.contains("rule_name_1"));
+        assertTrue(actual.contains("olap,order_by"));
+        assertTrue(actual.contains("SQL_MATCH"));
+        assertTrue(actual.contains("sql=select * from t_order"));
+        assertTrue(actual.contains("RANDOM"));
+        assertTrue(actual.contains(""));
+    }
+    
+    private ShardingSphereRuleMetaData mockRuleMetaData() {
+        TrafficRule trafficRule = mock(TrafficRule.class);
+        
when(trafficRule.getConfiguration()).thenReturn(createTrafficRuleConfiguration());
+        ShardingSphereRuleMetaData result = 
mock(ShardingSphereRuleMetaData.class);
+        
when(result.findSingleRule(TrafficRule.class)).thenReturn(Optional.of(trafficRule));
+        return result;
     }
     
     private TrafficRuleConfiguration createTrafficRuleConfiguration() {
diff --git 
a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/pom.xml
 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/pom.xml
new file mode 100644
index 00000000000..7aaef017d81
--- /dev/null
+++ 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/pom.xml
@@ -0,0 +1,69 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+  ~ Licensed to the Apache Software Foundation (ASF) under one or more
+  ~ contributor license agreements.  See the NOTICE file distributed with
+  ~ this work for additional information regarding copyright ownership.
+  ~ The ASF licenses this file to You under the Apache License, Version 2.0
+  ~ (the "License"); you may not use this file except in compliance with
+  ~ the License.  You may obtain a copy of the License at
+  ~
+  ~     http://www.apache.org/licenses/LICENSE-2.0
+  ~
+  ~ Unless required by applicable law or agreed to in writing, software
+  ~ distributed under the License is distributed on an "AS IS" BASIS,
+  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  ~ See the License for the specific language governing permissions and
+  ~ limitations under the License.
+  -->
+
+<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance";
+         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
+    <modelVersion>4.0.0</modelVersion>
+    <parent>
+        <groupId>org.apache.shardingsphere</groupId>
+        <artifactId>shardingsphere-traffic-distsql</artifactId>
+        <version>5.1.3-SNAPSHOT</version>
+    </parent>
+    <artifactId>shardingsphere-traffic-distsql-parser</artifactId>
+    <name>${project.artifactId}</name>
+    
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-sql-parser-spi</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-distsql-parser</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-traffic-distsql-statement</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
+    
+    <build>
+        <plugins>
+            <plugin>
+                <groupId>org.antlr</groupId>
+                <artifactId>antlr4-maven-plugin</artifactId>
+                <executions>
+                    <execution>
+                        <id>antlr</id>
+                        <goals>
+                            <goal>antlr4</goal>
+                        </goals>
+                        <configuration>
+                            
<libDirectory>src/main/antlr4/imports/traffic/</libDirectory>
+                            <listener>false</listener>
+                            <visitor>true</visitor>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+        </plugins>
+    </build>
+</project>
diff --git 
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/antlr4/imports/traffic/Alphabet.g4
similarity index 56%
copy from 
shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
copy to 
shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/antlr4/imports/traffic/Alphabet.g4
index 0d6cda995d9..f7603cc7e63 100644
--- 
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
+++ 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/antlr4/imports/traffic/Alphabet.g4
@@ -15,18 +15,34 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.distsql.parser.statement.ral.queryable;
+lexer grammar Alphabet;
 
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import 
org.apache.shardingsphere.distsql.parser.statement.ral.QueryableRALStatement;
+FOR_GENERATOR: 'DO NOT MATCH ANY THING, JUST FOR GENERATOR';
 
-/**
- * Show traffic rules statement.
- */
-@RequiredArgsConstructor
-@Getter
-public final class ShowTrafficRulesStatement extends QueryableRALStatement {
-    
-    private final String ruleName;
-}
+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/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/antlr4/imports/traffic/Keyword.g4
similarity index 66%
copy from 
shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
copy to 
shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/antlr4/imports/traffic/Keyword.g4
index 0d6cda995d9..7f3ce62998e 100644
--- 
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
+++ 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/antlr4/imports/traffic/Keyword.g4
@@ -15,18 +15,26 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.distsql.parser.statement.ral.queryable;
+lexer grammar Keyword;
 
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import 
org.apache.shardingsphere.distsql.parser.statement.ral.QueryableRALStatement;
+import Alphabet;
 
-/**
- * Show traffic rules statement.
- */
-@RequiredArgsConstructor
-@Getter
-public final class ShowTrafficRulesStatement extends QueryableRALStatement {
-    
-    private final String ruleName;
-}
+WS
+    : [ \t\r\n] + ->skip
+    ;
+
+SHOW
+    : S H O W
+    ;
+
+TRAFFIC
+    : T R A F F I C
+    ;
+
+RULES
+    : R U L E S
+    ;
+
+RULE
+    : R U L E
+    ;
diff --git 
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/antlr4/imports/traffic/Literals.g4
similarity index 66%
copy from 
shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
copy to 
shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/antlr4/imports/traffic/Literals.g4
index 0d6cda995d9..586f6d635fa 100644
--- 
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
+++ 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/antlr4/imports/traffic/Literals.g4
@@ -15,18 +15,16 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.distsql.parser.statement.ral.queryable;
+lexer grammar Literals;
 
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import 
org.apache.shardingsphere.distsql.parser.statement.ral.QueryableRALStatement;
+import Alphabet, Symbol;
 
-/**
- * Show traffic rules statement.
- */
-@RequiredArgsConstructor
-@Getter
-public final class ShowTrafficRulesStatement extends QueryableRALStatement {
-    
-    private final String ruleName;
-}
+IDENTIFIER
+    : [A-Za-z_$0-9]*?[A-Za-z_$]+?[A-Za-z_$0-9]*
+    | BQ ~'`'+ BQ
+    ;
+
+STRING
+    : (DQ ('\\'. | '""' | ~('"' | '\\'))* DQ)
+    | (SQ ('\\'. | '\'\'' | ~('\'' | '\\'))* SQ)
+    ;
diff --git 
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/antlr4/imports/traffic/RALStatement.g4
similarity index 66%
copy from 
shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
copy to 
shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/antlr4/imports/traffic/RALStatement.g4
index 0d6cda995d9..6a83ea4f0de 100644
--- 
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
+++ 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/antlr4/imports/traffic/RALStatement.g4
@@ -15,18 +15,14 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.distsql.parser.statement.ral.queryable;
+grammar RALStatement;
 
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import 
org.apache.shardingsphere.distsql.parser.statement.ral.QueryableRALStatement;
+import Keyword, Literals;
 
-/**
- * Show traffic rules statement.
- */
-@RequiredArgsConstructor
-@Getter
-public final class ShowTrafficRulesStatement extends QueryableRALStatement {
-    
-    private final String ruleName;
-}
+showTrafficRules
+    : SHOW TRAFFIC (RULES | RULE ruleName)
+    ;
+
+ruleName
+    : IDENTIFIER
+    ;
diff --git 
a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/antlr4/imports/traffic/Symbol.g4
 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/antlr4/imports/traffic/Symbol.g4
new file mode 100644
index 00000000000..3322b09bb3a
--- /dev/null
+++ 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/antlr4/imports/traffic/Symbol.g4
@@ -0,0 +1,62 @@
+/*
+ * 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:                 '_';
+DL:                 '$';
diff --git 
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/TrafficDistSQLStatement.g4
similarity index 66%
copy from 
shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
copy to 
shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/TrafficDistSQLStatement.g4
index 0d6cda995d9..d7524a3e37c 100644
--- 
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
+++ 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/TrafficDistSQLStatement.g4
@@ -15,18 +15,10 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.distsql.parser.statement.ral.queryable;
+grammar TrafficDistSQLStatement;
 
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import 
org.apache.shardingsphere.distsql.parser.statement.ral.QueryableRALStatement;
+import Symbol, RALStatement;
 
-/**
- * Show traffic rules statement.
- */
-@RequiredArgsConstructor
-@Getter
-public final class ShowTrafficRulesStatement extends QueryableRALStatement {
-    
-    private final String ruleName;
-}
+execute
+    : (showTrafficRules) SEMI?
+    ;
diff --git 
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/java/org/apache/shardingsphere/traffic/distsql/parser/core/TrafficDistSQLLexer.java
similarity index 63%
copy from 
shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
copy to 
shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/java/org/apache/shardingsphere/traffic/distsql/parser/core/TrafficDistSQLLexer.java
index 0d6cda995d9..90f330f88c9 100644
--- 
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
+++ 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/java/org/apache/shardingsphere/traffic/distsql/parser/core/TrafficDistSQLLexer.java
@@ -15,18 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.distsql.parser.statement.ral.queryable;
+package org.apache.shardingsphere.traffic.distsql.parser.core;
 
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import 
org.apache.shardingsphere.distsql.parser.statement.ral.QueryableRALStatement;
+import org.antlr.v4.runtime.CharStream;
+import 
org.apache.shardingsphere.distsql.parser.autogen.TrafficDistSQLStatementLexer;
+import org.apache.shardingsphere.sql.parser.api.parser.SQLLexer;
 
 /**
- * Show traffic rules statement.
+ * SQL lexer for traffic dist SQL.
  */
-@RequiredArgsConstructor
-@Getter
-public final class ShowTrafficRulesStatement extends QueryableRALStatement {
+public final class TrafficDistSQLLexer extends TrafficDistSQLStatementLexer 
implements SQLLexer {
     
-    private final String ruleName;
+    public TrafficDistSQLLexer(final CharStream input) {
+        super(input);
+    }
 }
diff --git 
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/java/org/apache/shardingsphere/traffic/distsql/parser/core/TrafficDistSQLParser.java
similarity index 50%
copy from 
shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
copy to 
shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/java/org/apache/shardingsphere/traffic/distsql/parser/core/TrafficDistSQLParser.java
index 0d6cda995d9..8b9e83e2766 100644
--- 
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
+++ 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/java/org/apache/shardingsphere/traffic/distsql/parser/core/TrafficDistSQLParser.java
@@ -15,18 +15,26 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.distsql.parser.statement.ral.queryable;
+package org.apache.shardingsphere.traffic.distsql.parser.core;
 
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import 
org.apache.shardingsphere.distsql.parser.statement.ral.QueryableRALStatement;
+import org.antlr.v4.runtime.CommonTokenStream;
+import org.antlr.v4.runtime.TokenStream;
+import 
org.apache.shardingsphere.distsql.parser.autogen.TrafficDistSQLStatementParser;
+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;
 
 /**
- * Show traffic rules statement.
+ * SQL parser for traffic dist SQL.
  */
-@RequiredArgsConstructor
-@Getter
-public final class ShowTrafficRulesStatement extends QueryableRALStatement {
+public final class TrafficDistSQLParser extends TrafficDistSQLStatementParser 
implements SQLParser {
     
-    private final String ruleName;
+    public TrafficDistSQLParser(final TokenStream input) {
+        super(input);
+    }
+    
+    @Override
+    public ASTNode parse() {
+        return new ParseASTNode(execute(), (CommonTokenStream) 
getTokenStream());
+    }
 }
diff --git 
a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/java/org/apache/shardingsphere/traffic/distsql/parser/core/TrafficDistSQLStatementVisitor.java
 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/java/org/apache/shardingsphere/traffic/distsql/parser/core/TrafficDistSQLStatementVisitor.java
new file mode 100644
index 00000000000..bcf11128916
--- /dev/null
+++ 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/java/org/apache/shardingsphere/traffic/distsql/parser/core/TrafficDistSQLStatementVisitor.java
@@ -0,0 +1,41 @@
+/*
+ * 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.traffic.distsql.parser.core;
+
+import org.antlr.v4.runtime.tree.ParseTree;
+import 
org.apache.shardingsphere.distsql.parser.autogen.TrafficDistSQLStatementBaseVisitor;
+import 
org.apache.shardingsphere.distsql.parser.autogen.TrafficDistSQLStatementParser.ShowTrafficRulesContext;
+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.value.identifier.IdentifierValue;
+import 
org.apache.shardingsphere.traffic.distsql.parser.statement.queryable.ShowTrafficRulesStatement;
+
+/**
+ * SQL statement visitor for traffic dist SQL.
+ */
+public final class TrafficDistSQLStatementVisitor extends 
TrafficDistSQLStatementBaseVisitor<ASTNode> implements SQLVisitor {
+    
+    @Override
+    public ASTNode visitShowTrafficRules(final ShowTrafficRulesContext ctx) {
+        return new ShowTrafficRulesStatement(null == ctx.ruleName() ? null : 
getIdentifierValue(ctx.ruleName()));
+    }
+    
+    private String getIdentifierValue(final ParseTree context) {
+        return null == context ? null : new 
IdentifierValue(context.getText()).getValue();
+    }
+}
diff --git 
a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/java/org/apache/shardingsphere/traffic/distsql/parser/facade/TrafficDistSQLStatementParserFacade.java
 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/java/org/apache/shardingsphere/traffic/distsql/parser/facade/TrafficDistSQLStatementParserFacade.java
new file mode 100644
index 00000000000..5b7a54dc21b
--- /dev/null
+++ 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/java/org/apache/shardingsphere/traffic/distsql/parser/facade/TrafficDistSQLStatementParserFacade.java
@@ -0,0 +1,52 @@
+/*
+ * 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.traffic.distsql.parser.facade;
+
+import 
org.apache.shardingsphere.distsql.parser.engine.spi.FeaturedDistSQLStatementParserFacade;
+import org.apache.shardingsphere.sql.parser.api.parser.SQLLexer;
+import org.apache.shardingsphere.sql.parser.api.parser.SQLParser;
+import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
+import 
org.apache.shardingsphere.traffic.distsql.parser.core.TrafficDistSQLLexer;
+import 
org.apache.shardingsphere.traffic.distsql.parser.core.TrafficDistSQLParser;
+import 
org.apache.shardingsphere.traffic.distsql.parser.core.TrafficDistSQLStatementVisitor;
+
+/**
+ * SQL parser facade for traffic dist SQL statement.
+ */
+public final class TrafficDistSQLStatementParserFacade implements 
FeaturedDistSQLStatementParserFacade {
+    
+    @Override
+    public Class<? extends SQLLexer> getLexerClass() {
+        return TrafficDistSQLLexer.class;
+    }
+    
+    @Override
+    public Class<? extends SQLParser> getParserClass() {
+        return TrafficDistSQLParser.class;
+    }
+    
+    @Override
+    public Class<? extends SQLVisitor> getVisitorClass() {
+        return TrafficDistSQLStatementVisitor.class;
+    }
+    
+    @Override
+    public String getType() {
+        return "traffic";
+    }
+}
diff --git 
a/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.parser.engine.spi.FeaturedDistSQLStatementParserFacade
 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.parser.engine.spi.FeaturedDistSQLStatementParserFacade
new file mode 100644
index 00000000000..400af555850
--- /dev/null
+++ 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-parser/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.parser.engine.spi.FeaturedDistSQLStatementParserFacade
@@ -0,0 +1,18 @@
+#
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+org.apache.shardingsphere.traffic.distsql.parser.facade.TrafficDistSQLStatementParserFacade
diff --git a/shardingsphere-kernel/shardingsphere-traffic/pom.xml 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-statement/pom.xml
similarity index 76%
copy from shardingsphere-kernel/shardingsphere-traffic/pom.xml
copy to 
shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-statement/pom.xml
index e2a674f7749..6669b945fb1 100644
--- a/shardingsphere-kernel/shardingsphere-traffic/pom.xml
+++ 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-statement/pom.xml
@@ -21,15 +21,17 @@
     <modelVersion>4.0.0</modelVersion>
     <parent>
         <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere-kernel</artifactId>
+        <artifactId>shardingsphere-traffic-distsql</artifactId>
         <version>5.1.3-SNAPSHOT</version>
     </parent>
-    <artifactId>shardingsphere-traffic</artifactId>
-    <packaging>pom</packaging>
+    <artifactId>shardingsphere-traffic-distsql-statement</artifactId>
     <name>${project.artifactId}</name>
     
-    <modules>
-        <module>shardingsphere-traffic-api</module>
-        <module>shardingsphere-traffic-core</module>
-    </modules>
+    <dependencies>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-distsql-statement</artifactId>
+            <version>${project.version}</version>
+        </dependency>
+    </dependencies>
 </project>
diff --git 
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-statement/src/main/java/org/apache/shardingsphere/traffic/distsql/parser/statement/queryable/ShowTrafficRulesStatement.java
similarity index 84%
rename from 
shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
rename to 
shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-statement/src/main/java/org/apache/shardingsphere/traffic/distsql/parser/statement/queryable/ShowTrafficRulesStatement.java
index 0d6cda995d9..ead367ee3b9 100644
--- 
a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/queryable/ShowTrafficRulesStatement.java
+++ 
b/shardingsphere-kernel/shardingsphere-traffic/shardingsphere-traffic-distsql/shardingsphere-traffic-distsql-statement/src/main/java/org/apache/shardingsphere/traffic/distsql/parser/statement/queryable/ShowTrafficRulesStatement.java
@@ -15,18 +15,18 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.distsql.parser.statement.ral.queryable;
+package org.apache.shardingsphere.traffic.distsql.parser.statement.queryable;
 
 import lombok.Getter;
 import lombok.RequiredArgsConstructor;
-import 
org.apache.shardingsphere.distsql.parser.statement.ral.QueryableRALStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.ral.QueryableGlobalRuleRALStatement;
 
 /**
  * Show traffic rules statement.
  */
 @RequiredArgsConstructor
 @Getter
-public final class ShowTrafficRulesStatement extends QueryableRALStatement {
+public final class ShowTrafficRulesStatement extends 
QueryableGlobalRuleRALStatement {
     
     private final String ruleName;
 }
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/pom.xml 
b/shardingsphere-proxy/shardingsphere-proxy-backend/pom.xml
index 6e19186a304..b99c1ae3d65 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/pom.xml
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/pom.xml
@@ -133,6 +133,11 @@
             <artifactId>shardingsphere-authority-distsql-handler</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-traffic-distsql-handler</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
             <artifactId>shardingsphere-authority-core</artifactId>
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/RALBackendHandlerFactory.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/RALBackendHandlerFactory.java
index 67b5870db3f..ed590bb9144 100644
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/RALBackendHandlerFactory.java
+++ 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/RALBackendHandlerFactory.java
@@ -31,7 +31,6 @@ import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowMode
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowSQLParserRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowSQLTranslatorRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowTableMetadataStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowTrafficRulesStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowTransactionRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowVariableStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.scaling.QueryableScalingRALStatement;
@@ -67,7 +66,6 @@ import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.Sho
 import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowSQLParserRuleHandler;
 import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowSQLTranslatorRuleHandler;
 import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowTableMetadataHandler;
-import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowTrafficRulesHandler;
 import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowTransactionRuleHandler;
 import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowVariableHandler;
 import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.updatable.AlterSQLParserRuleHandler;
@@ -123,7 +121,6 @@ public final class RALBackendHandlerFactory {
         HANDLERS.put(ShowReadwriteSplittingReadResourcesStatement.class, 
ShowReadwriteSplittingReadResourcesHandler.class);
         HANDLERS.put(ShowSQLParserRuleStatement.class, 
ShowSQLParserRuleHandler.class);
         HANDLERS.put(ShowTableMetadataStatement.class, 
ShowTableMetadataHandler.class);
-        HANDLERS.put(ShowTrafficRulesStatement.class, 
ShowTrafficRulesHandler.class);
         HANDLERS.put(ShowTransactionRuleStatement.class, 
ShowTransactionRuleHandler.class);
         HANDLERS.put(ExportDatabaseConfigurationStatement.class, 
ExportDatabaseConfigurationHandler.class);
         HANDLERS.put(ConvertYamlConfigurationStatement.class, 
ConvertYamlConfigurationHandler.class);
diff --git 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowTrafficRulesHandler.java
 
b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowTrafficRulesHandler.java
deleted file mode 100644
index ec3a0b0bda6..00000000000
--- 
a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/ral/queryable/ShowTrafficRulesHandler.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements.  See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable;
-
-import lombok.RequiredArgsConstructor;
-import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowTrafficRulesStatement;
-import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
-import org.apache.shardingsphere.infra.util.props.PropertiesConverter;
-import org.apache.shardingsphere.mode.manager.ContextManager;
-import org.apache.shardingsphere.proxy.backend.context.ProxyContext;
-import 
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.QueryableRALBackendHandler;
-import 
org.apache.shardingsphere.traffic.api.config.TrafficStrategyConfiguration;
-import org.apache.shardingsphere.traffic.rule.TrafficRule;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.LinkedList;
-import java.util.Map;
-import java.util.Optional;
-
-/**
- * Show traffic rules handler.
- */
-@RequiredArgsConstructor
-public final class ShowTrafficRulesHandler extends 
QueryableRALBackendHandler<ShowTrafficRulesStatement> {
-    
-    private static final String RULE_NAME = "name";
-    
-    private static final String LABELS = "labels";
-    
-    private static final String ALGORITHM_TYPE = "algorithm_type";
-    
-    private static final String ALGORITHM_PROPS = "algorithm_props";
-    
-    private static final String LOAD_BALANCER_TYPE = "load_balancer_type";
-    
-    private static final String LOAD_BALANCER_PROPS = "load_balancer_props";
-    
-    @Override
-    protected Collection<String> getColumnNames() {
-        return Arrays.asList(RULE_NAME, LABELS, ALGORITHM_TYPE, 
ALGORITHM_PROPS, LOAD_BALANCER_TYPE, LOAD_BALANCER_PROPS);
-    }
-    
-    @Override
-    protected Collection<LocalDataQueryResultRow> getRows(final ContextManager 
contextManager) {
-        TrafficRule rule = 
ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getGlobalRuleMetaData().getSingleRule(TrafficRule.class);
-        Collection<LocalDataQueryResultRow> result = new LinkedList<>();
-        Optional<String> ruleName = 
Optional.ofNullable(getSqlStatement().getRuleName());
-        Map<String, AlgorithmConfiguration> trafficAlgorithms = 
rule.getConfiguration().getTrafficAlgorithms();
-        Map<String, AlgorithmConfiguration> loadBalancers = 
rule.getConfiguration().getLoadBalancers();
-        rule.getConfiguration().getTrafficStrategies().stream().filter(each -> 
!ruleName.isPresent() || each.getName().equals(ruleName.get()))
-                .forEach(each -> result.add(buildRow(each, 
trafficAlgorithms.get(each.getAlgorithmName()), 
loadBalancers.get(each.getLoadBalancerName()))));
-        return result;
-    }
-    
-    private LocalDataQueryResultRow buildRow(final 
TrafficStrategyConfiguration strategy,
-                                             final AlgorithmConfiguration 
trafficAlgorithm, final AlgorithmConfiguration loadBalancer) {
-        return new LocalDataQueryResultRow(strategy.getName(), 
String.join(",", strategy.getLabels()), null != trafficAlgorithm ? 
trafficAlgorithm.getType() : "",
-                null != trafficAlgorithm ? 
PropertiesConverter.convert(trafficAlgorithm.getProps()) : "", null != 
loadBalancer ? loadBalancer.getType() : "",
-                null != loadBalancer ? 
PropertiesConverter.convert(loadBalancer.getProps()) : "");
-    }
-}
diff --git a/shardingsphere-test/shardingsphere-parser-test/pom.xml 
b/shardingsphere-test/shardingsphere-parser-test/pom.xml
index 1b71bb31fa0..0854489ce5a 100644
--- a/shardingsphere-test/shardingsphere-parser-test/pom.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/pom.xml
@@ -77,6 +77,11 @@
             <artifactId>shardingsphere-authority-distsql-parser</artifactId>
             <version>${project.version}</version>
         </dependency>
+        <dependency>
+            <groupId>org.apache.shardingsphere</groupId>
+            <artifactId>shardingsphere-traffic-distsql-parser</artifactId>
+            <version>${project.version}</version>
+        </dependency>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
             <artifactId>shardingsphere-shadow-distsql-parser</artifactId>
diff --git 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/QueryableRALStatementAssert.java
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/QueryableRALStatementAssert.java
index 241bc7633f9..20c96a6d999 100644
--- 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/QueryableRALStatementAssert.java
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/QueryableRALStatementAssert.java
@@ -29,7 +29,6 @@ import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowMode
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowSQLParserRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowSQLTranslatorRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowTableMetadataStatement;
-import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowTrafficRulesStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowTransactionRuleStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowVariableStatement;
 import 
org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.ShowReadwriteSplittingReadResourcesStatement;
@@ -61,6 +60,7 @@ import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowTrafficRulesStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowTransactionRuleStatementTestCase;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowVariableStatementTestCase;
+import 
org.apache.shardingsphere.traffic.distsql.parser.statement.queryable.ShowTrafficRulesStatement;
 
 /**
  * Queryable RAL statement assert.
diff --git 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/queryable/ShowTrafficRulesStatementAssert.java
 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/queryable/ShowTrafficRulesStatementAssert.java
index c7232e39fde..8a30f00d6c6 100644
--- 
a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/queryable/ShowTrafficRulesStatementAssert.java
+++ 
b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/ral/impl/queryable/ShowTrafficRulesStatementAssert.java
@@ -19,9 +19,9 @@ package 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statemen
 
 import lombok.AccessLevel;
 import lombok.NoArgsConstructor;
-import 
org.apache.shardingsphere.distsql.parser.statement.ral.queryable.ShowTrafficRulesStatement;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
 import 
org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.ral.ShowTrafficRulesStatementTestCase;
+import 
org.apache.shardingsphere.traffic.distsql.parser.statement.queryable.ShowTrafficRulesStatement;
 
 import static org.hamcrest.CoreMatchers.is;
 import static org.junit.Assert.assertNotNull;

Reply via email to