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 3508cccef7e Create tablespace relative location (#29557)
3508cccef7e is described below

commit 3508cccef7ec7d567d1430569e41429063f887b1
Author: dshunter107 <[email protected]>
AuthorDate: Wed Jan 24 06:36:51 2024 -0500

    Create tablespace relative location (#29557)
    
    * Adds Relative Location to Create TableSpace
    
    This first commit adds the keyword "Relative" as an  option when
    creating a tablespace in openGauss
    
    * gets rid of a stray semicolon
    
    * fixes spotless check failure
---
 .../src/main/antlr4/imports/opengauss/DDLStatement.g4   |  2 +-
 .../visitor/statement/OpenGaussStatementVisitor.java    | 17 +++++++++--------
 .../src/main/resources/case/ddl/create-tablespace.xml   |  1 +
 .../resources/sql/supported/ddl/create-tablespace.xml   |  1 +
 4 files changed, 12 insertions(+), 9 deletions(-)

diff --git 
a/parser/sql/dialect/opengauss/src/main/antlr4/imports/opengauss/DDLStatement.g4
 
b/parser/sql/dialect/opengauss/src/main/antlr4/imports/opengauss/DDLStatement.g4
index 6bc716b689a..448463f3a5a 100644
--- 
a/parser/sql/dialect/opengauss/src/main/antlr4/imports/opengauss/DDLStatement.g4
+++ 
b/parser/sql/dialect/opengauss/src/main/antlr4/imports/opengauss/DDLStatement.g4
@@ -1591,7 +1591,7 @@ createSubscription
     ;
 
 createTablespace
-    : CREATE TABLESPACE name (OWNER roleSpec)? LOCATION STRING_ (WITH 
reloptions)? (MAXSIZE EQ_? fileSizeLiteral)?
+    : CREATE TABLESPACE name (OWNER roleSpec)? RELATIVE? LOCATION STRING_ 
(WITH reloptions)? (MAXSIZE EQ_? fileSizeLiteral)?
     ;
 
 createTextSearch
diff --git 
a/parser/sql/dialect/opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/OpenGaussStatementVisitor.java
 
b/parser/sql/dialect/opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/OpenGaussStatementVisitor.java
index d143f6c514b..84884704621 100644
--- 
a/parser/sql/dialect/opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/OpenGaussStatementVisitor.java
+++ 
b/parser/sql/dialect/opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/OpenGaussStatementVisitor.java
@@ -17,8 +17,13 @@
 
 package org.apache.shardingsphere.sql.parser.opengauss.visitor.statement;
 
-import lombok.AccessLevel;
-import lombok.Getter;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.Collections;
+import java.util.LinkedList;
+import java.util.List;
+import java.util.Optional;
+
 import org.antlr.v4.runtime.ParserRuleContext;
 import org.antlr.v4.runtime.misc.Interval;
 import org.antlr.v4.runtime.tree.ParseTree;
@@ -194,12 +199,8 @@ import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.dml.
 import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.dml.OpenGaussSelectStatement;
 import 
org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.dml.OpenGaussUpdateStatement;
 
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.Collections;
-import java.util.LinkedList;
-import java.util.List;
-import java.util.Optional;
+import lombok.AccessLevel;
+import lombok.Getter;
 
 /**
  * Statement visitor for openGauss.
diff --git a/test/it/parser/src/main/resources/case/ddl/create-tablespace.xml 
b/test/it/parser/src/main/resources/case/ddl/create-tablespace.xml
index 474213dfde1..cd0dd9f5c92 100644
--- a/test/it/parser/src/main/resources/case/ddl/create-tablespace.xml
+++ b/test/it/parser/src/main/resources/case/ddl/create-tablespace.xml
@@ -99,4 +99,5 @@
     <create-tablespace 
sql-case-id="create_tablespace_with_undo_tablespace_extent_uniform" />
     <create-tablespace 
sql-case-id="create_tablespace_with_undo_tablespace_retention_guarantee" />
     <create-tablespace 
sql-case-id="create_tablespace_with_undo_tablespace_retention_noguarantee" />
+    <create-tablespace sql-case-id="create_tablespace_with_relative_location" 
/>
 </sql-parser-test-cases>
diff --git 
a/test/it/parser/src/main/resources/sql/supported/ddl/create-tablespace.xml 
b/test/it/parser/src/main/resources/sql/supported/ddl/create-tablespace.xml
index b447e4f742e..8de2510b688 100644
--- a/test/it/parser/src/main/resources/sql/supported/ddl/create-tablespace.xml
+++ b/test/it/parser/src/main/resources/sql/supported/ddl/create-tablespace.xml
@@ -108,4 +108,5 @@
     <sql-case id="create_tablespace_with_undo_tablespace_extent_uniform" 
value="CREATE UNDO TABLESPACE tablespaceName EXTENT MANAGEMENT LOCAL UNIFORM 
SIZE 5K" db-types="Oracle" />
     <sql-case id="create_tablespace_with_undo_tablespace_retention_guarantee" 
value="CREATE UNDO TABLESPACE tablespaceName RETENTION GUARANTEE" 
db-types="Oracle" />
     <sql-case 
id="create_tablespace_with_undo_tablespace_retention_noguarantee" value="CREATE 
UNDO TABLESPACE tablespaceName RETENTION NOGUARANTEE" db-types="Oracle" />
+    <sql-case id="create_tablespace_with_relative_location" value="CREATE 
TABLESPACE example2 RELATIVE LOCATION 'tablespace2/tablespace_2'" 
db-types="openGauss" />
 </sql-cases>

Reply via email to