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

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


The following commit(s) were added to refs/heads/master by this push:
     new 41c38400e2d Fix mysql groups and rank keywords (#27093)
41c38400e2d is described below

commit 41c38400e2d6d826fcdc7b2bbbcd65d8f61e6b19
Author: ZhangCheng <[email protected]>
AuthorDate: Thu Jul 13 22:00:25 2023 +0800

    Fix mysql groups and rank keywords (#27093)
    
    * Fix mysql groups and rank keywords
    
    * fix
---
 .../mysql/src/main/antlr4/imports/mysql/BaseRule.g4        |  2 ++
 test/it/parser/src/main/resources/case/dml/select.xml      | 14 ++++++++++++++
 .../parser/src/main/resources/sql/supported/dml/select.xml |  1 +
 3 files changed, 17 insertions(+)

diff --git a/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/BaseRule.g4 
b/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/BaseRule.g4
index 56a065269b8..a0984357c00 100644
--- a/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/BaseRule.g4
+++ b/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/BaseRule.g4
@@ -243,6 +243,7 @@ identifierKeywordsUnambiguous
     | GET_MASTER_PUBLIC_KEY
     | GRANTS
     | GROUP_REPLICATION
+    | GROUPS
     | HASH
     | HISTOGRAM
     | HISTORY
@@ -382,6 +383,7 @@ identifierKeywordsUnambiguous
     | QUERY
     | QUICK
     | RANDOM
+    | RANK
     | READ_ONLY
     | REBUILD
     | RECOVER
diff --git a/test/it/parser/src/main/resources/case/dml/select.xml 
b/test/it/parser/src/main/resources/case/dml/select.xml
index 489313c0c72..d76f2710697 100644
--- a/test/it/parser/src/main/resources/case/dml/select.xml
+++ b/test/it/parser/src/main/resources/case/dml/select.xml
@@ -5132,4 +5132,18 @@
             </expr>
         </where>
     </select>
+
+    <select sql-case-id="select_with_keyword_groups_and_rank">
+        <from>
+            <simple-table alias="t" name="t_order" start-index="29" 
stop-index="37" literal-start-index="29" literal-stop-index="37"/>
+        </from>
+        <projections distinct-row="false" start-index="7" stop-index="22" 
literal-start-index="7" literal-stop-index="22">
+            <column-projection name="groups" start-index="7" stop-index="14" 
literal-start-index="7" literal-stop-index="14">
+                <owner name="t" start-index="7" stop-index="7" 
literal-start-index="7" literal-stop-index="7"/>
+            </column-projection>
+            <column-projection name="rank" start-index="17" stop-index="22" 
literal-start-index="17" literal-stop-index="22">
+                <owner name="t" start-index="17" stop-index="17" 
literal-start-index="17" literal-stop-index="17"/>
+            </column-projection>
+        </projections>
+    </select>
 </sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/dml/select.xml 
b/test/it/parser/src/main/resources/sql/supported/dml/select.xml
index 8c4afc8e6d5..c61a112481e 100644
--- a/test/it/parser/src/main/resources/sql/supported/dml/select.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dml/select.xml
@@ -171,4 +171,5 @@
     <sql-case id="select_projection_with_parameter" value="SELECT 1 AS id, ? 
AS status, SYSDATE AS create_time, TRUNC(SYSDATE) AS create_date FROM DUAL" 
db-types="Oracle"  />
     <sql-case id="select_with_chinese_comma" value="SELECT 1, 2,3 FROM DUAL" 
db-types="Oracle"  />
     <sql-case id="select_with_keyword_system" value="SELECT * FROM vtx_project 
WHERE system = ?" />
+    <sql-case id="select_with_keyword_groups_and_rank" value="SELECT t.groups, 
t.rank FROM t_order t" db-types="MySQL" />
 </sql-cases>

Reply via email to