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 2024/04/29 06:11:24 UTC

(shardingsphere) branch master updated: Modifications in DDLStatement.g4 (#31052)

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 47ece1c1b72 Modifications in DDLStatement.g4 (#31052)
47ece1c1b72 is described below

commit 47ece1c1b72be7b8ae572e731c4301eefba6f547
Author: zhuruixuan <14...@users.noreply.github.com>
AuthorDate: Mon Apr 29 14:11:19 2024 +0800

    Modifications in DDLStatement.g4 (#31052)
---
 .../sql/dialect/mysql/src/main/antlr4/imports/mysql/DDLStatement.g4 | 6 +++---
 test/it/parser/src/main/resources/case/ddl/alter-tablespace.xml     | 4 ++++
 .../src/main/resources/sql/supported/ddl/alter-tablespace.xml       | 1 +
 3 files changed, 8 insertions(+), 3 deletions(-)

diff --git a/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/DDLStatement.g4 b/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/DDLStatement.g4
index e7a11ad48e8..e9fa1506c4b 100644
--- a/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/DDLStatement.g4
+++ b/parser/sql/dialect/mysql/src/main/antlr4/imports/mysql/DDLStatement.g4
@@ -377,10 +377,8 @@ alterTablespace
 
 alterTablespaceNdb
     : ALTER UNDO? TABLESPACE tablespace=identifier
-      ((ADD | DROP) DATAFILE string_)?
+      (ADD | DROP) DATAFILE string_
       (INITIAL_SIZE EQ_? fileSizeLiteral)?
-      (AUTOEXTEND_SIZE EQ_? fileSizeLiteral)?
-      (ENGINE_ATTRIBUTE EQ_? string_)?
       WAIT? (RENAME TO renameTableSpace=identifier)?
       (ENGINE EQ_? identifier)?
     ;
@@ -388,7 +386,9 @@ alterTablespaceNdb
 alterTablespaceInnodb
     : ALTER UNDO? TABLESPACE tablespace=identifier
       (SET (ACTIVE | INACTIVE))?
+      (AUTOEXTEND_SIZE EQ_? fileSizeLiteral)?
       (ENCRYPTION EQ_? y_or_n=string_)?
+      (ENGINE_ATTRIBUTE EQ_? jsonAttribute = string_)?
       (RENAME TO renameTablespace=identifier)?
       (ENGINE EQ_? identifier)?
     ;
diff --git a/test/it/parser/src/main/resources/case/ddl/alter-tablespace.xml b/test/it/parser/src/main/resources/case/ddl/alter-tablespace.xml
index cc570547409..4fc7771a57a 100644
--- a/test/it/parser/src/main/resources/case/ddl/alter-tablespace.xml
+++ b/test/it/parser/src/main/resources/case/ddl/alter-tablespace.xml
@@ -153,4 +153,8 @@
     <alter-tablespace sql-case-id="alter_tablespace_with_initial_size">
         <tablespace start-index="17" stop-index="20" name="ts_1" />
     </alter-tablespace>
+    
+    <alter-tablespace sql-case-id="alter_tablespace_with_engine_attribute">
+        <tablespace start-index="17" stop-index="19" name="ts1" />
+    </alter-tablespace>
 </sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/ddl/alter-tablespace.xml b/test/it/parser/src/main/resources/sql/supported/ddl/alter-tablespace.xml
index 42104be12fb..b08d1e79556 100644
--- a/test/it/parser/src/main/resources/sql/supported/ddl/alter-tablespace.xml
+++ b/test/it/parser/src/main/resources/sql/supported/ddl/alter-tablespace.xml
@@ -66,4 +66,5 @@
         ADD DATAFILE 'data_2.dat'
         INITIAL_SIZE 48M
         ENGINE NDB" db-types="MySQL" />
+    <sql-case id="alter_tablespace_with_engine_attribute" value="ALTER TABLESPACE ts1 ENGINE_ATTRIBUTE=&apos;{&quot;key&quot;:&quot;value&quot;}&apos;" db-types="MySQL" />
 </sql-cases>