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

chengzhang 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 e3ed36ba559 Add CountResultRowBuilder (#29723)
e3ed36ba559 is described below

commit e3ed36ba559cb375e2815a6777fa35d531b02379
Author: Liang Zhang <[email protected]>
AuthorDate: Mon Jan 15 10:04:35 2024 +0800

    Add CountResultRowBuilder (#29723)
    
    * Add CountResultRowBuilder
    
    * Add CountResultRowBuilder
    
    * Add CountResultRowBuilder
---
 ...or.java => BroadcastCountResultRowBuilder.java} | 20 ++---
 ...dingsphere.distsql.handler.type.rql.RQLExecutor |  1 -
 ...l.handler.type.rql.count.CountResultRowBuilder} |  3 +-
 .../query/CountBroadcastRuleExecutorTest.java      | 76 ------------------
 .../core/BroadcastDistSQLStatementVisitor.java     |  4 +-
 .../statement/CountBroadcastRuleStatement.java     | 31 --------
 ...utor.java => EncryptCountResultRowBuilder.java} | 20 ++---
 ...dingsphere.distsql.handler.type.rql.RQLExecutor |  1 -
 ...l.handler.type.rql.count.CountResultRowBuilder} |  3 +-
 .../query/CountEncryptRuleExecutorTest.java        | 76 ------------------
 .../core/EncryptDistSQLStatementVisitor.java       |  4 +-
 .../statement/CountEncryptRuleStatement.java       | 31 --------
 ...xecutor.java => MaskCountResultRowBuilder.java} | 20 ++---
 ...dingsphere.distsql.handler.type.rql.RQLExecutor |  1 -
 ...l.handler.type.rql.count.CountResultRowBuilder} |  3 +-
 .../handler/query/CountMaskRuleExecutorTest.java   | 76 ------------------
 .../parser/core/MaskDistSQLStatementVisitor.java   |  4 +-
 .../distsql/statement/CountMaskRuleStatement.java  | 31 --------
 ...> ReadwriteSplittingCountResultRowBuilder.java} | 20 ++---
 ...dingsphere.distsql.handler.type.rql.RQLExecutor |  1 -
 ...l.handler.type.rql.count.CountResultRowBuilder} |  3 +-
 .../CountReadwriteSplittingRuleExecutorTest.java   | 74 ------------------
 .../ReadwriteSplittingDistSQLStatementVisitor.java |  4 +-
 .../CountReadwriteSplittingRuleStatement.java      | 31 --------
 ...cutor.java => ShadowCountResultRowBuilder.java} | 20 ++---
 ...dingsphere.distsql.handler.type.rql.RQLExecutor |  1 -
 ...l.handler.type.rql.count.CountResultRowBuilder} |  3 +-
 .../distsql/query/CountShadowRuleExecutorTest.java | 80 -------------------
 .../parser/core/ShadowDistSQLStatementVisitor.java |  6 +-
 ...tor.java => ShardingCountResultRowBuilder.java} | 22 +++---
 ...dingsphere.distsql.handler.type.rql.RQLExecutor |  1 -
 ...l.handler.type.rql.count.CountResultRowBuilder} |  3 +-
 .../query/CountShardingRuleExecutorTest.java       | 90 ----------------------
 .../core/ShardingDistSQLStatementVisitor.java      |  4 +-
 .../type/rql/{ => count}/CountRQLExecutor.java     | 34 ++++----
 .../type/rql/count/CountResultRowBuilder.java      | 41 ++++++----
 ...dingsphere.distsql.handler.type.rql.RQLExecutor |  3 +-
 ...cutor.java => SingleCountResultRowBuilder.java} | 20 ++---
 ...dingsphere.distsql.handler.type.rql.RQLExecutor |  1 -
 ...ql.handler.type.rql.count.CountResultRowBuilder |  3 +-
 .../query/CountSingleTableExecutorTest.java        | 77 ------------------
 .../parser/core/SingleDistSQLStatementVisitor.java |  4 +-
 .../statement/rql/show/CountRuleStatement.java     | 14 ++--
 .../cases/rql/dataset/db/count_single_table.xml    |  3 +-
 .../count_single_table.xml                         |  3 +-
 .../count_single_table.xml                         |  3 +-
 .../rql/dataset/encrypt/count_single_table.xml     |  3 +-
 .../count_single_table.xml                         |  3 +-
 .../sharding_and_encrypt/count_single_table.xml    |  3 +-
 .../cases/rql/dataset/tbl/count_single_table.xml   |  3 +-
 50 files changed, 157 insertions(+), 829 deletions(-)

diff --git 
a/features/broadcast/distsql/handler/src/main/java/org/apache/shardingsphere/broadcast/distsql/handler/query/CountBroadcastRuleExecutor.java
 
b/features/broadcast/distsql/handler/src/main/java/org/apache/shardingsphere/broadcast/distsql/handler/query/BroadcastCountResultRowBuilder.java
similarity index 67%
rename from 
features/broadcast/distsql/handler/src/main/java/org/apache/shardingsphere/broadcast/distsql/handler/query/CountBroadcastRuleExecutor.java
rename to 
features/broadcast/distsql/handler/src/main/java/org/apache/shardingsphere/broadcast/distsql/handler/query/BroadcastCountResultRowBuilder.java
index b336c0fbeb0..87de473eea3 100644
--- 
a/features/broadcast/distsql/handler/src/main/java/org/apache/shardingsphere/broadcast/distsql/handler/query/CountBroadcastRuleExecutor.java
+++ 
b/features/broadcast/distsql/handler/src/main/java/org/apache/shardingsphere/broadcast/distsql/handler/query/BroadcastCountResultRowBuilder.java
@@ -17,30 +17,30 @@
 
 package org.apache.shardingsphere.broadcast.distsql.handler.query;
 
-import 
org.apache.shardingsphere.broadcast.distsql.statement.CountBroadcastRuleStatement;
 import org.apache.shardingsphere.broadcast.rule.BroadcastRule;
-import org.apache.shardingsphere.distsql.handler.type.rql.CountRQLExecutor;
+import 
org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder;
 import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
 
 import java.util.Collection;
 import java.util.Collections;
 
 /**
- * Count broadcast rule executor.
+ * Broadcast count result row builder.
  */
