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

menghaoran 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 128f726  Add more RQL parser tests in DistSQLStatementParserEngineTest 
(#10508)
128f726 is described below

commit 128f7261fd645c18b667d663860e8ee713ea6ede
Author: JooKS <[email protected]>
AuthorDate: Fri May 28 11:06:38 2021 +0800

    Add more RQL parser tests in DistSQLStatementParserEngineTest (#10508)
---
 .../api/DistSQLStatementParserEngineTest.java      | 29 ++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/test/java/org/apache/shardingsphere/distsql/parser/api/DistSQLStatementParserEngineTest.java
 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/test/java/org/apache/shardingsphere/distsql/parser/api/DistSQLStatementParserEngineTest.java
index 94bb881..841d75d 100644
--- 
a/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/test/java/org/apache/shardingsphere/distsql/parser/api/DistSQLStatementParserEngineTest.java
+++ 
b/shardingsphere-distsql-parser/shardingsphere-distsql-parser-engine/src/test/java/org/apache/shardingsphere/distsql/parser/api/DistSQLStatementParserEngineTest.java
@@ -46,6 +46,7 @@ import 
org.apache.shardingsphere.distsql.parser.statement.rdl.drop.impl.DropShar
 import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowDatabaseDiscoveryRulesStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowEncryptRulesStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowReadwriteSplittingRulesStatement;
+import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowShardingTableRulesStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowShardingBindingTableRulesStatement;
 import 
org.apache.shardingsphere.distsql.parser.statement.rql.show.ShowShardingBroadcastTableRulesStatement;
 import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
@@ -160,6 +161,12 @@ public final class DistSQLStatementParserEngineTest {
 
     private static final String RQL_SHOW_SHARDING_BROADCAST_TABLE_RULES = 
"SHOW SHARDING BROADCAST TABLE RULES FROM sharding_db";
 
+    private static final String RQL_SHOW_SHARDING_TABLE_RULES = "SHOW SHARDING 
TABLE RULES FROM schemaName";
+
+    private static final String RQL_SHOW_SHARDING_TABLE_RULE = "SHOW SHARDING 
TABLE RULE t_order";
+
+    private static final String RQL_SHOW_SHARDING_TABLE_RULE_FROM = "SHOW 
SHARDING TABLE RULE t_order FROM schemaName";
+
     private static final String RQL_SHOW_READWRITE_SPLITTING_RULES = "SHOW 
READWRITE_SPLITTING RULES FROM readwrite_splitting_db";
 
     private static final String RQL_SHOW_DB_DISCOVERY_RULES = "SHOW 
DB_DISCOVERY RULES FROM db_discovery_db";
@@ -433,6 +440,28 @@ public final class DistSQLStatementParserEngineTest {
     }
 
     @Test
+    public void assertParseShowShardingTableRules() {
+        SQLStatement sqlStatement = 
engine.parse(RQL_SHOW_SHARDING_TABLE_RULES);
+        assertTrue(sqlStatement instanceof ShowShardingTableRulesStatement);
+        assertThat(((ShowShardingTableRulesStatement) 
sqlStatement).getSchema().get().getIdentifier().getValue(), is("schemaName"));
+    }
+
+    @Test
+    public void assertParseShowShardingTableRule() {
+        SQLStatement sqlStatement = engine.parse(RQL_SHOW_SHARDING_TABLE_RULE);
+        assertTrue(sqlStatement instanceof ShowShardingTableRulesStatement);
+        assertThat(((ShowShardingTableRulesStatement) 
sqlStatement).getTableName(), is("t_order"));
+    }
+
+    @Test
+    public void assertParseShowShardingTableRuleFrom() {
+        SQLStatement sqlStatement = 
engine.parse(RQL_SHOW_SHARDING_TABLE_RULE_FROM);
+        assertTrue(sqlStatement instanceof ShowShardingTableRulesStatement);
+        assertThat(((ShowShardingTableRulesStatement) 
sqlStatement).getTableName(), is("t_order"));
+        assertThat(((ShowShardingTableRulesStatement) 
sqlStatement).getSchema().get().getIdentifier().getValue(), is("schemaName"));
+    }
+
+    @Test
     public void assertParseShowShardingBindingTableRules() {
         SQLStatement sqlStatement = 
engine.parse(RQL_SHOW_SHARDING_BINDING_TABLE_RULES);
         assertTrue(sqlStatement instanceof 
ShowShardingBindingTableRulesStatement);

Reply via email to