This is an automated email from the ASF dual-hosted git repository.
jianglongtao pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new b481e5de093 Refactor DistSQL`count single table rule` to `count single
table` (#23680)
b481e5de093 is described below
commit b481e5de093ca7482865bfff4548ee0181f6f98e
Author: Zichao <[email protected]>
AuthorDate: Sat Jan 21 20:54:51 2023 +1300
Refactor DistSQL`count single table rule` to `count single table` (#23680)
* Refactor DistSQL`count single table rule` to `count single table`
* Refactor DistSQL`count single table rule` to `count single table`
* Refactor DistSQL`count single table rule` to `count single table`
* Refactor DistSQL`count single table rule` to `count single table`
---
distsql/parser/src/main/antlr4/imports/Keyword.g4 | 4 --
.../parser/src/main/antlr4/imports/RQLStatement.g4 | 4 +-
.../parser/autogen/KernelDistSQLStatement.g4 | 2 +-
.../core/kernel/KernelDistSQLStatementVisitor.java | 8 +--
...atement.java => CountSingleTableStatement.java} | 6 +--
.../alter-readwrite-splitting-rule.cn.md | 3 +-
.../alter-readwrite-splitting-rule.en.md | 3 +-
.../create-readwrite-splitting-rule.cn.md | 3 +-
.../create-readwrite-splitting-rule.en.md | 3 +-
.../distsql/syntax/reserved-word.cn.md | 2 +-
.../distsql/syntax/reserved-word.en.md | 2 +-
.../single-table/count-single-table-rule.en.md | 63 ----------------------
...e-table-rule.cn.md => count-single-table.cn.md} | 31 ++++++-----
.../single-table/count-single-table.en.md | 62 +++++++++++++++++++++
...sultSet.java => CountSingleTableResultSet.java} | 37 +++++--------
.../distsql/rql/rule/SingleTableRuleResultSet.java | 2 +-
...here.distsql.handler.resultset.DistSQLResultSet | 2 +-
...est.java => CountSingleTableResultSetTest.java} | 17 +++---
.../count_single_table.xml} | 3 +-
.../count_single_table.xml} | 3 +-
.../count_single_table_rule.xml | 25 ---------
.../count_single_table.xml} | 3 +-
.../count_single_table_rule.xml | 25 ---------
...ingle_table_rule.xml => count_single_table.xml} | 3 +-
.../count_single_table.xml} | 3 +-
.../count_single_table_rule.xml | 25 ---------
.../count_single_table.xml} | 3 +-
.../count_single_table_rule.xml | 25 ---------
...ingle_table_rule.xml => count_single_table.xml} | 3 +-
.../count_single_table.xml} | 3 +-
.../cases/rql/rql-integration-test-cases.xml | 4 +-
.../cases/parser/jaxb/RootSQLParserTestCases.java | 6 +--
...java => CountSingleTableStatementTestCase.java} | 4 +-
.../it/parser/src/main/resources/case/rql/show.xml | 6 +--
.../src/main/resources/sql/supported/rql/show.xml | 2 +-
35 files changed, 140 insertions(+), 260 deletions(-)
diff --git a/distsql/parser/src/main/antlr4/imports/Keyword.g4
b/distsql/parser/src/main/antlr4/imports/Keyword.g4
index dd3484f4abf..b6d7fc8ffeb 100644
--- a/distsql/parser/src/main/antlr4/imports/Keyword.g4
+++ b/distsql/parser/src/main/antlr4/imports/Keyword.g4
@@ -263,10 +263,6 @@ DISCARD
: D I S C A R D
;
-SINGLE_TABLE
- : S I N G L E UL_ T A B L E
- ;
-
INFO
: I N F O
;
diff --git a/distsql/parser/src/main/antlr4/imports/RQLStatement.g4
b/distsql/parser/src/main/antlr4/imports/RQLStatement.g4
index cda3cf195c8..d38cd8755e6 100644
--- a/distsql/parser/src/main/antlr4/imports/RQLStatement.g4
+++ b/distsql/parser/src/main/antlr4/imports/RQLStatement.g4
@@ -39,8 +39,8 @@ showSingleTable
: SHOW SINGLE (TABLES showLike? | TABLE tableName) (FROM databaseName)?
;
-countSingleTableRule
- : COUNT SINGLE_TABLE RULE (FROM databaseName)?
+countSingleTable
+ : COUNT SINGLE TABLE (FROM databaseName)?
;
usageCount
diff --git
a/distsql/parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
b/distsql/parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
index 6a975b2302e..e68aa315834 100644
---
a/distsql/parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
+++
b/distsql/parser/src/main/antlr4/org/apache/shardingsphere/distsql/parser/autogen/KernelDistSQLStatement.g4
@@ -36,7 +36,7 @@ execute
| showComputeNodeMode
| labelComputeNode
| unlabelComputeNode
- | countSingleTableRule
+ | countSingleTable
| alterComputeNode
| prepareDistSQL
| applyDistSQL
diff --git
a/distsql/parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
b/distsql/parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
index 79e33274ba1..dc2c45c4361 100644
---
a/distsql/parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
+++
b/distsql/parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/kernel/KernelDistSQLStatementVisitor.java
@@ -27,7 +27,7 @@ import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementPa
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.BatchSizeContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ClearHintContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.ConvertYamlConfigurationContext;
-import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.CountSingleTableRuleContext;
+import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.CountSingleTableContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.DatabaseNameContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.DisableComputeNodeContext;
import
org.apache.shardingsphere.distsql.parser.autogen.KernelDistSQLStatementParser.DiscardDistSQLContext;
@@ -100,7 +100,7 @@ import
org.apache.shardingsphere.distsql.parser.statement.rdl.alter.AlterStorage
import
org.apache.shardingsphere.distsql.parser.statement.rdl.create.RegisterStorageUnitStatement;
import
org.apache.shardingsphere.distsql.parser.statement.rdl.create.SetDefaultSingleTableStorageUnitStatement;
import
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.UnregisterStorageUnitStatement;
-import
org.apache.shardingsphere.distsql.parser.statement.rql.show.CountSingleTableRuleStatement;
+import
org.apache.shardingsphere.distsql.parser.statement.rql.show.CountSingleTableStatement;
import
org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowDefaultSingleTableStorageUnitStatement;
import
org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowLogicalTablesStatement;
import
org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowRulesUsedStorageUnitStatement;
@@ -192,8 +192,8 @@ public final class KernelDistSQLStatementVisitor extends
KernelDistSQLStatementB
}
@Override
- public ASTNode visitCountSingleTableRule(final CountSingleTableRuleContext
ctx) {
- return new CountSingleTableRuleStatement(null == ctx.databaseName() ?
null : (DatabaseSegment) visit(ctx.databaseName()));
+ public ASTNode visitCountSingleTable(final CountSingleTableContext ctx) {
+ return new CountSingleTableStatement(null == ctx.databaseName() ? null
: (DatabaseSegment) visit(ctx.databaseName()));
}
@Override
diff --git
a/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rql/show/CountSingleTableRuleStatement.java
b/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rql/show/CountSingleTableStatement.java
similarity index 84%
rename from
distsql/statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rql/show/CountSingleTableRuleStatement.java
rename to
distsql/statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rql/show/CountSingleTableStatement.java
index a758cb1bcd3..bade19dab9c 100644
---
a/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rql/show/CountSingleTableRuleStatement.java
+++
b/distsql/statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rql/show/CountSingleTableStatement.java
@@ -20,11 +20,11 @@ package
org.apache.shardingsphere.distsql.parser.statement.rql.show;
import
org.apache.shardingsphere.sql.parser.sql.common.segment.generic.DatabaseSegment;
/**
- * Count single table rule statement.
+ * Count single table statement.
*/
-public final class CountSingleTableRuleStatement extends ShowRulesStatement {
+public final class CountSingleTableStatement extends ShowRulesStatement {
- public CountSingleTableRuleStatement(final DatabaseSegment database) {
+ public CountSingleTableStatement(final DatabaseSegment database) {
super(database);
}
}
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/alter-readwrite-splitting-rule.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/alter-readwrite-splitting-rule.cn.md
index bb33c9e501f..008415d4d48 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/alter-readwrite-splitting-rule.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/alter-readwrite-splitting-rule.cn.md
@@ -60,7 +60,7 @@ value ::=
### 补充说明
- 动态读写分离规则依赖于数据库发现规则;
-- `loadBalancerType` 指定负载均衡算法类型,请参考负载均衡算法;
+- `loadBalancerType`
指定负载均衡算法类型,请参考[负载均衡算法]((/cn/user-manual/common-config/builtin-algorithm/load-balance/));
### 示例
@@ -92,3 +92,4 @@ ALTER READWRITE_SPLITTING RULE ms_group_1 (
### 相关链接
- [保留字](/cn/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word/)
+- [负载均衡算法](/cn/user-manual/common-config/builtin-algorithm/load-balance/)
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/alter-readwrite-splitting-rule.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/alter-readwrite-splitting-rule.en.md
index 0c526583518..c2a619c9889 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/alter-readwrite-splitting-rule.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/alter-readwrite-splitting-rule.en.md
@@ -60,7 +60,7 @@ value ::=
### Supplement
- Dynamic readwrite-splitting rules rely on database discovery rules;
-- `loadBalancerType` specifies the load balancing algorithm type, please refer
to Load Balance Algorithm;
+- `loadBalancerType` specifies the load balancing algorithm type, please refer
to [Load Balance
Algorithm]((/en/user-manual/common-config/builtin-algorithm/load-balance/));
### Example
@@ -92,3 +92,4 @@ ALTER READWRITE_SPLITTING RULE ms_group_1 (
### Related links
- [Reserved
word](/en/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word/)
+- [Load Balance
Algorithm](/en/user-manual/common-config/builtin-algorithm/load-balance/)
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/create-readwrite-splitting-rule.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/create-readwrite-splitting-rule.cn.md
index facfb77cc8d..c37318bef9c 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/create-readwrite-splitting-rule.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/create-readwrite-splitting-rule.cn.md
@@ -64,7 +64,7 @@ value ::=
- 支持创建静态读写分离规则和动态读写分离规则;
- 动态读写分离规则依赖于数据库发现规则;
-- `loadBalancerType` 指定负载均衡算法类型,请参考负载均衡算法;
+- `loadBalancerType`
指定负载均衡算法类型,请参考[负载均衡算法](/cn/user-manual/common-config/builtin-algorithm/load-balance/);
- 重复的 `ruleName` 将无法被创建;
- `ifNotExists` 子句用于避免出现 `Duplicate readwrite_splitting rule` 错误。
@@ -120,3 +120,4 @@ CREATE READWRITE_SPLITTING RULE IF NOT EXISTS ms_group_1 (
### 相关链接
- [保留字](/cn/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word/)
+- [负载均衡算法](/cn/user-manual/common-config/builtin-algorithm/load-balance/)
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/create-readwrite-splitting-rule.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/create-readwrite-splitting-rule.en.md
index 4791cf1e227..a9578b4cc1f 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/create-readwrite-splitting-rule.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/readwrite-splitting/create-readwrite-splitting-rule.en.md
@@ -64,7 +64,7 @@ value ::=
- Support the creation of static readwrite-splitting rules and dynamic
readwrite-splitting rules;
- Dynamic readwrite-splitting rules rely on database discovery rules;
-- `loadBalancerType` specifies the load balancing algorithm type, please refer
to Load Balance Algorithm;
+- `loadBalancerType` specifies the load balancing algorithm type, please refer
to [Load Balance
Algorithm](/en/user-manual/common-config/builtin-algorithm/load-balance/);
- Duplicate `ruleName` will not be created;
- `ifNotExists` clause used for avoid `Duplicate readwrite_splitting rule`
error.
@@ -120,3 +120,4 @@ CREATE READWRITE_SPLITTING RULE IF NOT EXISTS ms_group_1 (
### Related links
- [Reserved
word](/en/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word/)
+- [Load Balance
Algorithm](/en/user-manual/common-config/builtin-algorithm/load-balance/)
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word.cn.md
index 06de496f9b9..621330caf80 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word.cn.md
@@ -66,7 +66,7 @@ weight = 5
#### 单表
-`SINGLE`、`STORAGE`、`UNIT`、`SINGLE_TABLE`
+`SINGLE`、`STORAGE`、`UNIT`
#### 读写分离
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word.en.md
index 94c332514a9..a018f23af82 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word.en.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word.en.md
@@ -67,7 +67,7 @@ weight = 5
#### Single Table
-`SINGLE`, `STORAGE`, `UNIT`, `SINGLE_TABLE`
+`SINGLE`, `STORAGE`, `UNIT`
#### Readwrite Splitting
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/single-table/count-single-table-rule.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/single-table/count-single-table-rule.en.md
deleted file mode 100644
index 7ae91534044..00000000000
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/single-table/count-single-table-rule.en.md
+++ /dev/null
@@ -1,63 +0,0 @@
-+++
-title = "COUNT SINGLE_TABLE RULE"
-weight = 4
-+++
-
-### Description
-
-The `COUNT SINGLE_TABLE RULE` syntax is used to query number of single table
rules for specified database.
-
-### Syntax
-
-{{< tabs >}}
-{{% tab name="Grammar" %}}
-```sql
-CountSingleTableRule::=
- 'COUNT' 'SINGLE_TABLE' 'RULE' ('FROM' databaseName)?
-
-databaseName ::=
- identifier
-```
-{{% /tab %}}
-{{% tab name="Railroad diagram" %}}
-<iframe frameborder="0" name="diagram" id="diagram" width="100%"
height="100%"></iframe>
-{{% /tab %}}
-{{< /tabs >}}
-
-### Supplement
-
-- When `databaseName` is not specified, the default is the currently used
`DATABASE`. If `DATABASE` is not used, `No database selected` will be prompted.
-
-### Return Value Description
-
-| Column | Description |
-|-----------|-----------------------------------------------------|
-| rule_name | Single table rule name |
-| database | The database name where the single table is located |
-| count | The count of single table rules |
-
-### Example
-
-- Query the number of single table rules for specified database.
-
-```sql
-COUNT SINGLE_TABLE RULE
-```
-
-```sql
-mysql> COUNT SINGLE_TABLE RULE;
-+--------------+----------+-------+
-| rule_name | database | count |
-+--------------+----------+-------+
-| t_single_0 | ds | 2 |
-+--------------+----------+-------+
-1 row in set (0.02 sec)
-```
-
-### Reserved word
-
-`COUNT`, `SINGLE_TABLE`, `RULE`
-
-### Related links
-
-- [Reserved
word](/en/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word/)
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/single-table/count-single-table-rule.cn.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/single-table/count-single-table.cn.md
similarity index 53%
rename from
docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/single-table/count-single-table-rule.cn.md
rename to
docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/single-table/count-single-table.cn.md
index eedd1b088d8..6dd77fd03a6 100644
---
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/single-table/count-single-table-rule.cn.md
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/single-table/count-single-table.cn.md
@@ -5,15 +5,15 @@ weight = 4
### 描述
-`COUNT SINGLE_TABLE RULE` 语法用于查询指定逻辑库中的单表规则个数。
+`COUNT SINGLE TABLE` 语法用于查询指定逻辑库中的单表个数。
### 语法
{{< tabs >}}
{{% tab name="Grammar" %}}
```sql
-CountSingleTableRule::=
- 'COUNT' 'SINGLE_TABLE' 'RULE' ('FROM' databaseName)?
+CountSingleTable::=
+ 'COUNT' 'SINGLE' 'TABLE' ('FROM' databaseName)?
databaseName ::=
identifier
@@ -31,33 +31,32 @@ databaseName ::=
### 返回值说明
-| 列 | 说明 |
-|-----------|---------------------|
-| rule_name | 规则名称 |
-| database | 单表所在的数据库名称 |
-| count | 规则个数 |
+| 列 | 说明 |
+|------------|----------------------|
+| database | 单表所在的数据库名称 |
+| count | 单表个数 |
### 示例
- 查询当前逻辑库中的单表规则个数
```sql
-COUNT SINGLE_TABLE RULE
+COUNT SINGLE TABLE
```
```sql
-mysql> COUNT SINGLE_TABLE RULE;
-+--------------+----------+-------+
-| rule_name | database | count |
-+--------------+----------+-------+
-| t_single_0 | ds | 2 |
-+--------------+----------+-------+
+mysql> COUNT SINGLE TABLE;
++----------+--------+
+| database | count |
++----------+--------+
+| ds | 2 |
++----------+--------+
1 row in set (0.02 sec)
```
### 保留字
-`COUNT`、`SINGLE_TABLE`、`RULE`
+`COUNT`、`SINGLE`、`TABLE`、`FROM`
### 相关链接
diff --git
a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/single-table/count-single-table.en.md
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/single-table/count-single-table.en.md
new file mode 100644
index 00000000000..fceadc4f9b8
--- /dev/null
+++
b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rql/rule-query/single-table/count-single-table.en.md
@@ -0,0 +1,62 @@
++++
+title = "COUNT SINGLE_TABLE RULE"
+weight = 4
++++
+
+### Description
+
+The `COUNT SINGLE TABLE` syntax is used to query number of single table for
specified database.
+
+### Syntax
+
+{{< tabs >}}
+{{% tab name="Grammar" %}}
+```sql
+CountSingleTable::=
+ 'COUNT' 'SINGLE' 'TABLE' ('FROM' databaseName)?
+
+databaseName ::=
+ identifier
+```
+{{% /tab %}}
+{{% tab name="Railroad diagram" %}}
+<iframe frameborder="0" name="diagram" id="diagram" width="100%"
height="100%"></iframe>
+{{% /tab %}}
+{{< /tabs >}}
+
+### Supplement
+
+- When `databaseName` is not specified, the default is the currently used
`DATABASE`. If `DATABASE` is not used, `No database selected` will be prompted.
+
+### Return Value Description
+
+| Column | Description |
+|------------|-----------------------------------------------------|
+| database | The database name where the single table is located |
+| count | The count of single table |
+
+### Example
+
+- Query the number of single table rules for specified database.
+
+```sql
+COUNT SINGLE TABLE
+```
+
+```sql
+mysql> COUNT SINGLE TABLE;
++----------+--------+
+| database | count |
++----------+--------+
+| ds | 2 |
++----------+--------+
+1 row in set (0.02 sec)
+```
+
+### Reserved word
+
+`COUNT`, `SINGLE`, `TABLE`, `FROM`
+
+### Related links
+
+- [Reserved
word](/en/user-manual/shardingsphere-proxy/distsql/syntax/reserved-word/)
diff --git
a/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/CountSingleTableRuleResultSet.java
b/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/CountSingleTableResultSet.java
similarity index 62%
rename from
proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/CountSingleTableRuleResultSet.java
rename to
proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/CountSingleTableResultSet.java
index 2e8fa1101e1..c2e0bb00cba 100644
---
a/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/CountSingleTableRuleResultSet.java
+++
b/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/CountSingleTableResultSet.java
@@ -17,8 +17,8 @@
package org.apache.shardingsphere.proxy.backend.handler.distsql.rql.rule;
-import
org.apache.shardingsphere.distsql.parser.statement.rql.show.CountSingleTableRuleStatement;
import
org.apache.shardingsphere.distsql.handler.resultset.DatabaseDistSQLResultSet;
+import
org.apache.shardingsphere.distsql.parser.statement.rql.show.CountSingleTableStatement;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import org.apache.shardingsphere.single.rule.SingleRule;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
@@ -28,43 +28,35 @@ import java.util.Collection;
import java.util.Collections;
import java.util.Iterator;
import java.util.LinkedHashMap;
-import java.util.LinkedList;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
/**
- * Result set for single table rule.
+ * Result set for single table.
*/
-public final class CountSingleTableRuleResultSet implements
DatabaseDistSQLResultSet {
+public final class CountSingleTableResultSet implements
DatabaseDistSQLResultSet {
- private static final String SINGLE_TABLE = "single_table";
+ private Iterator<Entry<String, Integer>> data =
Collections.emptyIterator();
- private Iterator<Entry<String, LinkedList<Object>>> data =
Collections.emptyIterator();
+ private String databaseName;
@Override
public Collection<String> getColumnNames() {
- return Arrays.asList("rule_name", "database", "count");
+ return Arrays.asList("database", "count");
}
@Override
public void init(final ShardingSphereDatabase database, final SQLStatement
sqlStatement) {
Optional<SingleRule> rule =
database.getRuleMetaData().findSingleRule(SingleRule.class);
- Map<String, LinkedList<Object>> result = new LinkedHashMap<>();
- rule.ifPresent(optional -> addSingleTableData(result,
database.getName(), rule.get()));
+ databaseName = database.getName();
+ Map<String, Integer> result = new LinkedHashMap<>();
+ rule.ifPresent(optional -> addSingleTableData(result, databaseName,
rule.get()));
data = result.entrySet().iterator();
}
- private void addSingleTableData(final Map<String, LinkedList<Object>>
rowMap, final String databaseName, final SingleRule rule) {
- rowMap.compute(SINGLE_TABLE, (key, value) -> buildRow(value,
databaseName, rule.getAllTables().size()));
- }
-
- private LinkedList<Object> buildRow(final LinkedList<Object> value, final
String databaseName, final int count) {
- if (null == value) {
- return new LinkedList<>(Arrays.asList(databaseName, count));
- }
- value.set(1, (Integer) value.get(1) + count);
- return value;
+ private void addSingleTableData(final Map<String, Integer> rowMap, final
String databaseName, final SingleRule rule) {
+ rowMap.put(databaseName, rule.getAllTables().size());
}
@Override
@@ -74,13 +66,12 @@ public final class CountSingleTableRuleResultSet implements
DatabaseDistSQLResul
@Override
public Collection<Object> getRowData() {
- Entry<String, LinkedList<Object>> entry = data.next();
- entry.getValue().addFirst(entry.getKey());
- return entry.getValue();
+ Entry<String, Integer> entry = data.next();
+ return Arrays.asList(entry.getKey(), entry.getValue());
}
@Override
public String getType() {
- return CountSingleTableRuleStatement.class.getName();
+ return CountSingleTableStatement.class.getName();
}
}
diff --git
a/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/SingleTableRuleResultSet.java
b/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/SingleTableRuleResultSet.java
index e571a3194ab..6a6ae6e1600 100644
---
a/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/SingleTableRuleResultSet.java
+++
b/proxy/backend/src/main/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/rule/SingleTableRuleResultSet.java
@@ -28,7 +28,7 @@ import java.util.Collections;
import java.util.Iterator;
/**
- * Result set for show single table rule.
+ * Result set for show default single table storage unit.
*/
public final class SingleTableRuleResultSet implements
DatabaseDistSQLResultSet {
diff --git
a/proxy/backend/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.resultset.DistSQLResultSet
b/proxy/backend/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.resultset.DistSQLResultSet
index 04bb9335500..74058cb6ba7 100644
---
a/proxy/backend/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.resultset.DistSQLResultSet
+++
b/proxy/backend/src/main/resources/META-INF/services/org.apache.shardingsphere.distsql.handler.resultset.DistSQLResultSet
@@ -20,5 +20,5 @@
org.apache.shardingsphere.proxy.backend.handler.distsql.rql.rule.LogicalTableRes
org.apache.shardingsphere.proxy.backend.handler.distsql.rql.rule.SingleTableResultSet
org.apache.shardingsphere.proxy.backend.handler.distsql.rql.rule.SingleTableRuleResultSet
org.apache.shardingsphere.proxy.backend.handler.distsql.rql.rule.RulesUsedStorageUnitResultSet
-org.apache.shardingsphere.proxy.backend.handler.distsql.rql.rule.CountSingleTableRuleResultSet
+org.apache.shardingsphere.proxy.backend.handler.distsql.rql.rule.CountSingleTableResultSet
org.apache.shardingsphere.proxy.backend.handler.distsql.ral.queryable.ShowMigrationRuleResultSet
diff --git
a/proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/CountSingleTableRuleResultSetTest.java
b/proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/CountSingleTableResultSetTest.java
similarity index 84%
rename from
proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/CountSingleTableRuleResultSetTest.java
rename to
proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/CountSingleTableResultSetTest.java
index 1d34ea2b57b..9e54583ed60 100644
---
a/proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/CountSingleTableRuleResultSetTest.java
+++
b/proxy/backend/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rql/CountSingleTableResultSetTest.java
@@ -17,10 +17,10 @@
package org.apache.shardingsphere.proxy.backend.handler.distsql.rql;
-import
org.apache.shardingsphere.distsql.parser.statement.rql.show.CountSingleTableRuleStatement;
+import
org.apache.shardingsphere.distsql.parser.statement.rql.show.CountSingleTableStatement;
import
org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
import
org.apache.shardingsphere.infra.metadata.database.rule.ShardingSphereRuleMetaData;
-import
org.apache.shardingsphere.proxy.backend.handler.distsql.rql.rule.CountSingleTableRuleResultSet;
+import
org.apache.shardingsphere.proxy.backend.handler.distsql.rql.rule.CountSingleTableResultSet;
import org.apache.shardingsphere.single.rule.SingleRule;
import org.junit.Test;
@@ -37,18 +37,17 @@ import static org.mockito.Mockito.RETURNS_DEEP_STUBS;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
-public final class CountSingleTableRuleResultSetTest {
+public final class CountSingleTableResultSetTest {
@Test
public void assertGetRowData() {
- CountSingleTableRuleResultSet resultSet = new
CountSingleTableRuleResultSet();
- resultSet.init(mockDatabase(),
mock(CountSingleTableRuleStatement.class));
+ CountSingleTableResultSet resultSet = new CountSingleTableResultSet();
+ resultSet.init(mockDatabase(), mock(CountSingleTableStatement.class));
assertTrue(resultSet.next());
List<Object> actual = new ArrayList<>(resultSet.getRowData());
- assertThat(actual.size(), is(3));
- assertThat(actual.get(0), is("single_table"));
- assertThat(actual.get(1), is("db_1"));
- assertThat(actual.get(2), is(2));
+ assertThat(actual.size(), is(2));
+ assertThat(actual.get(0), is("db_1"));
+ assertThat(actual.get(1), is(2));
assertFalse(resultSet.next());
}
diff --git
a/test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_governance/mysql/count_single_table_rule.xml
b/test/e2e/suite/src/test/resources/cases/rql/dataset/db/count_single_table.xml
similarity index 92%
copy from
test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_governance/mysql/count_single_table_rule.xml
copy to
test/e2e/suite/src/test/resources/cases/rql/dataset/db/count_single_table.xml
index 187c67c7145..ac2ecc9c227 100644
---
a/test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_governance/mysql/count_single_table_rule.xml
+++
b/test/e2e/suite/src/test/resources/cases/rql/dataset/db/count_single_table.xml
@@ -17,9 +17,8 @@
<dataset>
<metadata>
- <column name="rule_name" />
<column name="database" />
<column name="count" />
</metadata>
- <row values="single_table| db| 3" />
+ <row values="db| 11" />
</dataset>
diff --git
a/test/e2e/suite/src/test/resources/cases/rql/dataset/db/count_single_table_rule.xml
b/test/e2e/suite/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting/count_single_table.xml
similarity index 92%
rename from
test/e2e/suite/src/test/resources/cases/rql/dataset/db/count_single_table_rule.xml
rename to
test/e2e/suite/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting/count_single_table.xml
index 5e9c22908e4..3352bc51b64 100644
---
a/test/e2e/suite/src/test/resources/cases/rql/dataset/db/count_single_table_rule.xml
+++
b/test/e2e/suite/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting/count_single_table.xml
@@ -17,9 +17,8 @@
<dataset>
<metadata>
- <column name="rule_name" />
<column name="database" />
<column name="count" />
</metadata>
- <row values="single_table| db| 11" />
+ <row values="dbtbl_with_readwrite_splitting| 7" />
</dataset>
diff --git
a/test/e2e/suite/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting/count_single_table_rule.xml
b/test/e2e/suite/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting/count_single_table_rule.xml
deleted file mode 100644
index 2d540154c97..00000000000
---
a/test/e2e/suite/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting/count_single_table_rule.xml
+++ /dev/null
@@ -1,25 +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.
- -->
-
-<dataset>
- <metadata>
- <column name="rule_name" />
- <column name="database" />
- <column name="count" />
- </metadata>
- <row values="single_table| dbtbl_with_readwrite_splitting| 7" />
-</dataset>
diff --git
a/test/e2e/suite/src/test/resources/cases/rql/dataset/tbl/count_single_table_rule.xml
b/test/e2e/suite/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/count_single_table.xml
similarity index 92%
rename from
test/e2e/suite/src/test/resources/cases/rql/dataset/tbl/count_single_table_rule.xml
rename to
test/e2e/suite/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/count_single_table.xml
index bb6b6ac4d2c..36bad4ecb87 100644
---
a/test/e2e/suite/src/test/resources/cases/rql/dataset/tbl/count_single_table_rule.xml
+++
b/test/e2e/suite/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/count_single_table.xml
@@ -17,9 +17,8 @@
<dataset>
<metadata>
- <column name="rule_name" />
<column name="database" />
<column name="count" />
</metadata>
- <row values="single_table| tbl| 1" />
+ <row values="dbtbl_with_readwrite_splitting_and_encrypt| 8" />
</dataset>
diff --git
a/test/e2e/suite/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/count_single_table_rule.xml
b/test/e2e/suite/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/count_single_table_rule.xml
deleted file mode 100644
index dc84c2e4e2e..00000000000
---
a/test/e2e/suite/src/test/resources/cases/rql/dataset/dbtbl_with_readwrite_splitting_and_encrypt/count_single_table_rule.xml
+++ /dev/null
@@ -1,25 +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.
- -->
-
-<dataset>
- <metadata>
- <column name="rule_name" />
- <column name="database" />
- <column name="count" />
- </metadata>
- <row values="single_table| dbtbl_with_readwrite_splitting_and_encrypt| 8"
/>
-</dataset>
diff --git
a/test/e2e/suite/src/test/resources/cases/rql/dataset/encrypt/count_single_table_rule.xml
b/test/e2e/suite/src/test/resources/cases/rql/dataset/encrypt/count_single_table.xml
similarity index 91%
rename from
test/e2e/suite/src/test/resources/cases/rql/dataset/encrypt/count_single_table_rule.xml
rename to
test/e2e/suite/src/test/resources/cases/rql/dataset/encrypt/count_single_table.xml
index b9874c89eec..47431b524f9 100644
---
a/test/e2e/suite/src/test/resources/cases/rql/dataset/encrypt/count_single_table_rule.xml
+++
b/test/e2e/suite/src/test/resources/cases/rql/dataset/encrypt/count_single_table.xml
@@ -17,9 +17,8 @@
<dataset>
<metadata>
- <column name="rule_name" />
<column name="database" />
<column name="count" />
</metadata>
- <row values="single_table| encrypt| 4" />
+ <row values="encrypt| 4" />
</dataset>
diff --git
a/test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_governance/mysql/count_single_table_rule.xml
b/test/e2e/suite/src/test/resources/cases/rql/dataset/encrypt_and_readwrite_splitting/count_single_table.xml
similarity index 92%
copy from
test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_governance/mysql/count_single_table_rule.xml
copy to
test/e2e/suite/src/test/resources/cases/rql/dataset/encrypt_and_readwrite_splitting/count_single_table.xml
index 187c67c7145..8a677adff14 100644
---
a/test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_governance/mysql/count_single_table_rule.xml
+++
b/test/e2e/suite/src/test/resources/cases/rql/dataset/encrypt_and_readwrite_splitting/count_single_table.xml
@@ -17,9 +17,8 @@
<dataset>
<metadata>
- <column name="rule_name" />
<column name="database" />
<column name="count" />
</metadata>
- <row values="single_table| db| 3" />
+ <row values="encrypt_and_readwrite_splitting| 11" />
</dataset>
diff --git
a/test/e2e/suite/src/test/resources/cases/rql/dataset/encrypt_and_readwrite_splitting/count_single_table_rule.xml
b/test/e2e/suite/src/test/resources/cases/rql/dataset/encrypt_and_readwrite_splitting/count_single_table_rule.xml
deleted file mode 100644
index ab8301f068d..00000000000
---
a/test/e2e/suite/src/test/resources/cases/rql/dataset/encrypt_and_readwrite_splitting/count_single_table_rule.xml
+++ /dev/null
@@ -1,25 +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.
- -->
-
-<dataset>
- <metadata>
- <column name="rule_name" />
- <column name="database" />
- <column name="count" />
- </metadata>
- <row values="single_table| encrypt_and_readwrite_splitting| 11" />
-</dataset>
diff --git
a/test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_governance/mysql/count_single_table_rule.xml
b/test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_and_encrypt/count_single_table.xml
similarity index 92%
copy from
test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_governance/mysql/count_single_table_rule.xml
copy to
test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_and_encrypt/count_single_table.xml
index 187c67c7145..3295831249e 100644
---
a/test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_governance/mysql/count_single_table_rule.xml
+++
b/test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_and_encrypt/count_single_table.xml
@@ -17,9 +17,8 @@
<dataset>
<metadata>
- <column name="rule_name" />
<column name="database" />
<column name="count" />
</metadata>
- <row values="single_table| db| 3" />
+ <row values="sharding_and_encrypt| 6" />
</dataset>
diff --git
a/test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_and_encrypt/count_single_table_rule.xml
b/test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_and_encrypt/count_single_table_rule.xml
deleted file mode 100644
index 498290fa86c..00000000000
---
a/test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_and_encrypt/count_single_table_rule.xml
+++ /dev/null
@@ -1,25 +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.
- -->
-
-<dataset>
- <metadata>
- <column name="rule_name" />
- <column name="database" />
- <column name="count" />
- </metadata>
- <row values="single_table| sharding_and_encrypt| 6" />
-</dataset>
diff --git
a/test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_governance/mysql/count_single_table_rule.xml
b/test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_governance/mysql/count_single_table.xml
similarity index 92%
copy from
test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_governance/mysql/count_single_table_rule.xml
copy to
test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_governance/mysql/count_single_table.xml
index 187c67c7145..e1101e51250 100644
---
a/test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_governance/mysql/count_single_table_rule.xml
+++
b/test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_governance/mysql/count_single_table.xml
@@ -17,9 +17,8 @@
<dataset>
<metadata>
- <column name="rule_name" />
<column name="database" />
<column name="count" />
</metadata>
- <row values="single_table| db| 3" />
+ <row values="db| 3" />
</dataset>
diff --git
a/test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_governance/mysql/count_single_table_rule.xml
b/test/e2e/suite/src/test/resources/cases/rql/dataset/tbl/count_single_table.xml
similarity index 92%
rename from
test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_governance/mysql/count_single_table_rule.xml
rename to
test/e2e/suite/src/test/resources/cases/rql/dataset/tbl/count_single_table.xml
index 187c67c7145..0935bc538f9 100644
---
a/test/e2e/suite/src/test/resources/cases/rql/dataset/sharding_governance/mysql/count_single_table_rule.xml
+++
b/test/e2e/suite/src/test/resources/cases/rql/dataset/tbl/count_single_table.xml
@@ -17,9 +17,8 @@
<dataset>
<metadata>
- <column name="rule_name" />
<column name="database" />
<column name="count" />
</metadata>
- <row values="single_table| db| 3" />
+ <row values="tbl| 1" />
</dataset>
diff --git
a/test/e2e/suite/src/test/resources/cases/rql/rql-integration-test-cases.xml
b/test/e2e/suite/src/test/resources/cases/rql/rql-integration-test-cases.xml
index 3ac400cfaf2..704be14ca66 100644
--- a/test/e2e/suite/src/test/resources/cases/rql/rql-integration-test-cases.xml
+++ b/test/e2e/suite/src/test/resources/cases/rql/rql-integration-test-cases.xml
@@ -101,8 +101,8 @@
<assertion expected-data-file="show_single_tables.xml" />
</test-case>
- <test-case sql="COUNT SINGLE_TABLE RULE"
scenario-types="db,tbl,encrypt,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,sharding_and_encrypt,encrypt_and_readwrite_splitting">
- <assertion expected-data-file="count_single_table_rule.xml" />
+ <test-case sql="COUNT SINGLE TABLE"
scenario-types="db,tbl,encrypt,dbtbl_with_readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt,sharding_and_encrypt,encrypt_and_readwrite_splitting">
+ <assertion expected-data-file="count_single_table.xml" />
</test-case>
<test-case sql="SHOW READWRITE_SPLITTING RULES"
scenario-types="dbtbl_with_readwrite_splitting,readwrite_splitting,dbtbl_with_readwrite_splitting_and_encrypt">
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
index 14a6bbac5d3..447e3a464c3 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
@@ -411,7 +411,7 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.s
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.rql.rule.sharding.ShowUnusedShardingAlgorithmsStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.rql.rule.sharding.ShowUnusedShardingAuditorsStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.rql.rule.sharding.ShowUnusedShardingKeyGeneratorsStatementTestCase;
-import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.rql.rule.single.CountSingleTableRuleStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.rql.rule.single.CountSingleTableStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.rql.rule.single.ShowDefaultSingleTableStorageUnitStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.rql.rule.single.ShowSingleTableStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.rul.FormatSQLStatementTestCase;
@@ -1591,8 +1591,8 @@ public final class RootSQLParserTestCases {
@XmlElement(name = "create-access-method")
private final List<CreateAccessMethodStatementTestCase>
createAccessMethodTestCases = new LinkedList<>();
- @XmlElement(name = "count-single-table-rule")
- private final List<CountSingleTableRuleStatementTestCase>
countSingleTableRuleStatementTestCases = new LinkedList<>();
+ @XmlElement(name = "count-single-table")
+ private final List<CountSingleTableStatementTestCase>
countSingleTableStatementTestCases = new LinkedList<>();
@XmlElement(name = "count-sharding-rule")
private final List<CountShardingRuleStatementTestCase>
countShardingRuleStatementTestCases = new LinkedList<>();
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/rql/rule/single/CountSingleTableRuleStatementTestCase.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/rql/rule/single/CountSingleTableStatementTestCase.java
similarity index 88%
rename from
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/rql/rule/single/CountSingleTableRuleStatementTestCase.java
rename to
test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/rql/rule/single/CountSingleTableStatementTestCase.java
index d6079645b78..3550dd27ce3 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/rql/rule/single/CountSingleTableRuleStatementTestCase.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/statement/rql/rule/single/CountSingleTableStatementTestCase.java
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.DatabaseContainedTestCase;
/**
- * Count single table rule statement test case.
+ * Count single table statement test case.
*/
-public final class CountSingleTableRuleStatementTestCase extends
DatabaseContainedTestCase {
+public final class CountSingleTableStatementTestCase extends
DatabaseContainedTestCase {
}
diff --git a/test/it/parser/src/main/resources/case/rql/show.xml
b/test/it/parser/src/main/resources/case/rql/show.xml
index bf7e8455fc4..fa9be936a9c 100644
--- a/test/it/parser/src/main/resources/case/rql/show.xml
+++ b/test/it/parser/src/main/resources/case/rql/show.xml
@@ -139,9 +139,9 @@
<database name="sharding_db" start-index="61" stop-index="71" />
</show-sharding-table-rules-used-algorithm>
- <count-single-table-rule sql-case-id="count-single-table-rule">
- <database name="db1" start-index="29" stop-index="31" />
- </count-single-table-rule>
+ <count-single-table sql-case-id="count-single-table">
+ <database name="db1" start-index="24" stop-index="26" />
+ </count-single-table>
<count-sharding-rule sql-case-id="count-sharding-rule">
<database name="db1" start-index="25" stop-index="27" />
diff --git a/test/it/parser/src/main/resources/sql/supported/rql/show.xml
b/test/it/parser/src/main/resources/sql/supported/rql/show.xml
index 5ae330176d9..fa69be7609c 100644
--- a/test/it/parser/src/main/resources/sql/supported/rql/show.xml
+++ b/test/it/parser/src/main/resources/sql/supported/rql/show.xml
@@ -47,7 +47,7 @@
<sql-case id="show-sharding-table-rules-used-key-generator" value="SHOW
SHARDING TABLE RULES USED KEY GENERATOR snowflake_key_generator FROM
sharding_db" db-types="ShardingSphere" />
<sql-case id="show-sharding-table-rules-used-auditor" value="SHOW SHARDING
TABLE RULES USED AUDITOR shardingKeyAudit FROM sharding_db"
db-types="ShardingSphere" />
<sql-case id="show-sharding-table-rules-used-algorithm" value="SHOW
SHARDING TABLE RULES USED ALGORITHM t_order_inline FROM sharding_db"
db-types="ShardingSphere" />
- <sql-case id="count-single-table-rule" value="COUNT SINGLE_TABLE RULE FROM
db1" db-types="ShardingSphere" />
+ <sql-case id="count-single-table" value="COUNT SINGLE TABLE FROM db1"
db-types="ShardingSphere" />
<sql-case id="count-sharding-rule" value="COUNT SHARDING RULE FROM db1"
db-types="ShardingSphere" />
<sql-case id="count-readwrite-splitting-rule" value="COUNT
READWRITE_SPLITTING RULE FROM db1" db-types="ShardingSphere" />
<sql-case id="count-db-discovery-rule" value="COUNT DB_DISCOVERY RULE FROM
db1" db-types="ShardingSphere" />