-public final class CountBroadcastRuleExecutor extends 
CountRQLExecutor<CountBroadcastRuleStatement, BroadcastRule> {
+public final class BroadcastCountResultRowBuilder implements 
CountResultRowBuilder<BroadcastRule> {
     
-    public CountBroadcastRuleExecutor() {
-        super(BroadcastRule.class);
+    @Override
+    public Collection<LocalDataQueryResultRow> generateRows(final 
BroadcastRule rule, final String databaseName) {
+        return Collections.singleton(new 
LocalDataQueryResultRow("broadcast_table", databaseName, 
rule.getConfiguration().getTables().size()));
     }
     
     @Override
-    protected Collection<LocalDataQueryResultRow> generateRows(final 
BroadcastRule rule, final String databaseName) {
-        return Collections.singleton(new 
LocalDataQueryResultRow("broadcast_table", databaseName, 
rule.getConfiguration().getTables().size()));
+    public Class<BroadcastRule> getRuleClass() {
+        return BroadcastRule.class;
     }
     
     @Override
-    public Class<CountBroadcastRuleStatement> getType() {
-        return CountBroadcastRuleStatement.class;
+    public String getType() {
+        return "BROADCAST";
     }
 }
diff --git 
a/features/broadcast/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
 
b/features/broadcast/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
index 2b9dc501453..397e9b8fb0e 100644
--- 
a/features/broadcast/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
+++ 
b/features/broadcast/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
@@ -16,4 +16,3 @@
 #
 
 
org.apache.shardingsphere.broadcast.distsql.handler.query.ShowBroadcastTableRuleExecutor
-org.apache.shardingsphere.broadcast.distsql.handler.query.CountBroadcastRuleExecutor
diff --git 
a/features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
 
b/features/broadcast/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
similarity index 84%
copy from 
features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
copy to 
features/broadcast/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
index 95a3cb562dd..4c69e312b9c 100644
--- 
a/features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
+++ 
b/features/broadcast/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
@@ -15,5 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.mask.distsql.handler.query.ShowMaskRuleExecutor
-org.apache.shardingsphere.mask.distsql.handler.query.CountMaskRuleExecutor
+org.apache.shardingsphere.broadcast.distsql.handler.query.BroadcastCountResultRowBuilder
diff --git 
a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/query/CountBroadcastRuleExecutorTest.java
 
b/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/query/CountBroadcastRuleExecutorTest.java
deleted file mode 100644
index 68835304525..00000000000
--- 
a/features/broadcast/distsql/handler/src/test/java/org/apache/shardingsphere/broadcast/distsql/handler/query/CountBroadcastRuleExecutorTest.java
+++ /dev/null
@@ -1,76 +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.broadcast.distsql.handler.query;
-
-import 
org.apache.shardingsphere.broadcast.api.config.BroadcastRuleConfiguration;
-import 
org.apache.shardingsphere.broadcast.distsql.statement.CountBroadcastRuleStatement;
-import org.apache.shardingsphere.broadcast.rule.BroadcastRule;
-import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
-import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
-import org.junit.jupiter.api.Test;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-class CountBroadcastRuleExecutorTest {
-    
-    @Test
-    void assertGetRowData() {
-        Collection<LocalDataQueryResultRow> actual = new 
CountBroadcastRuleExecutor().getRows(mockDatabase(), 
mock(CountBroadcastRuleStatement.class));
-        assertThat(actual.size(), is(1));
-        Iterator<LocalDataQueryResultRow> iterator = actual.iterator();
-        LocalDataQueryResultRow row = iterator.next();
-        assertThat(row.getCell(1), is("broadcast_table"));
-        assertThat(row.getCell(2), is("sharding_db"));
-        assertThat(row.getCell(3), is(1));
-    }
-    
-    @Test
-    void assertGetColumnNames() {
-        Collection<String> columns = new 
CountBroadcastRuleExecutor().getColumnNames();
-        assertThat(columns.size(), is(3));
-        Iterator<String> iterator = columns.iterator();
-        assertThat(iterator.next(), is("rule_name"));
-        assertThat(iterator.next(), is("database"));
-        assertThat(iterator.next(), is("count"));
-    }
-    
-    private ShardingSphereDatabase mockDatabase() {
-        ShardingSphereDatabase result = mock(ShardingSphereDatabase.class, 
RETURNS_DEEP_STUBS);
-        when(result.getName()).thenReturn("sharding_db");
-        RuleMetaData ruleMetaData = new 
RuleMetaData(Collections.singleton(mockBroadcastRule()));
-        when(result.getRuleMetaData()).thenReturn(ruleMetaData);
-        return result;
-    }
-    
-    private BroadcastRule mockBroadcastRule() {
-        BroadcastRule result = mock(BroadcastRule.class);
-        BroadcastRuleConfiguration config = 
mock(BroadcastRuleConfiguration.class);
-        
when(config.getTables()).thenReturn(Collections.singleton("t_address"));
-        when(result.getConfiguration()).thenReturn(config);
-        return result;
-    }
-}
diff --git 
a/features/broadcast/distsql/parser/src/main/java/org/apache/shardingsphere/broadcast/distsql/parser/core/BroadcastDistSQLStatementVisitor.java
 
b/features/broadcast/distsql/parser/src/main/java/org/apache/shardingsphere/broadcast/distsql/parser/core/BroadcastDistSQLStatementVisitor.java
index 4880c73ecd5..a0a163078d8 100644
--- 
a/features/broadcast/distsql/parser/src/main/java/org/apache/shardingsphere/broadcast/distsql/parser/core/BroadcastDistSQLStatementVisitor.java
+++ 
b/features/broadcast/distsql/parser/src/main/java/org/apache/shardingsphere/broadcast/distsql/parser/core/BroadcastDistSQLStatementVisitor.java
@@ -18,7 +18,6 @@
 package org.apache.shardingsphere.broadcast.distsql.parser.core;
 
 import org.antlr.v4.runtime.tree.ParseTree;
-import 
org.apache.shardingsphere.broadcast.distsql.statement.CountBroadcastRuleStatement;
 import 
org.apache.shardingsphere.broadcast.distsql.statement.CreateBroadcastTableRuleStatement;
 import 
org.apache.shardingsphere.broadcast.distsql.statement.DropBroadcastTableRuleStatement;
 import 
org.apache.shardingsphere.broadcast.distsql.statement.ShowBroadcastTableRulesStatement;
@@ -28,6 +27,7 @@ import 
org.apache.shardingsphere.distsql.parser.autogen.BroadcastDistSQLStatemen
 import 
org.apache.shardingsphere.distsql.parser.autogen.BroadcastDistSQLStatementParser.DatabaseNameContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.BroadcastDistSQLStatementParser.DropBroadcastTableRuleContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.BroadcastDistSQLStatementParser.ShowBroadcastTableRulesContext;
+import org.apache.shardingsphere.distsql.statement.rql.show.CountRuleStatement;
 import org.apache.shardingsphere.sql.parser.api.ASTNode;
 import org.apache.shardingsphere.sql.parser.api.visitor.SQLVisitor;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.DatabaseSegment;
@@ -59,7 +59,7 @@ public final class BroadcastDistSQLStatementVisitor extends 
BroadcastDistSQLStat
     
     @Override
     public ASTNode visitCountBroadcastRule(final CountBroadcastRuleContext 
ctx) {
-        return new CountBroadcastRuleStatement(null == ctx.databaseName() ? 
null : (DatabaseSegment) visit(ctx.databaseName()));
+        return new CountRuleStatement(null == ctx.databaseName() ? null : 
(DatabaseSegment) visit(ctx.databaseName()), "BROADCAST");
     }
     
     @Override
diff --git 
a/features/broadcast/distsql/statement/src/main/java/org/apache/shardingsphere/broadcast/distsql/statement/CountBroadcastRuleStatement.java
 
b/features/broadcast/distsql/statement/src/main/java/org/apache/shardingsphere/broadcast/distsql/statement/CountBroadcastRuleStatement.java
deleted file mode 100644
index c4832062b2a..00000000000
--- 
a/features/broadcast/distsql/statement/src/main/java/org/apache/shardingsphere/broadcast/distsql/statement/CountBroadcastRuleStatement.java
+++ /dev/null
@@ -1,31 +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.broadcast.distsql.statement;
-
-import org.apache.shardingsphere.distsql.statement.rql.show.ShowRulesStatement;
-import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.DatabaseSegment;
-
-/**
- * Count broadcast rule statement.
- */
-public final class CountBroadcastRuleStatement extends ShowRulesStatement {
-    
-    public CountBroadcastRuleStatement(final DatabaseSegment database) {
-        super(database);
-    }
-}
diff --git 
a/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/CountEncryptRuleExecutor.java
 
b/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/EncryptCountResultRowBuilder.java
similarity index 68%
rename from 
features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/CountEncryptRuleExecutor.java
rename to 
features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/EncryptCountResultRowBuilder.java
index 37cc9ef17d7..71898f2e662 100644
--- 
a/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/CountEncryptRuleExecutor.java
+++ 
b/features/encrypt/distsql/handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/query/EncryptCountResultRowBuilder.java
@@ -17,8 +17,7 @@
 
 package org.apache.shardingsphere.encrypt.distsql.handler.query;
 
-import org.apache.shardingsphere.distsql.handler.type.rql.CountRQLExecutor;
-import 
org.apache.shardingsphere.encrypt.distsql.statement.CountEncryptRuleStatement;
+import 
org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder;
 import org.apache.shardingsphere.encrypt.rule.EncryptRule;
 import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
 
@@ -26,21 +25,22 @@ import java.util.Collection;
 import java.util.Collections;
 
 /**
- * Count encrypt rule executor.
+ * Encrypt count result row builder.
  */
-public final class CountEncryptRuleExecutor extends 
CountRQLExecutor<CountEncryptRuleStatement, EncryptRule> {
+public final class EncryptCountResultRowBuilder implements 
CountResultRowBuilder<EncryptRule> {
     
-    public CountEncryptRuleExecutor() {
-        super(EncryptRule.class);
+    @Override
+    public Collection<LocalDataQueryResultRow> generateRows(final EncryptRule 
rule, final String databaseName) {
+        return Collections.singleton(new LocalDataQueryResultRow("encrypt", 
databaseName, rule.getLogicTableMapper().getTableNames().size()));
     }
     
     @Override
-    protected Collection<LocalDataQueryResultRow> generateRows(final 
EncryptRule rule, final String databaseName) {
-        return Collections.singleton(new LocalDataQueryResultRow("encrypt", 
databaseName, rule.getLogicTableMapper().getTableNames().size()));
+    public Class<EncryptRule> getRuleClass() {
+        return EncryptRule.class;
     }
     
     @Override
-    public Class<CountEncryptRuleStatement> getType() {
-        return CountEncryptRuleStatement.class;
+    public String getType() {
+        return "ENCRYPT";
     }
 }
diff --git 
a/features/encrypt/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
 
b/features/encrypt/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
index 0c1a17ccaff..45f51c9169f 100644
--- 
a/features/encrypt/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
+++ 
b/features/encrypt/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
@@ -16,4 +16,3 @@
 #
 
 org.apache.shardingsphere.encrypt.distsql.handler.query.ShowEncryptRuleExecutor
-org.apache.shardingsphere.encrypt.distsql.handler.query.CountEncryptRuleExecutor
diff --git 
a/features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
 
b/features/encrypt/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
similarity index 84%
copy from 
features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
copy to 
features/encrypt/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
index 95a3cb562dd..5f0a97d3139 100644
--- 
a/features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
+++ 
b/features/encrypt/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
@@ -15,5 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.mask.distsql.handler.query.ShowMaskRuleExecutor
-org.apache.shardingsphere.mask.distsql.handler.query.CountMaskRuleExecutor
+org.apache.shardingsphere.encrypt.distsql.handler.query.EncryptCountResultRowBuilder
diff --git 
a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/query/CountEncryptRuleExecutorTest.java
 
b/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/query/CountEncryptRuleExecutorTest.java
deleted file mode 100644
index dc12e0362d2..00000000000
--- 
a/features/encrypt/distsql/handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/query/CountEncryptRuleExecutorTest.java
+++ /dev/null
@@ -1,76 +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.encrypt.distsql.handler.query;
-
-import 
org.apache.shardingsphere.encrypt.distsql.statement.CountEncryptRuleStatement;
-import org.apache.shardingsphere.encrypt.rule.EncryptRule;
-import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
-import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
-import org.apache.shardingsphere.infra.rule.identifier.type.TableNamesMapper;
-import org.junit.jupiter.api.Test;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-class CountEncryptRuleExecutorTest {
-    
-    @Test
-    void assertGetRowData() {
-        Collection<LocalDataQueryResultRow> actual = new 
CountEncryptRuleExecutor().getRows(mockDatabase(), 
mock(CountEncryptRuleStatement.class));
-        assertThat(actual.size(), is(1));
-        Iterator<LocalDataQueryResultRow> iterator = actual.iterator();
-        LocalDataQueryResultRow row = iterator.next();
-        assertThat(row.getCell(1), is("encrypt"));
-        assertThat(row.getCell(2), is("db_1"));
-        assertThat(row.getCell(3), is(1));
-    }
-    
-    @Test
-    void assertGetColumnNames() {
-        Collection<String> columns = new 
CountEncryptRuleExecutor().getColumnNames();
-        assertThat(columns.size(), is(3));
-        Iterator<String> iterator = columns.iterator();
-        assertThat(iterator.next(), is("rule_name"));
-        assertThat(iterator.next(), is("database"));
-        assertThat(iterator.next(), is("count"));
-    }
-    
-    private ShardingSphereDatabase mockDatabase() {
-        ShardingSphereDatabase result = mock(ShardingSphereDatabase.class, 
RETURNS_DEEP_STUBS);
-        when(result.getName()).thenReturn("db_1");
-        RuleMetaData ruleMetaData = new 
RuleMetaData(Collections.singleton(mockEncryptRule()));
-        when(result.getRuleMetaData()).thenReturn(ruleMetaData);
-        return result;
-    }
-    
-    private EncryptRule mockEncryptRule() {
-        EncryptRule result = mock(EncryptRule.class);
-        TableNamesMapper tableNamesMapper = new TableNamesMapper();
-        tableNamesMapper.put("encrypt_table");
-        when(result.getLogicTableMapper()).thenReturn(tableNamesMapper);
-        return result;
-    }
-}
diff --git 
a/features/encrypt/distsql/parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/core/EncryptDistSQLStatementVisitor.java
 
b/features/encrypt/distsql/parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/core/EncryptDistSQLStatementVisitor.java
index 20ebecc409b..1c9a757ae5f 100644
--- 
a/features/encrypt/distsql/parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/core/EncryptDistSQLStatementVisitor.java
+++ 
b/features/encrypt/distsql/parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/core/EncryptDistSQLStatementVisitor.java
@@ -33,11 +33,11 @@ import 
org.apache.shardingsphere.distsql.parser.autogen.EncryptDistSQLStatementP
 import 
org.apache.shardingsphere.distsql.parser.autogen.EncryptDistSQLStatementParser.ShowEncryptRulesContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.EncryptDistSQLStatementParser.TableNameContext;
 import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
+import org.apache.shardingsphere.distsql.statement.rql.show.CountRuleStatement;
 import 
org.apache.shardingsphere.encrypt.distsql.segment.EncryptColumnItemSegment;
 import org.apache.shardingsphere.encrypt.distsql.segment.EncryptColumnSegment;
 import org.apache.shardingsphere.encrypt.distsql.segment.EncryptRuleSegment;
 import 
org.apache.shardingsphere.encrypt.distsql.statement.AlterEncryptRuleStatement;
-import 
org.apache.shardingsphere.encrypt.distsql.statement.CountEncryptRuleStatement;
 import 
org.apache.shardingsphere.encrypt.distsql.statement.CreateEncryptRuleStatement;
 import 
org.apache.shardingsphere.encrypt.distsql.statement.DropEncryptRuleStatement;
 import 
org.apache.shardingsphere.encrypt.distsql.statement.ShowEncryptAlgorithmImplementationsStatement;
@@ -137,7 +137,7 @@ public final class EncryptDistSQLStatementVisitor extends 
EncryptDistSQLStatemen
     
     @Override
     public ASTNode visitCountEncryptRule(final CountEncryptRuleContext ctx) {
-        return new CountEncryptRuleStatement(null == ctx.databaseName() ? null 
: (DatabaseSegment) visit(ctx.databaseName()));
+        return new CountRuleStatement(null == ctx.databaseName() ? null : 
(DatabaseSegment) visit(ctx.databaseName()), "ENCRYPT");
     }
     
     @Override
diff --git 
a/features/encrypt/distsql/statement/src/main/java/org/apache/shardingsphere/encrypt/distsql/statement/CountEncryptRuleStatement.java
 
b/features/encrypt/distsql/statement/src/main/java/org/apache/shardingsphere/encrypt/distsql/statement/CountEncryptRuleStatement.java
deleted file mode 100644
index 19fb939dd44..00000000000
--- 
a/features/encrypt/distsql/statement/src/main/java/org/apache/shardingsphere/encrypt/distsql/statement/CountEncryptRuleStatement.java
+++ /dev/null
@@ -1,31 +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.encrypt.distsql.statement;
-
-import org.apache.shardingsphere.distsql.statement.rql.show.ShowRulesStatement;
-import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.DatabaseSegment;
-
-/**
- * Count encrypt rule statement.
- */
-public final class CountEncryptRuleStatement extends ShowRulesStatement {
-    
-    public CountEncryptRuleStatement(final DatabaseSegment database) {
-        super(database);
-    }
-}
diff --git 
a/features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/CountMaskRuleExecutor.java
 
b/features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/MaskCountResultRowBuilder.java
similarity index 69%
copy from 
features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/CountMaskRuleExecutor.java
copy to 
features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/MaskCountResultRowBuilder.java
index 62e1b0f5650..2b50bdca9ef 100644
--- 
a/features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/CountMaskRuleExecutor.java
+++ 
b/features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/MaskCountResultRowBuilder.java
@@ -17,30 +17,30 @@
 
 package org.apache.shardingsphere.mask.distsql.handler.query;
 
-import org.apache.shardingsphere.distsql.handler.type.rql.CountRQLExecutor;
+import 
org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder;
 import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
-import org.apache.shardingsphere.mask.distsql.statement.CountMaskRuleStatement;
 import org.apache.shardingsphere.mask.rule.MaskRule;
 
 import java.util.Collection;
 import java.util.Collections;
 
 /**
- * Count mask rule executor.
+ * Mask count result row builder.
  */
-public final class CountMaskRuleExecutor extends 
CountRQLExecutor<CountMaskRuleStatement, MaskRule> {
+public final class MaskCountResultRowBuilder implements 
CountResultRowBuilder<MaskRule> {
     
-    public CountMaskRuleExecutor() {
-        super(MaskRule.class);
+    @Override
+    public Collection<LocalDataQueryResultRow> generateRows(final MaskRule 
rule, final String databaseName) {
+        return Collections.singleton(new LocalDataQueryResultRow("mask", 
databaseName, rule.getLogicTableMapper().getTableNames().size()));
     }
     
     @Override
-    protected Collection<LocalDataQueryResultRow> generateRows(final MaskRule 
rule, final String databaseName) {
-        return Collections.singleton(new LocalDataQueryResultRow("mask", 
databaseName, rule.getLogicTableMapper().getTableNames().size()));
+    public Class<MaskRule> getRuleClass() {
+        return MaskRule.class;
     }
     
     @Override
-    public Class<CountMaskRuleStatement> getType() {
-        return CountMaskRuleStatement.class;
+    public String getType() {
+        return "MASK";
     }
 }
diff --git 
a/features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
 
b/features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
index 95a3cb562dd..91d46e793cb 100644
--- 
a/features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
+++ 
b/features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
@@ -16,4 +16,3 @@
 #
 
 org.apache.shardingsphere.mask.distsql.handler.query.ShowMaskRuleExecutor
-org.apache.shardingsphere.mask.distsql.handler.query.CountMaskRuleExecutor
diff --git 
a/features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
 
b/features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
similarity index 84%
copy from 
features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
copy to 
features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
index 95a3cb562dd..6ee02931f15 100644
--- 
a/features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
+++ 
b/features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
@@ -15,5 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.mask.distsql.handler.query.ShowMaskRuleExecutor
-org.apache.shardingsphere.mask.distsql.handler.query.CountMaskRuleExecutor
+org.apache.shardingsphere.mask.distsql.handler.query.MaskCountResultRowBuilder
diff --git 
a/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/query/CountMaskRuleExecutorTest.java
 
b/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/query/CountMaskRuleExecutorTest.java
deleted file mode 100644
index acdd8d1af3a..00000000000
--- 
a/features/mask/distsql/handler/src/test/java/org/apache/shardingsphere/mask/distsql/handler/query/CountMaskRuleExecutorTest.java
+++ /dev/null
@@ -1,76 +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.mask.distsql.handler.query;
-
-import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
-import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
-import org.apache.shardingsphere.infra.rule.identifier.type.TableNamesMapper;
-import org.apache.shardingsphere.mask.distsql.statement.CountMaskRuleStatement;
-import org.apache.shardingsphere.mask.rule.MaskRule;
-import org.junit.jupiter.api.Test;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-class CountMaskRuleExecutorTest {
-    
-    @Test
-    void assertGetRowData() {
-        Collection<LocalDataQueryResultRow> actual = new 
CountMaskRuleExecutor().getRows(mockDatabase(), 
mock(CountMaskRuleStatement.class));
-        assertThat(actual.size(), is(1));
-        Iterator<LocalDataQueryResultRow> iterator = actual.iterator();
-        LocalDataQueryResultRow row = iterator.next();
-        assertThat(row.getCell(1), is("mask"));
-        assertThat(row.getCell(2), is("mask_db"));
-        assertThat(row.getCell(3), is(1));
-    }
-    
-    @Test
-    void assertGetColumnNames() {
-        Collection<String> columns = new 
CountMaskRuleExecutor().getColumnNames();
-        assertThat(columns.size(), is(3));
-        Iterator<String> iterator = columns.iterator();
-        assertThat(iterator.next(), is("rule_name"));
-        assertThat(iterator.next(), is("database"));
-        assertThat(iterator.next(), is("count"));
-    }
-    
-    private ShardingSphereDatabase mockDatabase() {
-        ShardingSphereDatabase result = mock(ShardingSphereDatabase.class, 
RETURNS_DEEP_STUBS);
-        when(result.getName()).thenReturn("mask_db");
-        RuleMetaData ruleMetaData = new 
RuleMetaData(Collections.singleton(mockMaskRule()));
-        when(result.getRuleMetaData()).thenReturn(ruleMetaData);
-        return result;
-    }
-    
-    private MaskRule mockMaskRule() {
-        MaskRule result = mock(MaskRule.class);
-        TableNamesMapper tableNamesMapper = new TableNamesMapper();
-        tableNamesMapper.put("mask_table");
-        when(result.getLogicTableMapper()).thenReturn(tableNamesMapper);
-        return result;
-    }
-}
diff --git 
a/features/mask/distsql/parser/src/main/java/org/apache/shardingsphere/mask/distsql/parser/core/MaskDistSQLStatementVisitor.java
 
b/features/mask/distsql/parser/src/main/java/org/apache/shardingsphere/mask/distsql/parser/core/MaskDistSQLStatementVisitor.java
index b1bc3f8f25d..894cc18de0f 100644
--- 
a/features/mask/distsql/parser/src/main/java/org/apache/shardingsphere/mask/distsql/parser/core/MaskDistSQLStatementVisitor.java
+++ 
b/features/mask/distsql/parser/src/main/java/org/apache/shardingsphere/mask/distsql/parser/core/MaskDistSQLStatementVisitor.java
@@ -32,10 +32,10 @@ import 
org.apache.shardingsphere.distsql.parser.autogen.MaskDistSQLStatementPars
 import 
org.apache.shardingsphere.distsql.parser.autogen.MaskDistSQLStatementParser.ShowMaskAlgorithmImplementationsContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.MaskDistSQLStatementParser.ShowMaskRulesContext;
 import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
+import org.apache.shardingsphere.distsql.statement.rql.show.CountRuleStatement;
 import org.apache.shardingsphere.mask.distsql.segment.MaskColumnSegment;
 import org.apache.shardingsphere.mask.distsql.segment.MaskRuleSegment;
 import org.apache.shardingsphere.mask.distsql.statement.AlterMaskRuleStatement;
-import org.apache.shardingsphere.mask.distsql.statement.CountMaskRuleStatement;
 import 
org.apache.shardingsphere.mask.distsql.statement.CreateMaskRuleStatement;
 import org.apache.shardingsphere.mask.distsql.statement.DropMaskRuleStatement;
 import 
org.apache.shardingsphere.mask.distsql.statement.ShowMaskAlgorithmImplementationsStatement;
@@ -76,7 +76,7 @@ public final class MaskDistSQLStatementVisitor extends 
MaskDistSQLStatementBaseV
     
     @Override
     public ASTNode visitCountMaskRule(final CountMaskRuleContext ctx) {
-        return new CountMaskRuleStatement(null == ctx.databaseName() ? null : 
(DatabaseSegment) visit(ctx.databaseName()));
+        return new CountRuleStatement(null == ctx.databaseName() ? null : 
(DatabaseSegment) visit(ctx.databaseName()), "MASK");
     }
     
     @Override
diff --git 
a/features/mask/distsql/statement/src/main/java/org/apache/shardingsphere/mask/distsql/statement/CountMaskRuleStatement.java
 
b/features/mask/distsql/statement/src/main/java/org/apache/shardingsphere/mask/distsql/statement/CountMaskRuleStatement.java
deleted file mode 100644
index 564fc8ce291..00000000000
--- 
a/features/mask/distsql/statement/src/main/java/org/apache/shardingsphere/mask/distsql/statement/CountMaskRuleStatement.java
+++ /dev/null
@@ -1,31 +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.mask.distsql.statement;
-
-import org.apache.shardingsphere.distsql.statement.rql.show.ShowRulesStatement;
-import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.DatabaseSegment;
-
-/**
- * Count mask rule statement.
- */
-public final class CountMaskRuleStatement extends ShowRulesStatement {
-    
-    public CountMaskRuleStatement(final DatabaseSegment database) {
-        super(database);
-    }
-}
diff --git 
a/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/CountReadwriteSplittingRuleExecutor.java
 
b/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ReadwriteSplittingCountResultRowBuilder.java
similarity index 64%
rename from 
features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/CountReadwriteSplittingRuleExecutor.java
rename to 
features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ReadwriteSplittingCountResultRowBuilder.java
index 52d2fae063f..ab2f15ef8a7 100644
--- 
a/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/CountReadwriteSplittingRuleExecutor.java
+++ 
b/features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ReadwriteSplittingCountResultRowBuilder.java
@@ -17,30 +17,30 @@
 
 package org.apache.shardingsphere.readwritesplitting.distsql.handler.query;
 
-import org.apache.shardingsphere.distsql.handler.type.rql.CountRQLExecutor;
+import 
org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder;
 import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
-import 
org.apache.shardingsphere.readwritesplitting.distsql.statement.CountReadwriteSplittingRuleStatement;
 import 
org.apache.shardingsphere.readwritesplitting.rule.ReadwriteSplittingRule;
 
 import java.util.Collection;
 import java.util.Collections;
 
 /**
- * Count readwrite-splitting rule executor.
+ * Readwrite-splitting count result row builder.
  */
-public final class CountReadwriteSplittingRuleExecutor extends 
CountRQLExecutor<CountReadwriteSplittingRuleStatement, ReadwriteSplittingRule> {
+public final class ReadwriteSplittingCountResultRowBuilder implements 
CountResultRowBuilder<ReadwriteSplittingRule> {
     
-    public CountReadwriteSplittingRuleExecutor() {
-        super(ReadwriteSplittingRule.class);
+    @Override
+    public Collection<LocalDataQueryResultRow> generateRows(final 
ReadwriteSplittingRule rule, final String databaseName) {
+        return Collections.singleton(new 
LocalDataQueryResultRow("readwrite_splitting", databaseName, 
rule.getDataSourceMapper().size()));
     }
     
     @Override
-    protected Collection<LocalDataQueryResultRow> generateRows(final 
ReadwriteSplittingRule rule, final String databaseName) {
-        return Collections.singleton(new 
LocalDataQueryResultRow("readwrite_splitting", databaseName, 
rule.getDataSourceMapper().size()));
+    public Class<ReadwriteSplittingRule> getRuleClass() {
+        return ReadwriteSplittingRule.class;
     }
     
     @Override
-    public Class<CountReadwriteSplittingRuleStatement> getType() {
-        return CountReadwriteSplittingRuleStatement.class;
+    public String getType() {
+        return "READWRITE_SPLITTING";
     }
 }
diff --git 
a/features/readwrite-splitting/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
 
b/features/readwrite-splitting/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
index 50ea934d4e2..726be4e7e41 100644
--- 
a/features/readwrite-splitting/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
+++ 
b/features/readwrite-splitting/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
@@ -16,4 +16,3 @@
 #
 
 
org.apache.shardingsphere.readwritesplitting.distsql.handler.query.ShowReadwriteSplittingRuleExecutor
-org.apache.shardingsphere.readwritesplitting.distsql.handler.query.CountReadwriteSplittingRuleExecutor
diff --git 
a/features/readwrite-splitting/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
 
b/features/readwrite-splitting/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
similarity index 85%
copy from 
features/readwrite-splitting/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
copy to 
features/readwrite-splitting/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
index 50ea934d4e2..ee4305e6c81 100644
--- 
a/features/readwrite-splitting/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
+++ 
b/features/readwrite-splitting/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
@@ -15,5 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.readwritesplitting.distsql.handler.query.ShowReadwriteSplittingRuleExecutor
-org.apache.shardingsphere.readwritesplitting.distsql.handler.query.CountReadwriteSplittingRuleExecutor
+org.apache.shardingsphere.readwritesplitting.distsql.handler.query.ReadwriteSplittingCountResultRowBuilder
diff --git 
a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/CountReadwriteSplittingRuleExecutorTest.java
 
b/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/CountReadwriteSplittingRuleExecutorTest.java
deleted file mode 100644
index 05c6d1afb22..00000000000
--- 
a/features/readwrite-splitting/distsql/handler/src/test/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/CountReadwriteSplittingRuleExecutorTest.java
+++ /dev/null
@@ -1,74 +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.readwritesplitting.distsql.handler.query;
-
-import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
-import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
-import 
org.apache.shardingsphere.readwritesplitting.distsql.statement.CountReadwriteSplittingRuleStatement;
-import 
org.apache.shardingsphere.readwritesplitting.rule.ReadwriteSplittingRule;
-import org.junit.jupiter.api.Test;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-class CountReadwriteSplittingRuleExecutorTest {
-    
-    @Test
-    void assertGetRowData() {
-        Collection<LocalDataQueryResultRow> actual = new 
CountReadwriteSplittingRuleExecutor().getRows(mockDatabase(), 
mock(CountReadwriteSplittingRuleStatement.class));
-        assertThat(actual.size(), is(1));
-        Iterator<LocalDataQueryResultRow> iterator = actual.iterator();
-        LocalDataQueryResultRow row = iterator.next();
-        assertThat(row.getCell(1), is("readwrite_splitting"));
-        assertThat(row.getCell(2), is("db_1"));
-        assertThat(row.getCell(3), is(1));
-    }
-    
-    @Test
-    void assertGetColumnNames() {
-        Collection<String> columns = new 
CountReadwriteSplittingRuleExecutor().getColumnNames();
-        assertThat(columns.size(), is(3));
-        Iterator<String> iterator = columns.iterator();
-        assertThat(iterator.next(), is("rule_name"));
-        assertThat(iterator.next(), is("database"));
-        assertThat(iterator.next(), is("count"));
-    }
-    
-    private ShardingSphereDatabase mockDatabase() {
-        ShardingSphereDatabase result = mock(ShardingSphereDatabase.class, 
RETURNS_DEEP_STUBS);
-        when(result.getName()).thenReturn("db_1");
-        ReadwriteSplittingRule readwriteSplittingRule = 
mockReadwriteSplittingRule();
-        when(result.getRuleMetaData()).thenReturn(new 
RuleMetaData(Collections.singleton(readwriteSplittingRule)));
-        return result;
-    }
-    
-    private ReadwriteSplittingRule mockReadwriteSplittingRule() {
-        ReadwriteSplittingRule result = mock(ReadwriteSplittingRule.class);
-        
when(result.getDataSourceMapper()).thenReturn(Collections.singletonMap("readwrite_splitting",
 Arrays.asList("write_ds", "read_ds")));
-        return result;
-    }
-}
diff --git 
a/features/readwrite-splitting/distsql/parser/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingDistSQLStatementVisitor.java
 
b/features/readwrite-splitting/distsql/parser/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingDistSQLStatementVisitor.java
index 45b0a2cc620..814d3b03cef 100644
--- 
a/features/readwrite-splitting/distsql/parser/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingDistSQLStatementVisitor.java
+++ 
b/features/readwrite-splitting/distsql/parser/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingDistSQLStatementVisitor.java
@@ -33,9 +33,9 @@ import 
org.apache.shardingsphere.distsql.parser.autogen.ReadwriteSplittingDistSQ
 import 
org.apache.shardingsphere.distsql.parser.autogen.ReadwriteSplittingDistSQLStatementParser.ShowReadwriteSplittingRulesContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.ReadwriteSplittingDistSQLStatementParser.ShowStatusFromReadwriteSplittingRulesContext;
 import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
+import org.apache.shardingsphere.distsql.statement.rql.show.CountRuleStatement;
 import 
org.apache.shardingsphere.readwritesplitting.distsql.segment.ReadwriteSplittingRuleSegment;
 import 
org.apache.shardingsphere.readwritesplitting.distsql.statement.AlterReadwriteSplittingRuleStatement;
-import 
org.apache.shardingsphere.readwritesplitting.distsql.statement.CountReadwriteSplittingRuleStatement;
 import 
org.apache.shardingsphere.readwritesplitting.distsql.statement.CreateReadwriteSplittingRuleStatement;
 import 
org.apache.shardingsphere.readwritesplitting.distsql.statement.DropReadwriteSplittingRuleStatement;
 import 
org.apache.shardingsphere.readwritesplitting.distsql.statement.ShowReadQueryLoadBalanceAlgorithmImplementationsStatement;
@@ -117,7 +117,7 @@ public final class 
ReadwriteSplittingDistSQLStatementVisitor extends ReadwriteSp
     
     @Override
     public ASTNode visitCountReadwriteSplittingRule(final 
CountReadwriteSplittingRuleContext ctx) {
-        return new CountReadwriteSplittingRuleStatement(null == 
ctx.databaseName() ? null : (DatabaseSegment) visit(ctx.databaseName()));
+        return new CountRuleStatement(null == ctx.databaseName() ? null : 
(DatabaseSegment) visit(ctx.databaseName()), "READWRITE_SPLITTING");
     }
     
     private Properties getProperties(final PropertiesDefinitionContext ctx) {
diff --git 
a/features/readwrite-splitting/distsql/statement/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/statement/CountReadwriteSplittingRuleStatement.java
 
b/features/readwrite-splitting/distsql/statement/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/statement/CountReadwriteSplittingRuleStatement.java
deleted file mode 100644
index 11c4f9d6d14..00000000000
--- 
a/features/readwrite-splitting/distsql/statement/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/statement/CountReadwriteSplittingRuleStatement.java
+++ /dev/null
@@ -1,31 +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.readwritesplitting.distsql.statement;
-
-import org.apache.shardingsphere.distsql.statement.rql.show.ShowRulesStatement;
-import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.DatabaseSegment;
-
-/**
- * Count readwrite-splitting rule statement.
- */
-public final class CountReadwriteSplittingRuleStatement extends 
ShowRulesStatement {
-    
-    public CountReadwriteSplittingRuleStatement(final DatabaseSegment 
database) {
-        super(database);
-    }
-}
diff --git 
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/CountShadowRuleExecutor.java
 
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShadowCountResultRowBuilder.java
similarity index 68%
rename from 
features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/CountShadowRuleExecutor.java
rename to 
features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShadowCountResultRowBuilder.java
index 71c7e52e993..c84a49c1895 100644
--- 
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/CountShadowRuleExecutor.java
+++ 
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShadowCountResultRowBuilder.java
@@ -17,30 +17,30 @@
 
 package org.apache.shardingsphere.shadow.distsql.handler.query;
 
-import org.apache.shardingsphere.distsql.handler.type.rql.CountRQLExecutor;
+import 
org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder;
 import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
-import 
org.apache.shardingsphere.shadow.distsql.statement.CountShadowRuleStatement;
 import org.apache.shardingsphere.shadow.rule.ShadowRule;
 
 import java.util.Collection;
 import java.util.Collections;
 
 /**
- * Count shadow rule executor.
+ * Shadow count result row builder.
  */
-public final class CountShadowRuleExecutor extends 
CountRQLExecutor<CountShadowRuleStatement, ShadowRule> {
+public final class ShadowCountResultRowBuilder implements 
CountResultRowBuilder<ShadowRule> {
     
-    public CountShadowRuleExecutor() {
-        super(ShadowRule.class);
+    @Override
+    public Collection<LocalDataQueryResultRow> generateRows(final ShadowRule 
rule, final String databaseName) {
+        return Collections.singleton(new LocalDataQueryResultRow("shadow", 
databaseName, rule.getDataSourceMapper().size()));
     }
     
     @Override
-    protected Collection<LocalDataQueryResultRow> generateRows(final 
ShadowRule rule, final String databaseName) {
-        return Collections.singleton(new LocalDataQueryResultRow("shadow", 
databaseName, rule.getDataSourceMapper().size()));
+    public Class<ShadowRule> getRuleClass() {
+        return ShadowRule.class;
     }
     
     @Override
-    public Class<CountShadowRuleStatement> getType() {
-        return CountShadowRuleStatement.class;
+    public String getType() {
+        return "SHADOW";
     }
 }
diff --git 
a/features/shadow/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
 
b/features/shadow/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
index 79cf6c06835..931d5eb50f6 100644
--- 
a/features/shadow/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
+++ 
b/features/shadow/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
@@ -19,4 +19,3 @@ 
org.apache.shardingsphere.shadow.distsql.handler.query.ShowShadowRuleExecutor
 
org.apache.shardingsphere.shadow.distsql.handler.query.ShowShadowTableRulesExecutor
 
org.apache.shardingsphere.shadow.distsql.handler.query.ShowShadowAlgorithmsExecutor
 
org.apache.shardingsphere.shadow.distsql.handler.query.ShowDefaultShadowAlgorithmExecutor
-org.apache.shardingsphere.shadow.distsql.handler.query.CountShadowRuleExecutor
diff --git 
a/features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
 
b/features/shadow/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
similarity index 84%
copy from 
features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
copy to 
features/shadow/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
index 95a3cb562dd..f306444b379 100644
--- 
a/features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
+++ 
b/features/shadow/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
@@ -15,5 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.mask.distsql.handler.query.ShowMaskRuleExecutor
-org.apache.shardingsphere.mask.distsql.handler.query.CountMaskRuleExecutor
+org.apache.shardingsphere.shadow.distsql.handler.query.ShadowCountResultRowBuilder
diff --git 
a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/query/CountShadowRuleExecutorTest.java
 
b/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/query/CountShadowRuleExecutorTest.java
deleted file mode 100644
index 38519873661..00000000000
--- 
a/features/shadow/distsql/handler/src/test/java/org/apache/shardingsphere/shadow/distsql/query/CountShadowRuleExecutorTest.java
+++ /dev/null
@@ -1,80 +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.shadow.distsql.query;
-
-import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
-import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
-import 
org.apache.shardingsphere.shadow.distsql.handler.query.CountShadowRuleExecutor;
-import 
org.apache.shardingsphere.shadow.distsql.statement.CountShadowRuleStatement;
-import org.apache.shardingsphere.shadow.rule.ShadowRule;
-import org.junit.jupiter.api.Test;
-
-import java.util.Arrays;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-class CountShadowRuleExecutorTest {
-    
-    @Test
-    void assertGetRowData() {
-        Collection<LocalDataQueryResultRow> actual = new 
CountShadowRuleExecutor().getRows(mockDatabase(), 
mock(CountShadowRuleStatement.class));
-        assertThat(actual.size(), is(1));
-        Iterator<LocalDataQueryResultRow> iterator = actual.iterator();
-        LocalDataQueryResultRow row = iterator.next();
-        assertThat(row.getCell(1), is("shadow"));
-        assertThat(row.getCell(2), is("db_1"));
-        assertThat(row.getCell(3), is(2));
-    }
-    
-    @Test
-    void assertGetColumnNames() {
-        Collection<String> columns = new 
CountShadowRuleExecutor().getColumnNames();
-        assertThat(columns.size(), is(3));
-        Iterator<String> iterator = columns.iterator();
-        assertThat(iterator.next(), is("rule_name"));
-        assertThat(iterator.next(), is("database"));
-        assertThat(iterator.next(), is("count"));
-    }
-    
-    private ShardingSphereDatabase mockDatabase() {
-        ShardingSphereDatabase result = mock(ShardingSphereDatabase.class, 
RETURNS_DEEP_STUBS);
-        when(result.getName()).thenReturn("db_1");
-        RuleMetaData ruleMetaData = new 
RuleMetaData(Collections.singleton(mockShadowRule()));
-        when(result.getRuleMetaData()).thenReturn(ruleMetaData);
-        return result;
-    }
-    
-    private ShadowRule mockShadowRule() {
-        ShadowRule result = mock(ShadowRule.class);
-        Map<String, Collection<String>> dataSourceMapper = new 
LinkedHashMap<>();
-        dataSourceMapper.put("shadow-data-source-0", Arrays.asList("ds", 
"ds_shadow"));
-        dataSourceMapper.put("shadow-data-source-1", Arrays.asList("ds1", 
"ds1_shadow"));
-        when(result.getDataSourceMapper()).thenReturn(dataSourceMapper);
-        return result;
-    }
-}
diff --git 
a/features/shadow/distsql/parser/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/core/ShadowDistSQLStatementVisitor.java
 
b/features/shadow/distsql/parser/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/core/ShadowDistSQLStatementVisitor.java
index 3b7556a0029..139ea2d44b6 100644
--- 
a/features/shadow/distsql/parser/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/core/ShadowDistSQLStatementVisitor.java
+++ 
b/features/shadow/distsql/parser/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/core/ShadowDistSQLStatementVisitor.java
@@ -33,16 +33,16 @@ import 
org.apache.shardingsphere.distsql.parser.autogen.ShadowDistSQLStatementPa
 import 
org.apache.shardingsphere.distsql.parser.autogen.ShadowDistSQLStatementParser.PropertyContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.ShadowDistSQLStatementParser.ShadowRuleDefinitionContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.ShadowDistSQLStatementParser.ShowDefaultShadowAlgorithmContext;
-import 
org.apache.shardingsphere.distsql.parser.autogen.ShadowDistSQLStatementParser.ShowShadowAlgorithmsContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.ShadowDistSQLStatementParser.ShowShadowAlgorithmImplementationsContext;
+import 
org.apache.shardingsphere.distsql.parser.autogen.ShadowDistSQLStatementParser.ShowShadowAlgorithmsContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.ShadowDistSQLStatementParser.ShowShadowRulesContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.ShadowDistSQLStatementParser.ShowShadowTableRulesContext;
 import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
+import org.apache.shardingsphere.distsql.statement.rql.show.CountRuleStatement;
 import org.apache.shardingsphere.shadow.distsql.segment.ShadowAlgorithmSegment;
 import org.apache.shardingsphere.shadow.distsql.segment.ShadowRuleSegment;
 import 
org.apache.shardingsphere.shadow.distsql.statement.AlterDefaultShadowAlgorithmStatement;
 import 
org.apache.shardingsphere.shadow.distsql.statement.AlterShadowRuleStatement;
-import 
org.apache.shardingsphere.shadow.distsql.statement.CountShadowRuleStatement;
 import 
org.apache.shardingsphere.shadow.distsql.statement.CreateDefaultShadowAlgorithmStatement;
 import 
org.apache.shardingsphere.shadow.distsql.statement.CreateShadowRuleStatement;
 import 
org.apache.shardingsphere.shadow.distsql.statement.DropDefaultShadowAlgorithmStatement;
@@ -172,7 +172,7 @@ public final class ShadowDistSQLStatementVisitor extends 
ShadowDistSQLStatementB
     
     @Override
     public ASTNode visitCountShadowRule(final CountShadowRuleContext ctx) {
-        return new CountShadowRuleStatement(null == ctx.databaseName() ? null 
: (DatabaseSegment) visit(ctx.databaseName()));
+        return new CountRuleStatement(null == ctx.databaseName() ? null : 
(DatabaseSegment) visit(ctx.databaseName()), "SHADOW");
     }
     
     private Collection<ShadowRuleSegment> autoCreateAlgorithmName(final 
Collection<ShadowRuleSegment> shadowRuleSegments) {
diff --git 
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/CountShardingRuleExecutor.java
 
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShardingCountResultRowBuilder.java
similarity index 71%
rename from 
features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/CountShardingRuleExecutor.java
rename to 
features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShardingCountResultRowBuilder.java
index 5346f3ae928..7d4a228039c 100644
--- 
a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/CountShardingRuleExecutor.java
+++ 
b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShardingCountResultRowBuilder.java
@@ -17,32 +17,32 @@
 
 package org.apache.shardingsphere.sharding.distsql.handler.query;
 
-import org.apache.shardingsphere.distsql.handler.type.rql.CountRQLExecutor;
+import 
org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder;
 import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
 import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import 
org.apache.shardingsphere.sharding.distsql.statement.CountShardingRuleStatement;
 import org.apache.shardingsphere.sharding.rule.ShardingRule;
 
 import java.util.Arrays;
 import java.util.Collection;
 
 /**
- * Count sharding rule executor.
+ * Sharding count result row builder.
  */
-public final class CountShardingRuleExecutor extends 
CountRQLExecutor<CountShardingRuleStatement, ShardingRule> {
-    
-    public CountShardingRuleExecutor() {
-        super(ShardingRule.class);
-    }
+public final class ShardingCountResultRowBuilder implements 
CountResultRowBuilder<ShardingRule> {
     
     @Override
-    protected Collection<LocalDataQueryResultRow> generateRows(final 
ShardingRule rule, final String databaseName) {
+    public Collection<LocalDataQueryResultRow> generateRows(final ShardingRule 
rule, final String databaseName) {
         return Arrays.asList(new LocalDataQueryResultRow("sharding_table", 
databaseName, rule.getTableRules().size()),
                 new LocalDataQueryResultRow("sharding_table_reference", 
databaseName, ((ShardingRuleConfiguration) 
rule.getConfiguration()).getBindingTableGroups().size()));
     }
     
     @Override
-    public Class<CountShardingRuleStatement> getType() {
-        return CountShardingRuleStatement.class;
+    public Class<ShardingRule> getRuleClass() {
+        return ShardingRule.class;
+    }
+    
+    @Override
+    public String getType() {
+        return "SHARDING";
     }
 }
diff --git 
a/features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
 
b/features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
index aa4dcfb947e..8983a893b10 100644
--- 
a/features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
+++ 
b/features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
@@ -27,5 +27,4 @@ 
org.apache.shardingsphere.sharding.distsql.handler.query.ShowShardingTableNodesE
 
org.apache.shardingsphere.sharding.distsql.handler.query.ShowUnusedShardingAlgorithmsExecutor
 
org.apache.shardingsphere.sharding.distsql.handler.query.ShowUnusedShardingKeyGeneratorExecutor
 
org.apache.shardingsphere.sharding.distsql.handler.query.ShowUnusedShardingAuditorsExecutor
-org.apache.shardingsphere.sharding.distsql.handler.query.CountShardingRuleExecutor
 
org.apache.shardingsphere.sharding.distsql.handler.query.ShowShardingTableReferenceRuleExecutor
diff --git 
a/features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
 
b/features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
similarity index 84%
copy from 
features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
copy to 
features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
index 95a3cb562dd..644ec27c3c8 100644
--- 
a/features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
+++ 
b/features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
@@ -15,5 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.mask.distsql.handler.query.ShowMaskRuleExecutor
-org.apache.shardingsphere.mask.distsql.handler.query.CountMaskRuleExecutor
+org.apache.shardingsphere.sharding.distsql.handler.query.ShardingCountResultRowBuilder
diff --git 
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/CountShardingRuleExecutorTest.java
 
b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/CountShardingRuleExecutorTest.java
deleted file mode 100644
index b9db9c5a47b..00000000000
--- 
a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/CountShardingRuleExecutorTest.java
+++ /dev/null
@@ -1,90 +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.sharding.distsql.query;
-
-import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
-import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
-import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import 
org.apache.shardingsphere.sharding.api.config.rule.ShardingTableReferenceRuleConfiguration;
-import 
org.apache.shardingsphere.sharding.distsql.handler.query.CountShardingRuleExecutor;
-import 
org.apache.shardingsphere.sharding.distsql.statement.CountShardingRuleStatement;
-import org.apache.shardingsphere.sharding.rule.ShardingRule;
-import org.apache.shardingsphere.sharding.rule.TableRule;
-import org.junit.jupiter.api.Test;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-import java.util.LinkedHashMap;
-import java.util.Map;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-class CountShardingRuleExecutorTest {
-    
-    @Test
-    void assertGetRowData() {
-        Collection<LocalDataQueryResultRow> actual = new 
CountShardingRuleExecutor().getRows(mockDatabase(), 
mock(CountShardingRuleStatement.class));
-        assertThat(actual.size(), is(2));
-        Iterator<LocalDataQueryResultRow> iterator = actual.iterator();
-        LocalDataQueryResultRow row = iterator.next();
-        assertThat(row.getCell(1), is("sharding_table"));
-        assertThat(row.getCell(2), is("db_1"));
-        assertThat(row.getCell(3), is(2));
-        row = iterator.next();
-        assertThat(row.getCell(1), is("sharding_table_reference"));
-        assertThat(row.getCell(2), is("db_1"));
-        assertThat(row.getCell(3), is(1));
-    }
-    
-    @Test
-    void assertGetColumns() {
-        Collection<String> columns = new 
CountShardingRuleExecutor().getColumnNames();
-        assertThat(columns.size(), is(3));
-        Iterator<String> iterator = columns.iterator();
-        assertThat(iterator.next(), is("rule_name"));
-        assertThat(iterator.next(), is("database"));
-        assertThat(iterator.next(), is("count"));
-    }
-    
-    private ShardingSphereDatabase mockDatabase() {
-        ShardingSphereDatabase result = mock(ShardingSphereDatabase.class, 
RETURNS_DEEP_STUBS);
-        when(result.getName()).thenReturn("db_1");
-        RuleMetaData ruleMetaData = new 
RuleMetaData(Collections.singleton(mockShardingRule()));
-        when(result.getRuleMetaData()).thenReturn(ruleMetaData);
-        return result;
-    }
-    
-    private ShardingRule mockShardingRule() {
-        Map<String, TableRule> tableRules = new LinkedHashMap<>();
-        tableRules.put("t_order_item", mock(TableRule.class));
-        tableRules.put("t_order", mock(TableRule.class));
-        ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
-        ShardingTableReferenceRuleConfiguration 
shardingTableReferenceRuleConfig = new 
ShardingTableReferenceRuleConfiguration("refRule", "ref");
-        
ruleConfig.getBindingTableGroups().add(shardingTableReferenceRuleConfig);
-        ShardingRule result = mock(ShardingRule.class);
-        when(result.getTableRules()).thenReturn(tableRules);
-        when(result.getConfiguration()).thenReturn(ruleConfig);
-        return result;
-    }
-}
diff --git 
a/features/sharding/distsql/parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java
 
b/features/sharding/distsql/parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java
index 8e655c3ecdb..a25b15cf916 100644
--- 
a/features/sharding/distsql/parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java
+++ 
b/features/sharding/distsql/parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java
@@ -64,6 +64,7 @@ import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatement
 import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatementParser.TableNameContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.ShardingDistSQLStatementParser.TableReferenceRuleDefinitionContext;
 import org.apache.shardingsphere.distsql.segment.AlgorithmSegment;
+import org.apache.shardingsphere.distsql.statement.rql.show.CountRuleStatement;
 import 
org.apache.shardingsphere.sharding.distsql.segment.strategy.AuditStrategySegment;
 import 
org.apache.shardingsphere.sharding.distsql.segment.strategy.KeyGenerateStrategySegment;
 import 
org.apache.shardingsphere.sharding.distsql.segment.strategy.ShardingAuditorSegment;
@@ -75,7 +76,6 @@ import 
org.apache.shardingsphere.sharding.distsql.segment.table.TableRuleSegment
 import 
org.apache.shardingsphere.sharding.distsql.statement.AlterDefaultShardingStrategyStatement;
 import 
org.apache.shardingsphere.sharding.distsql.statement.AlterShardingTableReferenceRuleStatement;
 import 
org.apache.shardingsphere.sharding.distsql.statement.AlterShardingTableRuleStatement;
-import 
org.apache.shardingsphere.sharding.distsql.statement.CountShardingRuleStatement;
 import 
org.apache.shardingsphere.sharding.distsql.statement.CreateDefaultShardingStrategyStatement;
 import 
org.apache.shardingsphere.sharding.distsql.statement.CreateShardingTableReferenceRuleStatement;
 import 
org.apache.shardingsphere.sharding.distsql.statement.CreateShardingTableRuleStatement;
@@ -400,7 +400,7 @@ public final class ShardingDistSQLStatementVisitor extends 
ShardingDistSQLStatem
     
     @Override
     public ASTNode visitCountShardingRule(final CountShardingRuleContext ctx) {
-        return new CountShardingRuleStatement(null == ctx.databaseName() ? 
null : (DatabaseSegment) visit(ctx.databaseName()));
+        return new CountRuleStatement(null == ctx.databaseName() ? null : 
(DatabaseSegment) visit(ctx.databaseName()), "SHARDING");
     }
     
     @Override
diff --git 
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/rql/CountRQLExecutor.java
 
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/rql/count/CountRQLExecutor.java
similarity index 53%
rename from 
infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/rql/CountRQLExecutor.java
rename to 
infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/rql/count/CountRQLExecutor.java
index dc39186ba86..2f53c58c9fa 100644
--- 
a/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/rql/CountRQLExecutor.java
+++ 
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/rql/count/CountRQLExecutor.java
@@ -15,42 +15,40 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.distsql.handler.type.rql;
+package org.apache.shardingsphere.distsql.handler.type.rql.count;
 
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.distsql.statement.rql.RQLStatement;
+import org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor;
+import org.apache.shardingsphere.distsql.statement.rql.show.CountRuleStatement;
 import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
 import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
 import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPILoader;
 
 import java.util.Arrays;
 import java.util.Collection;
-import java.util.LinkedList;
+import java.util.Collections;
 import java.util.Optional;
 
 /**
  * Count RQL executor.
- * 
- * @param <T> type of RQL statement
- * @param <R> type of ShardingSphere rule
  */
-@RequiredArgsConstructor
-public abstract class CountRQLExecutor<T extends RQLStatement, R extends 
ShardingSphereRule> implements RQLExecutor<T> {
-    
-    private final Class<R> ruleClass;
+public final class CountRQLExecutor implements RQLExecutor<CountRuleStatement> 
{
     
     @Override
-    public final Collection<String> getColumnNames() {
+    public Collection<String> getColumnNames() {
         return Arrays.asList("rule_name", "database", "count");
     }
     
+    @SuppressWarnings({"unchecked", "rawtypes"})
     @Override
-    public final Collection<LocalDataQueryResultRow> getRows(final 
ShardingSphereDatabase database, final T sqlStatement) {
-        Optional<R> rule = 
database.getRuleMetaData().findSingleRule(ruleClass);
-        Collection<LocalDataQueryResultRow> result = new LinkedList<>();
-        rule.ifPresent(optional -> result.addAll(generateRows(optional, 
database.getName())));
-        return result;
+    public Collection<LocalDataQueryResultRow> getRows(final 
ShardingSphereDatabase database, final CountRuleStatement sqlStatement) {
+        CountResultRowBuilder rowBuilder = 
TypedSPILoader.getService(CountResultRowBuilder.class, sqlStatement.getType());
+        Optional<ShardingSphereRule> rule = 
database.getRuleMetaData().findSingleRule(rowBuilder.getRuleClass());
+        return rule.isPresent() ? rowBuilder.generateRows(rule.get(), 
database.getName()) : Collections.emptyList();
     }
     
-    protected abstract Collection<LocalDataQueryResultRow> generateRows(R 
rule, String databaseName);
+    @Override
+    public Class<CountRuleStatement> getType() {
+        return CountRuleStatement.class;
+    }
 }
diff --git 
a/features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/CountMaskRuleExecutor.java
 
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/rql/count/CountResultRowBuilder.java
similarity index 52%
rename from 
features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/CountMaskRuleExecutor.java
rename to 
infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/rql/count/CountResultRowBuilder.java
index 62e1b0f5650..20d34b2940b 100644
--- 
a/features/mask/distsql/handler/src/main/java/org/apache/shardingsphere/mask/distsql/handler/query/CountMaskRuleExecutor.java
+++ 
b/infra/distsql-handler/src/main/java/org/apache/shardingsphere/distsql/handler/type/rql/count/CountResultRowBuilder.java
@@ -15,32 +15,39 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.mask.distsql.handler.query;
+package org.apache.shardingsphere.distsql.handler.type.rql.count;
 
-import org.apache.shardingsphere.distsql.handler.type.rql.CountRQLExecutor;
 import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
-import org.apache.shardingsphere.mask.distsql.statement.CountMaskRuleStatement;
-import org.apache.shardingsphere.mask.rule.MaskRule;
+import org.apache.shardingsphere.infra.rule.ShardingSphereRule;
+import org.apache.shardingsphere.infra.spi.annotation.SingletonSPI;
+import org.apache.shardingsphere.infra.spi.type.typed.TypedSPI;
 
 import java.util.Collection;
-import java.util.Collections;
 
 /**
- * Count mask rule executor.
+ * Count result row builder.
+ * 
+ * @param <T> type of ShardingSphere rule
  */
-public final class CountMaskRuleExecutor extends 
CountRQLExecutor<CountMaskRuleStatement, MaskRule> {
+@SingletonSPI
+public interface CountResultRowBuilder<T extends ShardingSphereRule> extends 
TypedSPI {
     
-    public CountMaskRuleExecutor() {
-        super(MaskRule.class);
-    }
+    /**
+     * Generate rows.
+     * 
+     * @param rule rule
+     * @param databaseName database name
+     * @return generated rows
+     */
+    Collection<LocalDataQueryResultRow> generateRows(T rule, String 
databaseName);
     
-    @Override
-    protected Collection<LocalDataQueryResultRow> generateRows(final MaskRule 
rule, final String databaseName) {
-        return Collections.singleton(new LocalDataQueryResultRow("mask", 
databaseName, rule.getLogicTableMapper().getTableNames().size()));
-    }
+    /**
+     * Get rule class.
+     * 
+     * @return rule class
+     */
+    Class<T> getRuleClass();
     
     @Override
-    public Class<CountMaskRuleStatement> getType() {
-        return CountMaskRuleStatement.class;
-    }
+    String getType();
 }
diff --git 
a/features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
 
b/infra/distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
similarity index 84%
copy from 
features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
copy to 
infra/distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
index 95a3cb562dd..4be7755f4d8 100644
--- 
a/features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
+++ 
b/infra/distsql-handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
@@ -15,5 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.mask.distsql.handler.query.ShowMaskRuleExecutor
-org.apache.shardingsphere.mask.distsql.handler.query.CountMaskRuleExecutor
+org.apache.shardingsphere.distsql.handler.type.rql.count.CountRQLExecutor
diff --git 
a/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/CountSingleTableExecutor.java
 
b/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/SingleCountResultRowBuilder.java
similarity index 68%
rename from 
kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/CountSingleTableExecutor.java
rename to 
kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/SingleCountResultRowBuilder.java
index 8ce4631ec22..8a579a5d558 100644
--- 
a/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/CountSingleTableExecutor.java
+++ 
b/kernel/single/distsql/handler/src/main/java/org/apache/shardingsphere/single/distsql/handler/query/SingleCountResultRowBuilder.java
@@ -17,30 +17,30 @@
 
 package org.apache.shardingsphere.single.distsql.handler.query;
 
-import org.apache.shardingsphere.distsql.handler.type.rql.CountRQLExecutor;
+import 
org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder;
 import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
-import 
org.apache.shardingsphere.single.distsql.statement.rql.CountSingleTableStatement;
 import org.apache.shardingsphere.single.rule.SingleRule;
 
 import java.util.Collection;
 import java.util.Collections;
 
 /**
- * Count single table executor.
+ * Single count result row builder.
  */
-public final class CountSingleTableExecutor extends 
CountRQLExecutor<CountSingleTableStatement, SingleRule> {
+public final class SingleCountResultRowBuilder implements 
CountResultRowBuilder<SingleRule> {
     
-    public CountSingleTableExecutor() {
-        super(SingleRule.class);
+    @Override
+    public Collection<LocalDataQueryResultRow> generateRows(final SingleRule 
rule, final String databaseName) {
+        return Collections.singleton(new LocalDataQueryResultRow("single", 
databaseName, rule.getLogicTableMapper().getTableNames().size()));
     }
     
     @Override
-    protected Collection<LocalDataQueryResultRow> generateRows(final 
SingleRule rule, final String databaseName) {
-        return Collections.singleton(new LocalDataQueryResultRow("single", 
databaseName, rule.getLogicTableMapper().getTableNames().size()));
+    public Class<SingleRule> getRuleClass() {
+        return SingleRule.class;
     }
     
     @Override
-    public Class<CountSingleTableStatement> getType() {
-        return CountSingleTableStatement.class;
+    public String getType() {
+        return "SINGLE";
     }
 }
diff --git 
a/kernel/single/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
 
b/kernel/single/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
index 433d8f9a21a..079a94826fd 100644
--- 
a/kernel/single/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
+++ 
b/kernel/single/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
@@ -17,5 +17,4 @@
 
 org.apache.shardingsphere.single.distsql.handler.query.ShowSingleTableExecutor
 
org.apache.shardingsphere.single.distsql.handler.query.ShowDefaultSingleTableStorageUnitExecutor
-org.apache.shardingsphere.single.distsql.handler.query.CountSingleTableExecutor
 
org.apache.shardingsphere.single.distsql.handler.query.ShowUnloadedSingleTableExecutor
diff --git 
a/features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
 
b/kernel/single/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
similarity index 84%
copy from 
features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
copy to 
kernel/single/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
index 95a3cb562dd..46e8710c9eb 100644
--- 
a/features/mask/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.RQLExecutor
+++ 
b/kernel/single/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.type.rql.count.CountResultRowBuilder
@@ -15,5 +15,4 @@
 # limitations under the License.
 #
 
-org.apache.shardingsphere.mask.distsql.handler.query.ShowMaskRuleExecutor
-org.apache.shardingsphere.mask.distsql.handler.query.CountMaskRuleExecutor
+org.apache.shardingsphere.single.distsql.handler.query.SingleCountResultRowBuilder
diff --git 
a/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/query/CountSingleTableExecutorTest.java
 
b/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/query/CountSingleTableExecutorTest.java
deleted file mode 100644
index c2738171b17..00000000000
--- 
a/kernel/single/distsql/handler/src/test/java/org/apache/shardingsphere/single/distsql/handler/query/CountSingleTableExecutorTest.java
+++ /dev/null
@@ -1,77 +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.single.distsql.handler.query;
-
-import 
org.apache.shardingsphere.infra.merge.result.impl.local.LocalDataQueryResultRow;
-import 
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.metadata.database.rule.RuleMetaData;
-import org.apache.shardingsphere.infra.rule.identifier.type.TableNamesMapper;
-import 
org.apache.shardingsphere.single.distsql.statement.rql.CountSingleTableStatement;
-import org.apache.shardingsphere.single.rule.SingleRule;
-import org.junit.jupiter.api.Test;
-
-import java.util.Collection;
-import java.util.Collections;
-import java.util.Iterator;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
-import static org.mockito.Mockito.mock;
-import static org.mockito.Mockito.when;
-
-class CountSingleTableExecutorTest {
-    
-    @Test
-    void assertGetRowData() {
-        Collection<LocalDataQueryResultRow> actual = new 
CountSingleTableExecutor().getRows(mockDatabase(), 
mock(CountSingleTableStatement.class));
-        assertThat(actual.size(), is(1));
-        Iterator<LocalDataQueryResultRow> iterator = actual.iterator();
-        LocalDataQueryResultRow row = iterator.next();
-        assertThat(row.getCell(1), is("single"));
-        assertThat(row.getCell(2), is("db_1"));
-        assertThat(row.getCell(3), is(2));
-    }
-    
-    @Test
-    void assertGetColumnNames() {
-        Collection<String> columns = new 
CountSingleTableExecutor().getColumnNames();
-        assertThat(columns.size(), is(3));
-        Iterator<String> iterator = columns.iterator();
-        assertThat(iterator.next(), is("rule_name"));
-        assertThat(iterator.next(), is("database"));
-        assertThat(iterator.next(), is("count"));
-    }
-    
-    private ShardingSphereDatabase mockDatabase() {
-        ShardingSphereDatabase result = mock(ShardingSphereDatabase.class, 
RETURNS_DEEP_STUBS);
-        when(result.getName()).thenReturn("db_1");
-        RuleMetaData ruleMetaData = new 
RuleMetaData(Collections.singleton(mockSingleRule()));
-        when(result.getRuleMetaData()).thenReturn(ruleMetaData);
-        return result;
-    }
-    
-    private SingleRule mockSingleRule() {
-        SingleRule result = mock(SingleRule.class);
-        TableNamesMapper tableNamesMapper = new TableNamesMapper();
-        tableNamesMapper.put("single_table_1");
-        tableNamesMapper.put("single_table_2");
-        when(result.getLogicTableMapper()).thenReturn(tableNamesMapper);
-        return result;
-    }
-}
diff --git 
a/kernel/single/distsql/parser/src/main/java/org/apache/shardingsphere/single/distsql/parser/core/SingleDistSQLStatementVisitor.java
 
b/kernel/single/distsql/parser/src/main/java/org/apache/shardingsphere/single/distsql/parser/core/SingleDistSQLStatementVisitor.java
index aef1067c271..86d9b0946ab 100644
--- 
a/kernel/single/distsql/parser/src/main/java/org/apache/shardingsphere/single/distsql/parser/core/SingleDistSQLStatementVisitor.java
+++ 
b/kernel/single/distsql/parser/src/main/java/org/apache/shardingsphere/single/distsql/parser/core/SingleDistSQLStatementVisitor.java
@@ -35,11 +35,11 @@ import 
org.apache.shardingsphere.distsql.parser.autogen.SingleDistSQLStatementPa
 import 
org.apache.shardingsphere.distsql.parser.autogen.SingleDistSQLStatementParser.TableFromStorageUnitContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.SingleDistSQLStatementParser.TableIdentifierContext;
 import 
org.apache.shardingsphere.distsql.parser.autogen.SingleDistSQLStatementParser.UnloadSingleTableContext;
+import org.apache.shardingsphere.distsql.statement.rql.show.CountRuleStatement;
 import org.apache.shardingsphere.single.distsql.segment.SingleTableSegment;
 import 
org.apache.shardingsphere.single.distsql.statement.rdl.LoadSingleTableStatement;
 import 
org.apache.shardingsphere.single.distsql.statement.rdl.SetDefaultSingleTableStorageUnitStatement;
 import 
org.apache.shardingsphere.single.distsql.statement.rdl.UnloadSingleTableStatement;
-import 
org.apache.shardingsphere.single.distsql.statement.rql.CountSingleTableStatement;
 import 
org.apache.shardingsphere.single.distsql.statement.rql.ShowDefaultSingleTableStorageUnitStatement;
 import 
org.apache.shardingsphere.single.distsql.statement.rql.ShowSingleTableStatement;
 import 
org.apache.shardingsphere.single.distsql.statement.rql.ShowUnloadedSingleTableStatement;
@@ -59,7 +59,7 @@ public final class SingleDistSQLStatementVisitor extends 
SingleDistSQLStatementB
     
     @Override
     public ASTNode visitCountSingleTable(final CountSingleTableContext ctx) {
-        return new CountSingleTableStatement(null == ctx.databaseName() ? null 
: (DatabaseSegment) visit(ctx.databaseName()));
+        return new CountRuleStatement(null == ctx.databaseName() ? null : 
(DatabaseSegment) visit(ctx.databaseName()), "SINGLE");
     }
     
     @Override
diff --git 
a/kernel/single/distsql/statement/src/main/java/org/apache/shardingsphere/single/distsql/statement/rql/CountSingleTableStatement.java
 
b/parser/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/statement/rql/show/CountRuleStatement.java
similarity index 74%
rename from 
kernel/single/distsql/statement/src/main/java/org/apache/shardingsphere/single/distsql/statement/rql/CountSingleTableStatement.java
rename to 
parser/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/statement/rql/show/CountRuleStatement.java
index 5e04cdf8074..1ff3932769b 100644
--- 
a/kernel/single/distsql/statement/src/main/java/org/apache/shardingsphere/single/distsql/statement/rql/CountSingleTableStatement.java
+++ 
b/parser/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/statement/rql/show/CountRuleStatement.java
@@ -15,17 +15,21 @@
  * limitations under the License.
  */
 
-package org.apache.shardingsphere.single.distsql.statement.rql;
+package org.apache.shardingsphere.distsql.statement.rql.show;
 
-import org.apache.shardingsphere.distsql.statement.rql.show.ShowRulesStatement;
+import lombok.Getter;
 import 
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.DatabaseSegment;
 
 /**
- * Count single table statement.
+ * Count rule statement.
  */
-public final class CountSingleTableStatement extends ShowRulesStatement {
+@Getter
+public final class CountRuleStatement extends ShowRulesStatement {
     
-    public CountSingleTableStatement(final DatabaseSegment database) {
+    private final String type;
+    
+    public CountRuleStatement(final DatabaseSegment database, final String 
type) {
         super(database);
+        this.type = type;
     }
 }
diff --git 
a/test/e2e/sql/src/test/resources/cases/rql/dataset/db/count_single_table.xml 
b/test/e2e/sql/src/test/resources/cases/rql/dataset/db/count_single_table.xml
index d621d4bbc34..f258de94357 100644
--- 
a/test/e2e/sql/src/test/resources/cases/rql/dataset/db/count_single_table.xml
+++ 
b/test/e2e/sql/src/test/resources/cases/rql/dataset/db/count_single_table.xml
@@ -17,8 +17,9 @@
 
 <dataset>
     <metadata>
+        <column name="rule_name" />
         <column name="database" />
         <column name="count" />
     </metadata>
-    <row values="db| 5" />
+    <row values="single| db| 5" />
 </dataset>
diff --git 
a/test/e2e/sql/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting/count_single_table.xml
 
b/test/e2e/sql/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting/count_single_table.xml
index 856d2982cfb..cc0e44b4402 100644
--- 
a/test/e2e/sql/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting/count_single_table.xml
+++ 
b/test/e2e/sql/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting/count_single_table.xml
@@ -17,8 +17,9 @@
 
 <dataset>
     <metadata>
+        <column name="rule_name" />
         <column name="database" />
         <column name="count" />
     </metadata>
-    <row values="dbtbl_with_readwrite_splitting| 5" />
+    <row values="single| dbtbl_with_readwrite_splitting| 5" />
 </dataset>
diff --git 
a/test/e2e/sql/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/count_single_table.xml
 
b/test/e2e/sql/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/count_single_table.xml
index 3c1481f1f18..7061e8a8d1d 100644
--- 
a/test/e2e/sql/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/count_single_table.xml
+++ 
b/test/e2e/sql/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/count_single_table.xml
@@ -17,8 +17,9 @@
 
 <dataset>
     <metadata>
+        <column name="rule_name" />
         <column name="database" />
         <column name="count" />
     </metadata>
-    <row values="dbtbl_with_readwrite_splitting_and_encrypt| 5" />
+    <row values="single| dbtbl_with_readwrite_splitting_and_encrypt| 5" />
 </dataset>
diff --git 
a/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt/count_single_table.xml
 
b/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt/count_single_table.xml
index 9f645c0275c..df263a2164c 100644
--- 
a/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt/count_single_table.xml
+++ 
b/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt/count_single_table.xml
@@ -17,8 +17,9 @@
 
 <dataset>
     <metadata>
+        <column name="rule_name" />
         <column name="database" />
         <column name="count" />
     </metadata>
-    <row values="encrypt| 6" />
+    <row values="single| encrypt| 6" />
 </dataset>
diff --git 
a/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt_and_readwrite_splitting/count_single_table.xml
 
b/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt_and_readwrite_splitting/count_single_table.xml
index 2430d75a04a..e172ffbb888 100644
--- 
a/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt_and_readwrite_splitting/count_single_table.xml
+++ 
b/test/e2e/sql/src/test/resources/cases/rql/dataset/encrypt_and_readwrite_splitting/count_single_table.xml
@@ -17,8 +17,9 @@
 
 <dataset>
     <metadata>
+        <column name="rule_name" />
         <column name="database" />
         <column name="count" />
     </metadata>
-    <row values="encrypt_and_readwrite_splitting| 5" />
+    <row values="single| encrypt_and_readwrite_splitting| 5" />
 </dataset>
diff --git 
a/test/e2e/sql/src/test/resources/cases/rql/dataset/sharding_and_encrypt/count_single_table.xml
 
b/test/e2e/sql/src/test/resources/cases/rql/dataset/sharding_and_encrypt/count_single_table.xml
index 36934f12e0f..d82fddd619f 100644
--- 
a/test/e2e/sql/src/test/resources/cases/rql/dataset/sharding_and_encrypt/count_single_table.xml
+++ 
b/test/e2e/sql/src/test/resources/cases/rql/dataset/sharding_and_encrypt/count_single_table.xml
@@ -17,8 +17,9 @@
 
 <dataset>
     <metadata>
+        <column name="rule_name" />
         <column name="database" />
         <column name="count" />
     </metadata>
-    <row values="sharding_and_encrypt| 3" />
+    <row values="single| sharding_and_encrypt| 3" />
 </dataset>
diff --git 
a/test/e2e/sql/src/test/resources/cases/rql/dataset/tbl/count_single_table.xml 
b/test/e2e/sql/src/test/resources/cases/rql/dataset/tbl/count_single_table.xml
index 0935bc538f9..02c0f797133 100644
--- 
a/test/e2e/sql/src/test/resources/cases/rql/dataset/tbl/count_single_table.xml
+++ 
b/test/e2e/sql/src/test/resources/cases/rql/dataset/tbl/count_single_table.xml
@@ -17,8 +17,9 @@
 
 <dataset>
     <metadata>
+        <column name="rule_name" />
         <column name="database" />
         <column name="count" />
     </metadata>
-    <row values="tbl| 1" />
+    <row values="single| tbl| 1" />
 </dataset>

Reply via email to