You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by tu...@apache.org on 2022/05/25 03:30:31 UTC
[shardingsphere] branch master updated: Support close/move/fetch cursor statement for readwrite splitting (#17926)
This is an automated email from the ASF dual-hosted git repository.
tuichenchuxin 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 36bc1009034 Support close/move/fetch cursor statement for readwrite splitting (#17926)
36bc1009034 is described below
commit 36bc1009034c0275f1a65184338489bd23f227b3
Author: Zhengqiang Duan <du...@apache.org>
AuthorDate: Wed May 25 11:30:24 2022 +0800
Support close/move/fetch cursor statement for readwrite splitting (#17926)
* Support close/move/fetch cursor statement for readwrite splitting
* fix check style
---
.../metadata/schema/util/TableMetaDataUtil.java | 2 +-
.../schema/builder/SchemaMetaDataBuilderTest.java | 2 +-
.../backend/communication/ProxySQLExecutor.java | 8 ++-
.../main/antlr4/imports/opengauss/DDLStatement.g4 | 23 ++++++++-
.../main/antlr4/imports/opengauss/DMLStatement.g4 | 24 ---------
.../sql/parser/autogen/OpenGaussStatement.g4 | 5 +-
.../impl/OpenGaussDDLStatementSQLVisitor.java | 29 +++++++++++
.../core/database/visitor/SQLVisitorRule.java | 8 ++-
.../opengauss/ddl/OpenGaussCloseStatement.java | 37 ++++++++++++++
.../opengauss/ddl/OpenGaussFetchStatement.java | 37 ++++++++++++++
.../opengauss/ddl/OpenGaussMoveStatement.java | 37 ++++++++++++++
.../asserts/statement/ddl/DDLStatementAssert.java | 15 ++++++
.../statement/ddl/impl/CloseStatementAssert.java | 57 ++++++++++++++++++++++
.../statement/ddl/impl/FetchStatementAssert.java | 49 +++++++++++++++++++
.../statement/ddl/impl/MoveStatementAssert.java | 49 +++++++++++++++++++
.../jaxb/cases/domain/SQLParserTestCases.java | 15 ++++++
.../statement/ddl/CloseStatementTestCase.java | 36 ++++++++++++++
.../statement/ddl/FetchStatementTestCase.java | 36 ++++++++++++++
.../statement/ddl/MoveStatementTestCase.java | 36 ++++++++++++++
.../ddl/cursor.xml => case/ddl/close.xml} | 9 ++--
.../src/main/resources/case/ddl/cursor.xml | 2 +-
.../ddl/cursor.xml => case/ddl/fetch.xml} | 8 +--
.../supported/ddl/cursor.xml => case/ddl/move.xml} | 8 +--
.../sql/supported/ddl/{cursor.xml => close.xml} | 3 +-
.../main/resources/sql/supported/ddl/cursor.xml | 2 +-
.../sql/supported/ddl/{cursor.xml => fetch.xml} | 2 +-
.../sql/supported/ddl/{cursor.xml => move.xml} | 2 +-
27 files changed, 496 insertions(+), 45 deletions(-)
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/util/TableMetaDataUtil.java b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/util/TableMetaDataUtil.java
index 7a7e8fd68cf..6b66af21477 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/util/TableMetaDataUtil.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/metadata/schema/util/TableMetaDataUtil.java
@@ -59,7 +59,7 @@ public class TableMetaDataUtil {
addOneActualTableDataNode(materials, dataSourceTableGroups, dataNodes, each);
}
}
- return dataSourceTableGroups.entrySet().stream().map(entry -> new TableMetaDataLoaderMaterial(entry.getValue(),
+ return dataSourceTableGroups.entrySet().stream().map(entry -> new TableMetaDataLoaderMaterial(entry.getValue(),
materials.getDataSourceMap().get(entry.getKey().contains(".") ? entry.getKey().split("\\.")[0] : entry.getKey()), materials.getDefaultSchemaName())).collect(Collectors.toList());
}
diff --git a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/builder/SchemaMetaDataBuilderTest.java b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/builder/SchemaMetaDataBuilderTest.java
index 6f074880cbc..770fdc6114e 100644
--- a/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/builder/SchemaMetaDataBuilderTest.java
+++ b/shardingsphere-infra/shardingsphere-infra-common/src/test/java/org/apache/shardingsphere/infra/metadata/schema/builder/SchemaMetaDataBuilderTest.java
@@ -56,7 +56,7 @@ public final class SchemaMetaDataBuilderTest {
@Test
public void assertLoadWithNotExistedTableName() throws SQLException {
- SchemaBuilderMaterials materials = new SchemaBuilderMaterials(databaseType, databaseType, Collections.singletonMap("logic_db", new MockedDataSource()),
+ SchemaBuilderMaterials materials = new SchemaBuilderMaterials(databaseType, databaseType, Collections.singletonMap("logic_db", new MockedDataSource()),
Arrays.asList(new CommonFixtureRule(), new DataNodeContainedFixtureRule()), new ConfigurationProperties(new Properties()), "sharding_db");
assertTrue(SchemaMetaDataBuilder.load(Collections.singletonList("invalid_table"), materials).isEmpty());
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java
index aa635a6c335..4202b028586 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/communication/ProxySQLExecutor.java
@@ -48,7 +48,10 @@ import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DDLStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.dml.MySQLInsertStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.OpenGaussStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCloseStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCursorStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussFetchStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussMoveStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.PostgreSQLStatement;
import org.apache.shardingsphere.transaction.core.TransactionType;
@@ -102,8 +105,9 @@ public final class ProxySQLExecutor {
private boolean isExecuteDDLInPostgreSQLOpenGaussTransaction(final SQLStatement sqlStatement) {
// TODO implement DDL statement commit/rollback in PostgreSQL/openGauss transaction
boolean isPostgreSQLOpenGaussStatement = sqlStatement instanceof PostgreSQLStatement || sqlStatement instanceof OpenGaussStatement;
- return sqlStatement instanceof DDLStatement && !(sqlStatement instanceof OpenGaussCursorStatement) && isPostgreSQLOpenGaussStatement
- && backendConnection.getConnectionSession().getTransactionStatus().isInTransaction();
+ boolean isCursorStatement = sqlStatement instanceof OpenGaussCursorStatement
+ || sqlStatement instanceof OpenGaussCloseStatement || sqlStatement instanceof OpenGaussMoveStatement || sqlStatement instanceof OpenGaussFetchStatement;
+ return sqlStatement instanceof DDLStatement && !isCursorStatement && isPostgreSQLOpenGaussStatement && backendConnection.getConnectionSession().getTransactionStatus().isInTransaction();
}
/**
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/DDLStatement.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/DDLStatement.g4
index 23702254207..34cde0bac83 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/DDLStatement.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/DDLStatement.g4
@@ -1778,7 +1778,7 @@ listen
;
move
- : MOVE fetchArgs
+ : MOVE (direction (FROM | IN)?)? cursorName
;
prepare
@@ -1963,3 +1963,24 @@ alterSchema
dropSchema
: DROP SCHEMA existClause? nameList dropBehavior?
;
+
+fetch
+ : FETCH (direction (FROM | IN))? cursorName
+ ;
+
+direction
+ : NEXT
+ | PRIOR
+ | FIRST
+ | LAST
+ | ABSOLUTE signedIconst
+ | RELATIVE signedIconst
+ | signedIconst
+ | ALL
+ | FORWARD
+ | FORWARD signedIconst
+ | FORWARD ALL
+ | BACKWARD
+ | BACKWARD signedIconst
+ | BACKWARD ALL
+ ;
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/DMLStatement.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/DMLStatement.g4
index bd781a42823..e97dd1a47ad 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/DMLStatement.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/DMLStatement.g4
@@ -516,27 +516,3 @@ copyOptItem
copyDelimiter
: (USING)? DELIMITERS STRING_
;
-
-fetch
- : FETCH fetchArgs
- ;
-
-fetchArgs
- : cursorName
- | (FROM | IN) cursorName
- | NEXT (FROM | IN)? cursorName
- | PRIOR (FROM | IN)? cursorName
- | FIRST (FROM | IN)? cursorName
- | LAST (FROM | IN)? cursorName
- | ABSOLUTE signedIconst (FROM | IN)? cursorName
- | RELATIVE signedIconst (FROM | IN)? cursorName
- | signedIconst (FROM | IN)? cursorName
- | ALL (FROM | IN)? cursorName
- | FORWARD (FROM | IN)? cursorName
- | FORWARD signedIconst (FROM | IN)? cursorName
- | FORWARD ALL (FROM | IN)? cursorName
- | BACKWARD (FROM | IN)? cursorName
- | BACKWARD signedIconst (FROM | IN)? cursorName
- | BACKWARD ALL (FROM | IN)? cursorName
- ;
-
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/OpenGaussStatement.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/OpenGaussStatement.g4
index 2bbabd7437a..bd5b3389915 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/OpenGaussStatement.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/org/apache/shardingsphere/sql/parser/autogen/OpenGaussStatement.g4
@@ -82,7 +82,6 @@ execute
| dropSchema
| createType
| createTextSearch
- | declare
| dropDatabase
| dropFunction
| dropProcedure
@@ -119,7 +118,11 @@ execute
| createSynonym
| alterSynonym
| dropSynonym
+ | declare
| cursor
+ | close
+ | move
+ | fetch
| createDirectory
) SEMI_? EOF
;
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussDDLStatementSQLVisitor.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussDDLStatementSQLVisitor.java
index 63a2310c590..0207f4ad188 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussDDLStatementSQLVisitor.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussDDLStatementSQLVisitor.java
@@ -47,6 +47,7 @@ import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.Alt
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.AlterTextSearchParserContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.AlterTextSearchTemplateContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.AlterViewContext;
+import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.CloseContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.ColumnConstraintContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.ColumnDefinitionContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.CommentContext;
@@ -90,12 +91,14 @@ import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.Dro
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.DropTableContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.DropTablespaceContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.DropViewContext;
+import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.FetchContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.IndexElemContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.IndexNameContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.IndexNamesContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.IndexParamsContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.ModifyColumnSpecificationContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.ModifyConstraintSpecificationContext;
+import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.MoveContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.NameContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.NameListContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.PrepareContext;
@@ -155,6 +158,7 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussAlterTablespaceStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussAlterTextSearchStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussAlterViewStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCloseStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCommentStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCreateConversionStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCreateDatabaseStatement;
@@ -191,6 +195,8 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussDropTableStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussDropTablespaceStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussDropViewStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussFetchStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussMoveStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussPrepareStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussTruncateStatement;
@@ -887,4 +893,27 @@ public final class OpenGaussDDLStatementSQLVisitor extends OpenGaussStatementSQL
public ASTNode visitCursorName(final CursorNameContext ctx) {
return new CursorNameSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), (IdentifierValue) visit(ctx.name()));
}
+
+ @Override
+ public ASTNode visitClose(final CloseContext ctx) {
+ OpenGaussCloseStatement result = new OpenGaussCloseStatement();
+ if (null != ctx.cursorName()) {
+ result.setCursorName((CursorNameSegment) visit(ctx.cursorName()));
+ }
+ return result;
+ }
+
+ @Override
+ public ASTNode visitMove(final MoveContext ctx) {
+ OpenGaussMoveStatement result = new OpenGaussMoveStatement();
+ result.setCursorName((CursorNameSegment) visit(ctx.cursorName()));
+ return result;
+ }
+
+ @Override
+ public ASTNode visitFetch(final FetchContext ctx) {
+ OpenGaussFetchStatement result = new OpenGaussFetchStatement();
+ result.setCursorName((CursorNameSegment) visit(ctx.cursorName()));
+ return result;
+ }
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
index 3c88bd746e8..370ab728b91 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-engine/src/main/java/org/apache/shardingsphere/sql/parser/core/database/visitor/SQLVisitorRule.java
@@ -23,7 +23,7 @@ import org.antlr.v4.runtime.tree.ParseTree;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatementType;
/**
- * SQL Visitor rule.
+ * SQL visitor rule.
*/
@RequiredArgsConstructor
public enum SQLVisitorRule {
@@ -516,6 +516,12 @@ public enum SQLVisitorRule {
CURSOR("Cursor", SQLStatementType.DDL),
+ CLOSE("Close", SQLStatementType.DDL),
+
+ MOVE("Move", SQLStatementType.DDL),
+
+ FETCH("Fetch", SQLStatementType.DDL),
+
CHECKPOINT("Checkpoint", SQLStatementType.DML);
private final String name;
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussCloseStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussCloseStatement.java
new file mode 100644
index 00000000000..e40dffc9399
--- /dev/null
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussCloseStatement.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.cursor.CursorNameSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DDLStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.OpenGaussStatement;
+
+/**
+ * OpenGauss close statement.
+ */
+@Getter
+@Setter
+@ToString
+public final class OpenGaussCloseStatement extends AbstractSQLStatement implements DDLStatement, OpenGaussStatement {
+
+ private CursorNameSegment cursorName;
+}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussFetchStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussFetchStatement.java
new file mode 100644
index 00000000000..da09c674f45
--- /dev/null
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussFetchStatement.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.cursor.CursorNameSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DDLStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.OpenGaussStatement;
+
+/**
+ * OpenGauss fetch statement.
+ */
+@Getter
+@Setter
+@ToString
+public final class OpenGaussFetchStatement extends AbstractSQLStatement implements DDLStatement, OpenGaussStatement {
+
+ private CursorNameSegment cursorName;
+}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussMoveStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussMoveStatement.java
new file mode 100644
index 00000000000..1029017c483
--- /dev/null
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussMoveStatement.java
@@ -0,0 +1,37 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl;
+
+import lombok.Getter;
+import lombok.Setter;
+import lombok.ToString;
+import org.apache.shardingsphere.sql.parser.sql.common.segment.ddl.cursor.CursorNameSegment;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStatement;
+import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DDLStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.OpenGaussStatement;
+
+/**
+ * OpenGauss move statement.
+ */
+@Getter
+@Setter
+@ToString
+public final class OpenGaussMoveStatement extends AbstractSQLStatement implements DDLStatement, OpenGaussStatement {
+
+ private CursorNameSegment cursorName;
+}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/DDLStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/DDLStatementAssert.java
index c49c4f8c618..d5217b696d9 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/DDLStatementAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/DDLStatementAssert.java
@@ -29,7 +29,10 @@ import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DropIndexSt
import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.DropTableStatement;
import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.RenameTableStatement;
import org.apache.shardingsphere.sql.parser.sql.common.statement.ddl.TruncateStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCloseStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCursorStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussFetchStatement;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussMoveStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleAlterSessionStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleAlterSynonymStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.oracle.ddl.OracleAnalyzeStatement;
@@ -46,12 +49,15 @@ import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.AnalyzeStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.AssociateStatisticsStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.AuditStatementAssert;
+import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.CloseStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.CreateIndexStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.CreateTableStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.CursorStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.DisassociateStatisticsStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.DropIndexStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.DropTableStatementAssert;
+import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.FetchStatementAssert;
+import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.MoveStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.NoAuditStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.RenameTableStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl.TruncateStatementAssert;
@@ -64,12 +70,15 @@ import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AnalyzeStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AssociateStatisticsStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AuditStatementTestCase;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.CloseStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.CreateIndexStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.CreateTableStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.CursorStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.DisassociateStatisticsStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.DropIndexStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.DropTableStatementTestCase;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.FetchStatementTestCase;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.MoveStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.NoAuditStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.RenameTableStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.TruncateStatementTestCase;
@@ -122,6 +131,12 @@ public final class DDLStatementAssert {
NoAuditStatementAssert.assertIs(assertContext, (OracleNoAuditStatement) actual, (NoAuditStatementTestCase) expected);
} else if (actual instanceof OpenGaussCursorStatement) {
CursorStatementAssert.assertIs(assertContext, (OpenGaussCursorStatement) actual, (CursorStatementTestCase) expected);
+ } else if (actual instanceof OpenGaussCloseStatement) {
+ CloseStatementAssert.assertIs(assertContext, (OpenGaussCloseStatement) actual, (CloseStatementTestCase) expected);
+ } else if (actual instanceof OpenGaussMoveStatement) {
+ MoveStatementAssert.assertIs(assertContext, (OpenGaussMoveStatement) actual, (MoveStatementTestCase) expected);
+ } else if (actual instanceof OpenGaussFetchStatement) {
+ FetchStatementAssert.assertIs(assertContext, (OpenGaussFetchStatement) actual, (FetchStatementTestCase) expected);
}
}
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/impl/CloseStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/impl/CloseStatementAssert.java
new file mode 100644
index 00000000000..66155f4b197
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/impl/CloseStatementAssert.java
@@ -0,0 +1,57 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCloseStatement;
+import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
+import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.segment.SQLSegmentAssert;
+import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.value.IdentifierValueAssert;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.CloseStatementTestCase;
+
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertNull;
+
+/**
+ * Close statement assert.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class CloseStatementAssert {
+
+ /**
+ * Assert close statement is correct with expected parser result.
+ *
+ * @param assertContext assert context
+ * @param actual actual close statement
+ * @param expected expected close statement test case
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext, final OpenGaussCloseStatement actual, final CloseStatementTestCase expected) {
+ assertCursorName(assertContext, actual, expected);
+ }
+
+ private static void assertCursorName(final SQLCaseAssertContext assertContext, final OpenGaussCloseStatement actual, final CloseStatementTestCase expected) {
+ if (null != expected.getCursorName()) {
+ assertNotNull(assertContext.getText("Actual cursor name should exist."), actual.getCursorName());
+ IdentifierValueAssert.assertIs(assertContext, actual.getCursorName().getIdentifier(), expected.getCursorName(), "Close");
+ SQLSegmentAssert.assertIs(assertContext, actual.getCursorName(), expected.getCursorName());
+ } else {
+ assertNull(assertContext.getText("Actual cursor name should not exist."), actual.getCursorName());
+ }
+ }
+}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/impl/FetchStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/impl/FetchStatementAssert.java
new file mode 100644
index 00000000000..412ffce6e9c
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/impl/FetchStatementAssert.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussFetchStatement;
+import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
+import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.segment.SQLSegmentAssert;
+import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.value.IdentifierValueAssert;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.FetchStatementTestCase;
+
+/**
+ * Fetch statement assert.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class FetchStatementAssert {
+
+ /**
+ * Assert fetch statement is correct with expected parser result.
+ *
+ * @param assertContext assert context
+ * @param actual actual fetch statement
+ * @param expected expected fetch statement test case
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext, final OpenGaussFetchStatement actual, final FetchStatementTestCase expected) {
+ assertCursorName(assertContext, actual, expected);
+ }
+
+ private static void assertCursorName(final SQLCaseAssertContext assertContext, final OpenGaussFetchStatement actual, final FetchStatementTestCase expected) {
+ IdentifierValueAssert.assertIs(assertContext, actual.getCursorName().getIdentifier(), expected.getCursorName(), "Fetch");
+ SQLSegmentAssert.assertIs(assertContext, actual.getCursorName(), expected.getCursorName());
+ }
+}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/impl/MoveStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/impl/MoveStatementAssert.java
new file mode 100644
index 00000000000..40dc216d7f6
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/ddl/impl/MoveStatementAssert.java
@@ -0,0 +1,49 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.ddl.impl;
+
+import lombok.AccessLevel;
+import lombok.NoArgsConstructor;
+import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussMoveStatement;
+import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
+import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.segment.SQLSegmentAssert;
+import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.value.IdentifierValueAssert;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.MoveStatementTestCase;
+
+/**
+ * Move statement assert.
+ */
+@NoArgsConstructor(access = AccessLevel.PRIVATE)
+public final class MoveStatementAssert {
+
+ /**
+ * Assert move statement is correct with expected parser result.
+ *
+ * @param assertContext assert context
+ * @param actual actual move statement
+ * @param expected expected move statement test case
+ */
+ public static void assertIs(final SQLCaseAssertContext assertContext, final OpenGaussMoveStatement actual, final MoveStatementTestCase expected) {
+ assertCursorName(assertContext, actual, expected);
+ }
+
+ private static void assertCursorName(final SQLCaseAssertContext assertContext, final OpenGaussMoveStatement actual, final MoveStatementTestCase expected) {
+ IdentifierValueAssert.assertIs(assertContext, actual.getCursorName().getIdentifier(), expected.getCursorName(), "Move");
+ SQLSegmentAssert.assertIs(assertContext, actual.getCursorName(), expected.getCursorName());
+ }
+}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
index bca43f56cb3..241e58996f7 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/SQLParserTestCases.java
@@ -126,6 +126,7 @@ import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AnalyzeStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AssociateStatisticsStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.AuditStatementTestCase;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.CloseStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.CommentStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.CreateContextStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.CreateConversionStatementTestCase;
@@ -201,8 +202,10 @@ import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.DropTriggerStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.DropTypeStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.DropViewStatementTestCase;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.FetchStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.FlashbackDatabaseStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.FlashbackTableStatementTestCase;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.MoveStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.NoAuditStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.PreparedStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl.PurgeStatementTestCase;
@@ -1349,6 +1352,15 @@ public final class SQLParserTestCases {
@XmlElement(name = "cursor")
private final List<CursorStatementTestCase> cursorTestCases = new LinkedList<>();
+ @XmlElement(name = "close")
+ private final List<CloseStatementTestCase> closeTestCases = new LinkedList<>();
+
+ @XmlElement(name = "move")
+ private final List<MoveStatementTestCase> moveTestCases = new LinkedList<>();
+
+ @XmlElement(name = "fetch")
+ private final List<FetchStatementTestCase> fetchTestCases = new LinkedList<>();
+
@XmlElement(name = "checkpoint")
private final List<CheckpointStatementTestCase> checkpointTestCases = new LinkedList<>();
@@ -1688,6 +1700,9 @@ public final class SQLParserTestCases {
putAll(createSPFileTestCases, result);
putAll(createPFileTestCases, result);
putAll(cursorTestCases, result);
+ putAll(closeTestCases, result);
+ putAll(moveTestCases, result);
+ putAll(fetchTestCases, result);
putAll(checkpointTestCases, result);
return result;
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/CloseStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/CloseStatementTestCase.java
new file mode 100644
index 00000000000..fa5007806eb
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/CloseStatementTestCase.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.cursor.ExpectedCursorName;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
+
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * Close statement test case.
+ */
+@Getter
+@Setter
+public final class CloseStatementTestCase extends SQLParserTestCase {
+
+ @XmlElement(name = "cursor-name")
+ private ExpectedCursorName cursorName;
+}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/FetchStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/FetchStatementTestCase.java
new file mode 100644
index 00000000000..ebbc29aa603
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/FetchStatementTestCase.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.cursor.ExpectedCursorName;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
+
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * Fetch statement test case.
+ */
+@Getter
+@Setter
+public final class FetchStatementTestCase extends SQLParserTestCase {
+
+ @XmlElement(name = "cursor-name")
+ private ExpectedCursorName cursorName;
+}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/MoveStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/MoveStatementTestCase.java
new file mode 100644
index 00000000000..2ae5560b7eb
--- /dev/null
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/ddl/MoveStatementTestCase.java
@@ -0,0 +1,36 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.ddl;
+
+import lombok.Getter;
+import lombok.Setter;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.cursor.ExpectedCursorName;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
+
+import javax.xml.bind.annotation.XmlElement;
+
+/**
+ * Move statement test case.
+ */
+@Getter
+@Setter
+public final class MoveStatementTestCase extends SQLParserTestCase {
+
+ @XmlElement(name = "cursor-name")
+ private ExpectedCursorName cursorName;
+}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/close.xml
similarity index 79%
copy from shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml
copy to shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/close.xml
index 6a366d4c79a..79b68d58965 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/close.xml
@@ -16,6 +16,9 @@
~ limitations under the License.
-->
-<sql-cases>
- <sql-case id="cursor" value="CURSOR t_order_cursor WITH HOLD FOR SELECT * FROM t_order;" db-types="openGauss" />
-</sql-cases>
+<sql-parser-test-cases>
+ <close sql-case-id="close_cursor">
+ <cursor-name name="t_order_cursor" start-index="6" stop-index="19" />
+ </close>
+ <close sql-case-id="close_all_cursor" />
+</sql-parser-test-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/cursor.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/cursor.xml
index 10de350b585..7d37949526e 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/cursor.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/cursor.xml
@@ -17,7 +17,7 @@
-->
<sql-parser-test-cases>
- <cursor sql-case-id="cursor">
+ <cursor sql-case-id="create_cursor">
<cursor-name name="t_order_cursor" start-index="7" stop-index="20" />
<select>
<from>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/fetch.xml
similarity index 82%
copy from shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml
copy to shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/fetch.xml
index 6a366d4c79a..0f1a2623b18 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/fetch.xml
@@ -16,6 +16,8 @@
~ limitations under the License.
-->
-<sql-cases>
- <sql-case id="cursor" value="CURSOR t_order_cursor WITH HOLD FOR SELECT * FROM t_order;" db-types="openGauss" />
-</sql-cases>
+<sql-parser-test-cases>
+ <fetch sql-case-id="fetch_cursor">
+ <cursor-name name="t_order_cursor" start-index="15" stop-index="28" />
+ </fetch>
+</sql-parser-test-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/move.xml
similarity index 83%
copy from shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml
copy to shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/move.xml
index 6a366d4c79a..132e3ef135f 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/move.xml
@@ -16,6 +16,8 @@
~ limitations under the License.
-->
-<sql-cases>
- <sql-case id="cursor" value="CURSOR t_order_cursor WITH HOLD FOR SELECT * FROM t_order;" db-types="openGauss" />
-</sql-cases>
+<sql-parser-test-cases>
+ <move sql-case-id="move_cursor">
+ <cursor-name name="t_order_cursor" start-index="9" stop-index="22" />
+ </move>
+</sql-parser-test-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/close.xml
similarity index 84%
copy from shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml
copy to shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/close.xml
index 6a366d4c79a..2b2767b841e 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/close.xml
@@ -17,5 +17,6 @@
-->
<sql-cases>
- <sql-case id="cursor" value="CURSOR t_order_cursor WITH HOLD FOR SELECT * FROM t_order;" db-types="openGauss" />
+ <sql-case id="close_cursor" value="CLOSE t_order_cursor;" db-types="openGauss" />
+ <sql-case id="close_all_cursor" value="CLOSE ALL;" db-types="openGauss" />
</sql-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml
index 6a366d4c79a..e3306eca86c 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml
@@ -17,5 +17,5 @@
-->
<sql-cases>
- <sql-case id="cursor" value="CURSOR t_order_cursor WITH HOLD FOR SELECT * FROM t_order;" db-types="openGauss" />
+ <sql-case id="create_cursor" value="CURSOR t_order_cursor WITH HOLD FOR SELECT * FROM t_order;" db-types="openGauss" />
</sql-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/fetch.xml
similarity index 88%
copy from shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml
copy to shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/fetch.xml
index 6a366d4c79a..013c0894103 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/fetch.xml
@@ -17,5 +17,5 @@
-->
<sql-cases>
- <sql-case id="cursor" value="CURSOR t_order_cursor WITH HOLD FOR SELECT * FROM t_order;" db-types="openGauss" />
+ <sql-case id="fetch_cursor" value="FETCH ALL FROM t_order_cursor;" db-types="openGauss" />
</sql-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/move.xml
similarity index 88%
copy from shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml
copy to shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/move.xml
index 6a366d4c79a..e6f143f1b69 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/cursor.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/move.xml
@@ -17,5 +17,5 @@
-->
<sql-cases>
- <sql-case id="cursor" value="CURSOR t_order_cursor WITH HOLD FOR SELECT * FROM t_order;" db-types="openGauss" />
+ <sql-case id="move_cursor" value="MOVE ALL t_order_cursor;" db-types="openGauss" />
</sql-cases>