You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by du...@apache.org on 2023/05/16 05:30:03 UTC

[shardingsphere] branch master updated: Optimize BaseRule.g4 support CREATE TABLE with GEOMCOLLECTION. (#25689)

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 f9b13dc4480 Optimize BaseRule.g4 support CREATE TABLE with GEOMCOLLECTION. (#25689)
f9b13dc4480 is described below

commit f9b13dc4480d5969d7924b4975f728eedd3aae60
Author: Cong Hu <ia...@qq.com>
AuthorDate: Tue May 16 13:29:53 2023 +0800

    Optimize BaseRule.g4 support CREATE TABLE with GEOMCOLLECTION. (#25689)
---
 parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/BaseRule.g4 | 2 +-
 .../dialect/mysql/src/main/antlr4/imports/mysql/MySQLKeyword.g4    | 4 ++++
 test/it/parser/src/main/resources/case/ddl/create-table.xml        | 7 +++++++
 .../parser/src/main/resources/sql/supported/ddl/create-table.xml   | 1 +
 4 files changed, 13 insertions(+), 1 deletion(-)

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 66a80d1d4fe..3528828ef9e 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
@@ -1185,7 +1185,7 @@ dataType
     | dataTypeName = LONGTEXT charsetWithOptBinary?
     | dataTypeName = ENUM stringList charsetWithOptBinary?
     | dataTypeName = SET stringList charsetWithOptBinary?
-    | dataTypeName = (SERIAL | JSON | GEOMETRY | GEOMETRYCOLLECTION | POINT | MULTIPOINT | LINESTRING | MULTILINESTRING | POLYGON | MULTIPOLYGON)
+    | dataTypeName = (SERIAL | JSON | GEOMETRY | GEOMCOLLECTION | GEOMETRYCOLLECTION | POINT | MULTIPOINT | LINESTRING | MULTILINESTRING | POLYGON | MULTIPOLYGON)
     ;
     
 stringList
diff --git a/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/MySQLKeyword.g4 b/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/MySQLKeyword.g4
index a2773e2cb2a..0806f8e0049 100644
--- a/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/MySQLKeyword.g4
+++ b/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/MySQLKeyword.g4
@@ -867,6 +867,10 @@ GEOMETRY
     : G E O M E T R Y
     ;
 
+GEOMCOLLECTION
+    : G E O M C O L L E C T I O N
+    ;
+
 GEOMETRYCOLLECTION
     : G E O M E T R Y C O L L E C T I O N
     ;
diff --git a/test/it/parser/src/main/resources/case/ddl/create-table.xml b/test/it/parser/src/main/resources/case/ddl/create-table.xml
index 1a353acd2aa..d50b77b19aa 100644
--- a/test/it/parser/src/main/resources/case/ddl/create-table.xml
+++ b/test/it/parser/src/main/resources/case/ddl/create-table.xml
@@ -1807,4 +1807,11 @@
             <column name="status" />
         </column-definition>
     </create-table>
+
+    <create-table sql-case-id="create_table_with_geomcollection">
+        <table name="t1" start-index="13" stop-index="14" />
+        <column-definition type="GEOMCOLLECTION" start-index="17" stop-index="32">
+            <column name="g" />
+        </column-definition>
+    </create-table>
 </sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/ddl/create-table.xml b/test/it/parser/src/main/resources/sql/supported/ddl/create-table.xml
index 7c9b66511f7..36346ab968f 100644
--- a/test/it/parser/src/main/resources/sql/supported/ddl/create-table.xml
+++ b/test/it/parser/src/main/resources/sql/supported/ddl/create-table.xml
@@ -129,4 +129,5 @@
     <sql-case id="create_table_with_invisible" value="CREATE TABLE t_order (order_id INT, user_id INT, status VARCHAR(10) INVISIBLE) ENGINE=INNODB" db-types="MySQL" />
     <sql-case id="create_table_with_varchar2_char_and_byte_type" value="CREATE TABLE t_order (SYS_ID VARCHAR2(32 CHAR) VISIBLE NOT NULL, ATTACHMENT_NAME VARCHAR2(1024 BYTE) VISIBLE DEFAULT '')" db-types="Oracle" />
     <sql-case id="create_table_with_character_varying" value="CREATE TABLE t_order (order_id INT, user_id INT, status CHARACTER VARYING(50))" db-types="MySQL" />
+    <sql-case id="create_table_with_geomcollection" value="CREATE TABLE t1 (g GEOMCOLLECTION)" db-types="MySQL" />
 </sql-cases>