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/06/20 05:33:50 UTC
[shardingsphere] branch master updated: Optimize openGauss fetch/move cursor statements sql parse logic (#18438)
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 637de3a6be5 Optimize openGauss fetch/move cursor statements sql parse logic (#18438)
637de3a6be5 is described below
commit 637de3a6be5aba2aced92be39b2758dd91067f5c
Author: Zhengqiang Duan <du...@apache.org>
AuthorDate: Mon Jun 20 13:33:44 2022 +0800
Optimize openGauss fetch/move cursor statements sql parse logic (#18438)
* Optimize openGauss fetch/move cursor statements sql parse logic
* optimize rewrite logic when execute fetch from cursor
---
.../merge/ddl/fetch/FetchStreamMergedResult.java | 2 +-
.../impl/FetchDirectionTokenGenerator.java | 6 +--
.../ddl/fetch/FetchStreamMergedResultTest.java | 3 +-
.../main/antlr4/imports/opengauss/DDLStatement.g4 | 4 +-
.../impl/OpenGaussDDLStatementSQLVisitor.java | 55 +++++++++++++++-------
.../segment/ddl/cursor/DirectionSegment.java | 11 ++++-
.../segment/cursor/DirectionSegmentAssert.java | 8 ++--
.../src/main/resources/case/ddl/fetch.xml | 36 ++++++++------
.../src/main/resources/case/ddl/move.xml | 36 ++++++++------
.../src/main/resources/sql/supported/ddl/fetch.xml | 30 ++++++------
.../src/main/resources/sql/supported/ddl/move.xml | 30 ++++++------
11 files changed, 136 insertions(+), 85 deletions(-)
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/merge/ddl/fetch/FetchStreamMergedResult.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/merge/ddl/fetch/FetchStreamMergedResult.java
index 8997f2579f2..9bb11f7b6c1 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/merge/ddl/fetch/FetchStreamMergedResult.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/merge/ddl/fetch/FetchStreamMergedResult.java
@@ -54,7 +54,7 @@ public final class FetchStreamMergedResult extends StreamMergedResult {
public FetchStreamMergedResult(final List<QueryResult> queryResults, final FetchStatementContext fetchStatementContext, final ShardingSphereSchema schema) throws SQLException {
orderByValuesQueue = new PriorityQueue<>(queryResults.size());
- directionType = fetchStatementContext.getSqlStatement().getDirection().map(DirectionSegment::getDirectionType).orElse(DirectionType.NEXT);
+ directionType = fetchStatementContext.getSqlStatement().getDirection().flatMap(DirectionSegment::getDirectionType).orElse(DirectionType.NEXT);
fetchCount = fetchStatementContext.getSqlStatement().getDirection().flatMap(DirectionSegment::getCount).orElse(1L);
SelectStatementContext selectStatementContext = fetchStatementContext.getCursorStatementContext().getSelectStatementContext();
String cursorName = fetchStatementContext.getCursorName().getIdentifier().getValue().toLowerCase();
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rewrite/token/generator/impl/FetchDirectionTokenGenerator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rewrite/token/generator/impl/FetchDirectionTokenGenerator.java
index 659dcbd950b..b7170216f61 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rewrite/token/generator/impl/FetchDirectionTokenGenerator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rewrite/token/generator/impl/FetchDirectionTokenGenerator.java
@@ -45,9 +45,9 @@ public final class FetchDirectionTokenGenerator implements OptionalSQLTokenGener
Preconditions.checkArgument(sqlStatementContext instanceof FetchStatementContext, "SQLStatementContext must be instance of FetchStatementContext.");
OpenGaussFetchStatement fetchStatement = ((FetchStatementContext) sqlStatementContext).getSqlStatement();
CursorNameSegment cursorName = fetchStatement.getCursorName();
- int startIndex = fetchStatement.getDirection().map(DirectionSegment::getStartIndex).orElseGet(() -> cursorName.getStartIndex() - 1);
- int stopIndex = fetchStatement.getDirection().map(DirectionSegment::getStopIndex).orElseGet(() -> cursorName.getStartIndex() - 1);
- DirectionType directionType = fetchStatement.getDirection().map(DirectionSegment::getDirectionType).orElse(DirectionType.NEXT);
+ int startIndex = fetchStatement.getDirection().map(DirectionSegment::getStartIndex).orElseGet("FETCH"::length);
+ int stopIndex = fetchStatement.getDirection().map(DirectionSegment::getStopIndex).orElseGet("FETCH"::length);
+ DirectionType directionType = fetchStatement.getDirection().flatMap(DirectionSegment::getDirectionType).orElse(DirectionType.NEXT);
long fetchCount = fetchStatement.getDirection().flatMap(DirectionSegment::getCount).orElse(1L);
return new FetchDirectionToken(startIndex, stopIndex, directionType, fetchCount, cursorName.getIdentifier().getValue().toLowerCase());
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/merge/ddl/fetch/FetchStreamMergedResultTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/merge/ddl/fetch/FetchStreamMergedResultTest.java
index 69247256601..f78757ec948 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/merge/ddl/fetch/FetchStreamMergedResultTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/test/java/org/apache/shardingsphere/sharding/merge/ddl/fetch/FetchStreamMergedResultTest.java
@@ -74,7 +74,8 @@ public final class FetchStreamMergedResultTest {
OpenGaussFetchStatement result = new OpenGaussFetchStatement();
result.setCursorName(new CursorNameSegment(0, 0, new IdentifierValue("t_order_cursor")));
if (containsAllDirectionType) {
- DirectionSegment direction = new DirectionSegment(0, 0, DirectionType.ALL);
+ DirectionSegment direction = new DirectionSegment(0, 0);
+ direction.setDirectionType(DirectionType.ALL);
result.setDirection(direction);
}
return result;
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 47bb8b140e2..9487f2c472a 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
@@ -1785,7 +1785,7 @@ listen
;
move
- : MOVE (direction (FROM | IN)?)? cursorName
+ : MOVE direction? (FROM | IN)? cursorName
;
prepare
@@ -1972,7 +1972,7 @@ dropSchema
;
fetch
- : FETCH (direction (FROM | IN)?)? cursorName
+ : FETCH direction? (FROM | IN)? cursorName
;
direction
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 1eaf87e0cea..9448b6ba85b 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
@@ -60,6 +60,7 @@ import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.Col
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.ColumnDefinitionContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.CommentContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.CountContext;
+import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.CreateAggregateContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.CreateCastContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.CreateConversionContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.CreateDatabaseContext;
@@ -77,7 +78,6 @@ import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.Cre
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.CreateSchemaContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.CreateSequenceContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.CreateSynonymContext;
-import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.CreateAggregateContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.CreateTableContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.CreateTablespaceContext;
import org.apache.shardingsphere.sql.parser.autogen.OpenGaussStatementParser.CreateTextSearchContext;
@@ -191,6 +191,7 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.
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.OpenGaussCreateAggregateStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCreateCastStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCreateConversionStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCreateDatabaseStatement;
@@ -206,7 +207,6 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCreateSchemaStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCreateSequenceStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCreateSynonymStatement;
-import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCreateAggregateStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCreateTableStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCreateTablespaceStatement;
import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.ddl.OpenGaussCreateTextSearchStatement;
@@ -1019,81 +1019,104 @@ public final class OpenGaussDDLStatementSQLVisitor extends OpenGaussStatementSQL
@Override
public ASTNode visitNext(final NextContext ctx) {
- return new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), DirectionType.NEXT);
+ DirectionSegment result = new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex());
+ result.setDirectionType(DirectionType.NEXT);
+ return result;
}
@Override
public ASTNode visitPrior(final PriorContext ctx) {
- return new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), DirectionType.PRIOR);
+ DirectionSegment result = new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex());
+ result.setDirectionType(DirectionType.PRIOR);
+ return result;
}
@Override
public ASTNode visitFirst(final FirstContext ctx) {
- return new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), DirectionType.FIRST);
+ DirectionSegment result = new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex());
+ result.setDirectionType(DirectionType.FIRST);
+ return result;
}
@Override
public ASTNode visitLast(final LastContext ctx) {
- return new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), DirectionType.LAST);
+ DirectionSegment result = new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex());
+ result.setDirectionType(DirectionType.LAST);
+ return result;
}
@Override
public ASTNode visitAbsoluteCount(final AbsoluteCountContext ctx) {
- DirectionSegment result = new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), DirectionType.ABSOLUTE_COUNT);
+ DirectionSegment result = new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex());
+ result.setDirectionType(DirectionType.ABSOLUTE_COUNT);
result.setCount(((NumberLiteralValue) visit(ctx.signedIconst())).getValue().longValue());
return result;
}
@Override
public ASTNode visitRelativeCount(final RelativeCountContext ctx) {
- DirectionSegment result = new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), DirectionType.RELATIVE_COUNT);
+ DirectionSegment result = new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex());
+ result.setDirectionType(DirectionType.RELATIVE_COUNT);
result.setCount(((NumberLiteralValue) visit(ctx.signedIconst())).getValue().longValue());
return result;
}
@Override
public ASTNode visitCount(final CountContext ctx) {
- DirectionSegment result = new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), DirectionType.COUNT);
+ DirectionSegment result = new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex());
+ result.setDirectionType(DirectionType.COUNT);
result.setCount(((NumberLiteralValue) visit(ctx.signedIconst())).getValue().longValue());
return result;
}
@Override
public ASTNode visitAll(final AllContext ctx) {
- return new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), DirectionType.ALL);
+ DirectionSegment result = new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex());
+ result.setDirectionType(DirectionType.ALL);
+ return result;
}
@Override
public ASTNode visitForward(final ForwardContext ctx) {
- return new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), DirectionType.FORWARD);
+ DirectionSegment result = new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex());
+ result.setDirectionType(DirectionType.FORWARD);
+ return result;
}
@Override
public ASTNode visitForwardCount(final ForwardCountContext ctx) {
- DirectionSegment result = new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), DirectionType.FORWARD_COUNT);
+ DirectionSegment result = new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex());
+ result.setDirectionType(DirectionType.FORWARD_COUNT);
result.setCount(((NumberLiteralValue) visit(ctx.signedIconst())).getValue().longValue());
return result;
}
@Override
public ASTNode visitForwardAll(final ForwardAllContext ctx) {
- return new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), DirectionType.FORWARD_ALL);
+ DirectionSegment result = new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex());
+ result.setDirectionType(DirectionType.FORWARD_ALL);
+ return result;
}
@Override
public ASTNode visitBackward(final BackwardContext ctx) {
- return new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), DirectionType.BACKWARD);
+ DirectionSegment result = new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex());
+ result.setDirectionType(DirectionType.BACKWARD);
+ return result;
}
@Override
public ASTNode visitBackwardCount(final BackwardCountContext ctx) {
- DirectionSegment result = new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), DirectionType.BACKWARD_COUNT);
+ DirectionSegment result = new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex());
+ result.setDirectionType(DirectionType.BACKWARD_COUNT);
result.setCount(((NumberLiteralValue) visit(ctx.signedIconst())).getValue().longValue());
return result;
}
@Override
public ASTNode visitBackwardAll(final BackwardAllContext ctx) {
- return new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), DirectionType.BACKWARD_ALL);
+ DirectionSegment result = new DirectionSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex());
+ result.setDirectionType(DirectionType.BACKWARD_ALL);
+ return result;
}
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/ddl/cursor/DirectionSegment.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/ddl/cursor/DirectionSegment.java
index e24ecd6f8c7..a7b2e4984ba 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/ddl/cursor/DirectionSegment.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/segment/ddl/cursor/DirectionSegment.java
@@ -39,10 +39,19 @@ public final class DirectionSegment implements SQLSegment {
private final int stopIndex;
- private final DirectionType directionType;
+ private DirectionType directionType;
private Long count;
+ /**
+ * Get direction type.
+ *
+ * @return direction type
+ */
+ public Optional<DirectionType> getDirectionType() {
+ return Optional.ofNullable(directionType);
+ }
+
/**
* Get count.
*
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/cursor/DirectionSegmentAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/cursor/DirectionSegmentAssert.java
index 2f3140c5aed..9fd21af478d 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/cursor/DirectionSegmentAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/cursor/DirectionSegmentAssert.java
@@ -26,8 +26,6 @@ import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
import static org.hamcrest.CoreMatchers.is;
import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
import static org.junit.Assert.assertThat;
import static org.junit.Assert.assertTrue;
@@ -52,10 +50,10 @@ public final class DirectionSegmentAssert {
private static void assertDirectionType(final SQLCaseAssertContext assertContext, final DirectionSegment actual, final ExpectedDirectionSegment expected) {
if (null != expected.getDirectionType()) {
- assertNotNull(assertContext.getText("Actual direction type should exist."), actual.getDirectionType());
- assertThat(assertContext.getText("Direction type assertion error: "), actual.getDirectionType().name(), is(expected.getDirectionType()));
+ assertTrue(assertContext.getText("Actual direction type should exist."), actual.getDirectionType().isPresent());
+ assertThat(assertContext.getText("Direction type assertion error: "), actual.getDirectionType().get().name(), is(expected.getDirectionType()));
} else {
- assertNull(assertContext.getText("Actual direction type should not exist."), actual.getDirectionType());
+ assertFalse(assertContext.getText("Actual direction type should not exist."), actual.getDirectionType().isPresent());
}
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/fetch.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/fetch.xml
index 6f61f143496..6d813ccc69a 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/fetch.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/fetch.xml
@@ -17,72 +17,80 @@
-->
<sql-parser-test-cases>
- <fetch sql-case-id="fetch_next">
+ <fetch sql-case-id="fetch_cursor">
+ <cursor-name name="t_order_cursor" start-index="6" stop-index="19" />
+ </fetch>
+
+ <fetch sql-case-id="fetch_cursor_with_from">
+ <cursor-name name="t_order_cursor" start-index="11" stop-index="24" />
+ </fetch>
+
+ <fetch sql-case-id="fetch_cursor_with_next">
<cursor-name name="t_order_cursor" start-index="16" stop-index="29" />
<direction direction-type="NEXT" start-index="6" stop-index="9" />
</fetch>
- <fetch sql-case-id="fetch_prior">
+ <fetch sql-case-id="fetch_cursor_with_prior">
<cursor-name name="t_order_cursor" start-index="17" stop-index="30" />
<direction direction-type="PRIOR" start-index="6" stop-index="10" />
</fetch>
- <fetch sql-case-id="fetch_first">
+ <fetch sql-case-id="fetch_cursor_with_first">
<cursor-name name="t_order_cursor" start-index="17" stop-index="30" />
<direction direction-type="FIRST" start-index="6" stop-index="10" />
</fetch>
- <fetch sql-case-id="fetch_last">
+ <fetch sql-case-id="fetch_cursor_with_last">
<cursor-name name="t_order_cursor" start-index="16" stop-index="29" />
<direction direction-type="LAST" start-index="6" stop-index="9" />
</fetch>
- <fetch sql-case-id="fetch_absolute_count">
+ <fetch sql-case-id="fetch_cursor_with_absolute_count">
<cursor-name name="t_order_cursor" start-index="23" stop-index="36" />
<direction direction-type="ABSOLUTE_COUNT" count="10" start-index="6" stop-index="16" />
</fetch>
- <fetch sql-case-id="fetch_relative_count">
+ <fetch sql-case-id="fetch_cursor_with_relative_count">
<cursor-name name="t_order_cursor" start-index="23" stop-index="36" />
<direction direction-type="RELATIVE_COUNT" count="10" start-index="6" stop-index="16" />
</fetch>
- <fetch sql-case-id="fetch_count">
+ <fetch sql-case-id="fetch_cursor_with_count">
<cursor-name name="t_order_cursor" start-index="14" stop-index="27" />
<direction direction-type="COUNT" count="10" start-index="6" stop-index="7" />
</fetch>
- <fetch sql-case-id="fetch_all">
+ <fetch sql-case-id="fetch_cursor_with_all">
<cursor-name name="t_order_cursor" start-index="15" stop-index="28" />
<direction direction-type="ALL" start-index="6" stop-index="8" />
</fetch>
- <fetch sql-case-id="fetch_forward">
+ <fetch sql-case-id="fetch_cursor_with_forward">
<cursor-name name="t_order_cursor" start-index="19" stop-index="32" />
<direction direction-type="FORWARD" start-index="6" stop-index="12" />
</fetch>
- <fetch sql-case-id="fetch_forward_count">
+ <fetch sql-case-id="fetch_cursor_with_forward_count">
<cursor-name name="t_order_cursor" start-index="22" stop-index="35" />
<direction direction-type="FORWARD_COUNT" count="10" start-index="6" stop-index="15" />
</fetch>
- <fetch sql-case-id="fetch_forward_all">
+ <fetch sql-case-id="fetch_cursor_with_forward_all">
<cursor-name name="t_order_cursor" start-index="23" stop-index="36" />
<direction direction-type="FORWARD_ALL" start-index="6" stop-index="16" />
</fetch>
- <fetch sql-case-id="fetch_backward">
+ <fetch sql-case-id="fetch_cursor_with_backward">
<cursor-name name="t_order_cursor" start-index="20" stop-index="33" />
<direction direction-type="BACKWARD" start-index="6" stop-index="13" />
</fetch>
- <fetch sql-case-id="fetch_backward_count">
+ <fetch sql-case-id="fetch_cursor_with_backward_count">
<cursor-name name="t_order_cursor" start-index="23" stop-index="36" />
<direction direction-type="BACKWARD_COUNT" count="10" start-index="6" stop-index="16" />
</fetch>
- <fetch sql-case-id="fetch_backward_all">
+ <fetch sql-case-id="fetch_cursor_with_backward_all">
<cursor-name name="t_order_cursor" start-index="24" stop-index="37" />
<direction direction-type="BACKWARD_ALL" start-index="6" stop-index="17" />
</fetch>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/move.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/move.xml
index 5f705abbcd2..0481c82f7d3 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/move.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/ddl/move.xml
@@ -17,72 +17,80 @@
-->
<sql-parser-test-cases>
- <move sql-case-id="move_next">
+ <move sql-case-id="move_cursor">
+ <cursor-name name="t_order_cursor" start-index="5" stop-index="18" />
+ </move>
+
+ <move sql-case-id="move_cursor_with_from">
+ <cursor-name name="t_order_cursor" start-index="10" stop-index="23" />
+ </move>
+
+ <move sql-case-id="move_cursor_with_next">
<cursor-name name="t_order_cursor" start-index="15" stop-index="28" />
<direction direction-type="NEXT" start-index="5" stop-index="8" />
</move>
- <move sql-case-id="move_prior">
+ <move sql-case-id="move_cursor_with_prior">
<cursor-name name="t_order_cursor" start-index="16" stop-index="29" />
<direction direction-type="PRIOR" start-index="5" stop-index="9" />
</move>
- <move sql-case-id="move_first">
+ <move sql-case-id="move_cursor_with_first">
<cursor-name name="t_order_cursor" start-index="16" stop-index="29" />
<direction direction-type="FIRST" start-index="5" stop-index="9" />
</move>
- <move sql-case-id="move_last">
+ <move sql-case-id="move_cursor_with_last">
<cursor-name name="t_order_cursor" start-index="15" stop-index="28" />
<direction direction-type="LAST" start-index="5" stop-index="8" />
</move>
- <move sql-case-id="move_absolute_count">
+ <move sql-case-id="move_cursor_with_absolute_count">
<cursor-name name="t_order_cursor" start-index="22" stop-index="35" />
<direction direction-type="ABSOLUTE_COUNT" count="10" start-index="5" stop-index="15" />
</move>
- <move sql-case-id="move_relative_count">
+ <move sql-case-id="move_cursor_with_relative_count">
<cursor-name name="t_order_cursor" start-index="22" stop-index="35" />
<direction direction-type="RELATIVE_COUNT" count="10" start-index="5" stop-index="15" />
</move>
- <move sql-case-id="move_count">
+ <move sql-case-id="move_cursor_with_count">
<cursor-name name="t_order_cursor" start-index="13" stop-index="26" />
<direction direction-type="COUNT" count="10" start-index="5" stop-index="6" />
</move>
- <move sql-case-id="move_all">
+ <move sql-case-id="move_cursor_with_all">
<cursor-name name="t_order_cursor" start-index="14" stop-index="27" />
<direction direction-type="ALL" start-index="5" stop-index="7" />
</move>
- <move sql-case-id="move_forward">
+ <move sql-case-id="move_cursor_with_forward">
<cursor-name name="t_order_cursor" start-index="18" stop-index="31" />
<direction direction-type="FORWARD" start-index="5" stop-index="11" />
</move>
- <move sql-case-id="move_forward_count">
+ <move sql-case-id="move_cursor_with_forward_count">
<cursor-name name="t_order_cursor" start-index="21" stop-index="34" />
<direction direction-type="FORWARD_COUNT" count="10" start-index="5" stop-index="14" />
</move>
- <move sql-case-id="move_forward_all">
+ <move sql-case-id="move_cursor_with_forward_all">
<cursor-name name="t_order_cursor" start-index="22" stop-index="35" />
<direction direction-type="FORWARD_ALL" start-index="5" stop-index="15" />
</move>
- <move sql-case-id="move_backward">
+ <move sql-case-id="move_cursor_with_backward">
<cursor-name name="t_order_cursor" start-index="19" stop-index="32" />
<direction direction-type="BACKWARD" start-index="5" stop-index="12" />
</move>
- <move sql-case-id="move_backward_count">
+ <move sql-case-id="move_cursor_with_backward_count">
<cursor-name name="t_order_cursor" start-index="22" stop-index="35" />
<direction direction-type="BACKWARD_COUNT" count="10" start-index="5" stop-index="15" />
</move>
- <move sql-case-id="move_backward_all">
+ <move sql-case-id="move_cursor_with_backward_all">
<cursor-name name="t_order_cursor" start-index="23" stop-index="36" />
<direction direction-type="BACKWARD_ALL" start-index="5" stop-index="16" />
</move>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/fetch.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/fetch.xml
index f0dc70e5693..c84a48001e4 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/fetch.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/fetch.xml
@@ -17,18 +17,20 @@
-->
<sql-cases>
- <sql-case id="fetch_next" value="FETCH NEXT FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="fetch_prior" value="FETCH PRIOR FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="fetch_first" value="FETCH FIRST FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="fetch_last" value="FETCH LAST FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="fetch_absolute_count" value="FETCH ABSOLUTE 10 FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="fetch_relative_count" value="FETCH RELATIVE 10 FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="fetch_count" value="FETCH 10 FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="fetch_all" value="FETCH ALL FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="fetch_forward" value="FETCH FORWARD FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="fetch_forward_count" value="FETCH FORWARD 10 FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="fetch_forward_all" value="FETCH FORWARD ALL FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="fetch_backward" value="FETCH BACKWARD FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="fetch_backward_count" value="FETCH BACKWARD 10 FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="fetch_backward_all" value="FETCH BACKWARD ALL FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="fetch_cursor" value="FETCH t_order_cursor;" db-types="openGauss" />
+ <sql-case id="fetch_cursor_with_from" value="FETCH FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="fetch_cursor_with_next" value="FETCH NEXT FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="fetch_cursor_with_prior" value="FETCH PRIOR FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="fetch_cursor_with_first" value="FETCH FIRST FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="fetch_cursor_with_last" value="FETCH LAST FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="fetch_cursor_with_absolute_count" value="FETCH ABSOLUTE 10 FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="fetch_cursor_with_relative_count" value="FETCH RELATIVE 10 FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="fetch_cursor_with_count" value="FETCH 10 FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="fetch_cursor_with_all" value="FETCH ALL FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="fetch_cursor_with_forward" value="FETCH FORWARD FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="fetch_cursor_with_forward_count" value="FETCH FORWARD 10 FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="fetch_cursor_with_forward_all" value="FETCH FORWARD ALL FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="fetch_cursor_with_backward" value="FETCH BACKWARD FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="fetch_cursor_with_backward_count" value="FETCH BACKWARD 10 FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="fetch_cursor_with_backward_all" value="FETCH BACKWARD ALL FROM t_order_cursor;" db-types="openGauss" />
</sql-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/move.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/move.xml
index a01e916d258..058352eea55 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/move.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/ddl/move.xml
@@ -17,18 +17,20 @@
-->
<sql-cases>
- <sql-case id="move_next" value="MOVE NEXT FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="move_prior" value="MOVE PRIOR FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="move_first" value="MOVE FIRST FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="move_last" value="MOVE LAST FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="move_absolute_count" value="MOVE ABSOLUTE 10 FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="move_relative_count" value="MOVE RELATIVE 10 FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="move_count" value="MOVE 10 FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="move_all" value="MOVE ALL FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="move_forward" value="MOVE FORWARD FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="move_forward_count" value="MOVE FORWARD 10 FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="move_forward_all" value="MOVE FORWARD ALL FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="move_backward" value="MOVE BACKWARD FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="move_backward_count" value="MOVE BACKWARD 10 FROM t_order_cursor;" db-types="openGauss" />
- <sql-case id="move_backward_all" value="MOVE BACKWARD ALL FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="move_cursor" value="MOVE t_order_cursor;" db-types="openGauss" />
+ <sql-case id="move_cursor_with_from" value="MOVE FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="move_cursor_with_next" value="MOVE NEXT FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="move_cursor_with_prior" value="MOVE PRIOR FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="move_cursor_with_first" value="MOVE FIRST FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="move_cursor_with_last" value="MOVE LAST FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="move_cursor_with_absolute_count" value="MOVE ABSOLUTE 10 FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="move_cursor_with_relative_count" value="MOVE RELATIVE 10 FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="move_cursor_with_count" value="MOVE 10 FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="move_cursor_with_all" value="MOVE ALL FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="move_cursor_with_forward" value="MOVE FORWARD FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="move_cursor_with_forward_count" value="MOVE FORWARD 10 FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="move_cursor_with_forward_all" value="MOVE FORWARD ALL FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="move_cursor_with_backward" value="MOVE BACKWARD FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="move_cursor_with_backward_count" value="MOVE BACKWARD 10 FROM t_order_cursor;" db-types="openGauss" />
+ <sql-case id="move_cursor_with_backward_all" value="MOVE BACKWARD ALL FROM t_order_cursor;" db-types="openGauss" />
</sql-cases>