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 280c2c70388 Added and updated syntax parsing rules to support MySQL 
tablespace modification operations. (#31047)
280c2c70388 is described below

commit 280c2c703888d35f9606a2aa5894c22fbc8cc8d4
Author: zhuruixuan <[email protected]>
AuthorDate: Mon Apr 29 08:01:38 2024 +0800

    Added and updated syntax parsing rules to support MySQL tablespace 
modification operations. (#31047)
---
 .../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       | 4 ++++
 3 files changed, 12 insertions(+), 2 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 06264b80739..e7a11ad48e8 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,8 +377,10 @@ alterTablespace
 
 alterTablespaceNdb
     : ALTER UNDO? TABLESPACE tablespace=identifier
-      (ADD | DROP) DATAFILE string_
-      (INITIAL_SIZE EQ_ fileSizeLiteral)?
+      ((ADD | DROP) DATAFILE string_)?
+      (INITIAL_SIZE EQ_? fileSizeLiteral)?
+      (AUTOEXTEND_SIZE EQ_? fileSizeLiteral)?
+      (ENGINE_ATTRIBUTE EQ_? string_)?
       WAIT? (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 7c9dccc0ec1..cc570547409 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
@@ -149,4 +149,8 @@
     <alter-tablespace sql-case-id="alter_tablespace_add_tempfile_size_m_reuse">
         <tablespace start-index="17" stop-index="22" name="lmtemp" />
     </alter-tablespace>
+    
+    <alter-tablespace sql-case-id="alter_tablespace_with_initial_size">
+        <tablespace start-index="17" stop-index="20" name="ts_1" />
+    </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 395fefe68c7..42104be12fb 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
@@ -62,4 +62,8 @@
     <sql-case id="alter_tablespace_add_datafile_size_m" value="ALTER 
TABLESPACE lmtbsb ADD DATAFILE '/u02/oracle/data/lmtbsb02.dbf' SIZE 1M" 
db-types="Oracle" />
     <sql-case id="alter_tablespace_nologging" value="ALTER TABLESPACE tbs_03 
NOLOGGING" db-types="Oracle" />
     <sql-case id="alter_tablespace_add_tempfile_size_m_reuse" value="ALTER 
TABLESPACE lmtemp ADD TEMPFILE '/u02/oracle/data/lmtemp02.dbf' SIZE 18M REUSE" 
db-types="Oracle" />
+    <sql-case id ="alter_tablespace_with_initial_size" value="ALTER TABLESPACE 
ts_1
+        ADD DATAFILE 'data_2.dat'
+        INITIAL_SIZE 48M
+        ENGINE NDB" db-types="MySQL" />
 </sql-cases>

Reply via email to