You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by zh...@apache.org on 2025/06/06 13:32:14 UTC
(shardingsphere) branch master updated: Remove useless impl of MySQLStatement (#35608)
This is an automated email from the ASF dual-hosted git repository.
zhangliang 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 66cd5ed768a Remove useless impl of MySQLStatement (#35608)
66cd5ed768a is described below
commit 66cd5ed768a67f6abd5e8efa47fa8dfc6af2543f
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Fri Jun 6 21:32:08 2025 +0800
Remove useless impl of MySQLStatement (#35608)
* Remove useless impl of MySQLStatement
* Remove useless impl of MySQLStatement
---
.../distsql/syntax/rul/parse-sql.cn.md | 2 +-
.../distsql/syntax/rul/parse-sql.en.md | 2 +-
.../ddl/ShardingAlterViewSupportedCheckerTest.java | 3 +-
...hardingCreateProcedureSupportedCheckerTest.java | 5 +-
.../merge/dql/ShardingDQLResultMergerTest.java | 39 +++++------
.../dql/groupby/GroupByMemoryMergedResultTest.java | 9 ++-
.../dql/groupby/GroupByStreamMergedResultTest.java | 3 +-
.../statement/dml/SelectStatementContextTest.java | 7 +-
.../visitor/statement/DorisStatementVisitor.java | 71 ++++++++++---------
.../statement/type/DorisDALStatementVisitor.java | 4 +-
.../statement/type/DorisDDLStatementVisitor.java | 65 +++++++++---------
.../visitor/statement/MySQLStatementVisitor.java | 71 ++++++++++---------
.../statement/type/MySQLDALStatementVisitor.java | 4 +-
.../statement/type/MySQLDDLStatementVisitor.java | 80 +++++++++++-----------
.../core/statement/dal/ExplainStatement.java | 24 ++-----
.../core/statement/ddl/AlterTableStatement.java | 24 +++++++
.../statement/ddl/CreateFunctionStatement.java | 4 +-
.../core/statement/ddl/CreateIndexStatement.java | 24 ++-----
.../statement/ddl/CreateProcedureStatement.java | 4 +-
.../core/statement/ddl/DropIndexStatement.java | 24 ++-----
.../sql/parser/statement/mysql/MySQLStatement.java | 26 -------
.../statement/mysql/dal/MySQLExplainStatement.java | 47 -------------
.../mysql/dcl/MySQLCreateUserStatement.java | 3 +-
.../statement/mysql/dcl/MySQLGrantStatement.java | 3 +-
.../statement/mysql/dcl/MySQLRevokeStatement.java | 3 +-
.../mysql/ddl/MySQLAlterTableStatement.java | 55 ---------------
.../mysql/ddl/MySQLAlterViewStatement.java | 46 -------------
.../mysql/ddl/MySQLCreateFunctionStatement.java | 39 -----------
.../mysql/ddl/MySQLCreateIndexStatement.java | 52 --------------
.../mysql/ddl/MySQLCreateProcedureStatement.java | 39 -----------
.../mysql/ddl/MySQLCreateTableStatement.java | 53 --------------
.../mysql/ddl/MySQLDropIndexStatement.java | 55 ---------------
.../mysql/ddl/MySQLDropTableStatement.java | 35 ----------
.../mysql/ddl/MySQLDropViewStatement.java | 33 ---------
.../statement/mysql/dml/MySQLDeleteStatement.java | 63 -----------------
.../statement/mysql/dml/MySQLInsertStatement.java | 55 ---------------
.../statement/mysql/dml/MySQLSelectStatement.java | 55 ---------------
.../statement/mysql/dml/MySQLUpdateStatement.java | 55 ---------------
.../distsql/rul/ParseDistSQLExecutorTest.java | 2 +-
.../MySQLDialectSaneQueryResultEngineTest.java | 12 ++--
.../admin/MySQLAdminExecutorCreatorTest.java | 32 ++++-----
.../MySQLSystemVariableQueryExecutorTest.java | 10 +--
.../binary/prepare/MySQLComStmtPrepareChecker.java | 34 ++++-----
.../command/MySQLCommandPacketFactoryTest.java | 4 +-
.../execute/MySQLComStmtExecuteExecutorTest.java | 14 ++--
.../prepare/MySQLComStmtPrepareCheckerTest.java | 36 +++++-----
.../prepare/MySQLComStmtPrepareExecutorTest.java | 12 ++--
.../query/MySQLMultiStatementsHandlerTest.java | 8 +--
.../main/resources/case/ddl/create-procedure.xml | 20 +++---
49 files changed, 321 insertions(+), 1049 deletions(-)
diff --git a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rul/parse-sql.cn.md b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rul/parse-sql.cn.md
index a8e1ce40698..d406a6fd7c9 100644
--- a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rul/parse-sql.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rul/parse-sql.cn.md
@@ -41,7 +41,7 @@ mysql> PARSE SELECT * FROM t_order;
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| parsed_statement | parsed_statement_detail |
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| MySQLSelectStatement | {"projections":{"startIndex":7,"stopIndex":7,"projections":[{"startIndex":7,"stopIndex":7}],"distinctRow":false},"from":{"tableName":{"startIndex":14,"stopIndex":20,"identifier":{"value":"t_order","quoteCharacter":"NONE"}}},"parameterCount":0,"parameterMarkerSegments":[],"commentSegments":[]} |
+| SelectStatement | {"projections":{"startIndex":7,"stopIndex":7,"projections":[{"startIndex":7,"stopIndex":7}],"distinctRow":false},"from":{"tableName":{"startIndex":14,"stopIndex":20,"identifier":{"value":"t_order","quoteCharacter":"NONE"}}},"parameterCount":0,"parameterMarkerSegments":[],"commentSegments":[]} |
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)
```
diff --git a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rul/parse-sql.en.md b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rul/parse-sql.en.md
index d2c5aede33e..8a432b15cc3 100644
--- a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rul/parse-sql.en.md
+++ b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rul/parse-sql.en.md
@@ -41,7 +41,7 @@ mysql> PARSE SELECT * FROM t_order;
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
| parsed_statement | parsed_statement_detail |
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
-| MySQLSelectStatement | {"projections":{"startIndex":7,"stopIndex":7,"projections":[{"startIndex":7,"stopIndex":7}],"distinctRow":false},"from":{"tableName":{"startIndex":14,"stopIndex":20,"identifier":{"value":"t_order","quoteCharacter":"NONE"}}},"parameterCount":0,"parameterMarkerSegments":[],"commentSegments":[]} |
+| SelectStatement | {"projections":{"startIndex":7,"stopIndex":7,"projections":[{"startIndex":7,"stopIndex":7}],"distinctRow":false},"from":{"tableName":{"startIndex":14,"stopIndex":20,"identifier":{"value":"t_order","quoteCharacter":"NONE"}}},"parameterCount":0,"parameterMarkerSegments":[],"commentSegments":[]} |
+----------------------+-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------+
1 row in set (0.01 sec)
```
diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/checker/sql/ddl/ShardingAlterViewSupportedCheckerTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/checker/sql/ddl/ShardingAlterViewSupportedCheckerTest.java
index e2d605ffa65..f1328e9765e 100644
--- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/checker/sql/ddl/ShardingAlterViewSupportedCheckerTest.java
+++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/checker/sql/ddl/ShardingAlterViewSupportedCheckerTest.java
@@ -31,7 +31,6 @@ import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterViewStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLAlterViewStatement;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
@@ -59,7 +58,7 @@ class ShardingAlterViewSupportedCheckerTest {
SelectStatement selectStatement = new SelectStatement();
selectStatement.setFrom(new SimpleTableSegment(new TableNameSegment(0, 0, new IdentifierValue("t_order"))));
selectStatement.setProjections(new ProjectionsSegment(0, 0));
- AlterViewStatement sqlStatement = new MySQLAlterViewStatement();
+ AlterViewStatement sqlStatement = new AlterViewStatement();
sqlStatement.setView(new SimpleTableSegment(new TableNameSegment(0, 0, new IdentifierValue("t_order_view"))));
sqlStatement.setSelect(selectStatement);
ShardingSphereMetaData metaData = mock(ShardingSphereMetaData.class);
diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/checker/sql/ddl/ShardingCreateProcedureSupportedCheckerTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/checker/sql/ddl/ShardingCreateProcedureSupportedCheckerTest.java
index 61fd0da1ea4..d5691edf574 100644
--- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/checker/sql/ddl/ShardingCreateProcedureSupportedCheckerTest.java
+++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/checker/sql/ddl/ShardingCreateProcedureSupportedCheckerTest.java
@@ -32,7 +32,6 @@ import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateP
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateTableStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateProcedureStatement;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Mock;
@@ -65,7 +64,7 @@ class ShardingCreateProcedureSupportedCheckerTest {
RoutineBodySegment routineBody = new RoutineBodySegment(0, 0);
routineBody.getValidStatements().add(validStatementSegment);
routineBody.getValidStatements().add(selectValidStatementSegment);
- MySQLCreateProcedureStatement sqlStatement = new MySQLCreateProcedureStatement();
+ CreateProcedureStatement sqlStatement = new CreateProcedureStatement();
sqlStatement.setRoutineBody(routineBody);
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
ShardingSphereSchema schema = mock(ShardingSphereSchema.class);
@@ -83,7 +82,7 @@ class ShardingCreateProcedureSupportedCheckerTest {
validStatementSegment.setSqlStatement(selectStatement);
RoutineBodySegment routineBody = new RoutineBodySegment(0, 0);
routineBody.getValidStatements().add(validStatementSegment);
- MySQLCreateProcedureStatement sqlStatement = new MySQLCreateProcedureStatement();
+ CreateProcedureStatement sqlStatement = new CreateProcedureStatement();
sqlStatement.setRoutineBody(routineBody);
CreateProcedureStatementContext sqlStatementContext = new CreateProcedureStatementContext(mock(), sqlStatement);
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/ShardingDQLResultMergerTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/ShardingDQLResultMergerTest.java
index 0750a0de722..cf27cf5ee93 100644
--- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/ShardingDQLResultMergerTest.java
+++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/ShardingDQLResultMergerTest.java
@@ -59,7 +59,6 @@ import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table
import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableNameSegment;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLSelectStatement;
import org.junit.jupiter.api.Test;
import java.sql.SQLException;
@@ -86,7 +85,7 @@ class ShardingDQLResultMergerTest {
void assertBuildIteratorStreamMergedResult() throws SQLException {
ShardingDQLResultMerger resultMerger = new ShardingDQLResultMerger(mysqlDatabaseType);
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
- SelectStatement selectStatement = buildSelectStatement(new MySQLSelectStatement());
+ SelectStatement selectStatement = buildSelectStatement(new SelectStatement());
selectStatement.setProjections(new ProjectionsSegment(0, 0));
SelectStatementContext selectStatementContext = new SelectStatementContext(
mysqlDatabaseType, selectStatement, Collections.emptyList(), createShardingSphereMetaData(database), "foo_db", Collections.emptyList());
@@ -97,7 +96,7 @@ class ShardingDQLResultMergerTest {
void assertBuildIteratorStreamMergedResultWithLimit() throws SQLException {
final ShardingDQLResultMerger resultMerger = new ShardingDQLResultMerger(mysqlDatabaseType);
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
- MySQLSelectStatement selectStatement = (MySQLSelectStatement) buildSelectStatement(new MySQLSelectStatement());
+ SelectStatement selectStatement = buildSelectStatement(new SelectStatement());
selectStatement.setProjections(new ProjectionsSegment(0, 0));
selectStatement.setLimit(new LimitSegment(0, 0, new NumberLiteralLimitValueSegment(0, 0, 1L), null));
SelectStatementContext selectStatementContext = new SelectStatementContext(
@@ -110,7 +109,7 @@ class ShardingDQLResultMergerTest {
void assertBuildIteratorStreamMergedResultWithMySQLLimit() throws SQLException {
final ShardingDQLResultMerger resultMerger = new ShardingDQLResultMerger(mysqlDatabaseType);
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
- MySQLSelectStatement selectStatement = (MySQLSelectStatement) buildSelectStatement(new MySQLSelectStatement());
+ SelectStatement selectStatement = buildSelectStatement(new SelectStatement());
selectStatement.setProjections(new ProjectionsSegment(0, 0));
selectStatement.setLimit(new LimitSegment(0, 0, new NumberLiteralLimitValueSegment(0, 0, 1L), null));
SelectStatementContext selectStatementContext = new SelectStatementContext(
@@ -134,7 +133,7 @@ class ShardingDQLResultMergerTest {
when(whereSegment.getExpr()).thenReturn(binaryOperationExpression);
SubqueryTableSegment subqueryTableSegment = mock(SubqueryTableSegment.class);
SubquerySegment subquerySegment = mock(SubquerySegment.class);
- SelectStatement subSelectStatement = mock(MySQLSelectStatement.class);
+ SelectStatement subSelectStatement = mock(SelectStatement.class);
ProjectionsSegment subProjectionsSegment = mock(ProjectionsSegment.class);
TopProjectionSegment topProjectionSegment = mock(TopProjectionSegment.class);
when(topProjectionSegment.getAlias()).thenReturn("row_id");
@@ -169,7 +168,7 @@ class ShardingDQLResultMergerTest {
void assertBuildOrderByStreamMergedResult() throws SQLException {
final ShardingDQLResultMerger resultMerger = new ShardingDQLResultMerger(mysqlDatabaseType);
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
- MySQLSelectStatement selectStatement = (MySQLSelectStatement) buildSelectStatement(new MySQLSelectStatement());
+ SelectStatement selectStatement = buildSelectStatement(new SelectStatement());
selectStatement.setOrderBy(new OrderBySegment(0, 0, Collections.singletonList(new IndexOrderByItemSegment(0, 0, 1, OrderDirection.DESC, NullsOrderType.FIRST))));
selectStatement.setProjections(new ProjectionsSegment(0, 0));
SelectStatementContext selectStatementContext = new SelectStatementContext(
@@ -181,7 +180,7 @@ class ShardingDQLResultMergerTest {
void assertBuildOrderByStreamMergedResultWithMySQLLimit() throws SQLException {
final ShardingDQLResultMerger resultMerger = new ShardingDQLResultMerger(mysqlDatabaseType);
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
- MySQLSelectStatement selectStatement = (MySQLSelectStatement) buildSelectStatement(new MySQLSelectStatement());
+ SelectStatement selectStatement = buildSelectStatement(new SelectStatement());
selectStatement.setOrderBy(new OrderBySegment(0, 0, Collections.singletonList(new IndexOrderByItemSegment(0, 0, 1, OrderDirection.DESC, NullsOrderType.FIRST))));
selectStatement.setProjections(new ProjectionsSegment(0, 0));
selectStatement.setLimit(new LimitSegment(0, 0, new NumberLiteralLimitValueSegment(0, 0, 1L), null));
@@ -204,7 +203,7 @@ class ShardingDQLResultMergerTest {
when(whereSegment.getExpr()).thenReturn(binaryOperationExpression);
SubqueryTableSegment subqueryTableSegment = mock(SubqueryTableSegment.class);
SubquerySegment subquerySegment = mock(SubquerySegment.class);
- SelectStatement subSelectStatement = mock(MySQLSelectStatement.class);
+ SelectStatement subSelectStatement = mock(SelectStatement.class);
ProjectionsSegment subProjectionsSegment = mock(ProjectionsSegment.class);
TopProjectionSegment topProjectionSegment = mock(TopProjectionSegment.class);
when(topProjectionSegment.getAlias()).thenReturn("row_id");
@@ -243,7 +242,7 @@ class ShardingDQLResultMergerTest {
void assertBuildGroupByStreamMergedResult() throws SQLException {
final ShardingDQLResultMerger resultMerger = new ShardingDQLResultMerger(mysqlDatabaseType);
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
- MySQLSelectStatement selectStatement = (MySQLSelectStatement) buildSelectStatement(new MySQLSelectStatement());
+ SelectStatement selectStatement = buildSelectStatement(new SelectStatement());
selectStatement.setGroupBy(new GroupBySegment(0, 0, Collections.singletonList(new IndexOrderByItemSegment(0, 0, 1, OrderDirection.DESC, NullsOrderType.FIRST))));
selectStatement.setOrderBy(new OrderBySegment(0, 0, Collections.singletonList(new IndexOrderByItemSegment(0, 0, 1, OrderDirection.DESC, NullsOrderType.FIRST))));
selectStatement.setProjections(new ProjectionsSegment(0, 0));
@@ -256,7 +255,7 @@ class ShardingDQLResultMergerTest {
void assertBuildGroupByStreamMergedResultWithMySQLLimit() throws SQLException {
final ShardingDQLResultMerger resultMerger = new ShardingDQLResultMerger(mysqlDatabaseType);
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
- MySQLSelectStatement selectStatement = (MySQLSelectStatement) buildSelectStatement(new MySQLSelectStatement());
+ SelectStatement selectStatement = buildSelectStatement(new SelectStatement());
selectStatement.setGroupBy(new GroupBySegment(0, 0, Collections.singletonList(new IndexOrderByItemSegment(0, 0, 1, OrderDirection.DESC, NullsOrderType.FIRST))));
selectStatement.setOrderBy(new OrderBySegment(0, 0, Collections.singletonList(new IndexOrderByItemSegment(0, 0, 1, OrderDirection.DESC, NullsOrderType.FIRST))));
selectStatement.setProjections(new ProjectionsSegment(0, 0));
@@ -280,7 +279,7 @@ class ShardingDQLResultMergerTest {
when(whereSegment.getExpr()).thenReturn(binaryOperationExpression);
SubqueryTableSegment subqueryTableSegment = mock(SubqueryTableSegment.class);
SubquerySegment subquerySegment = mock(SubquerySegment.class);
- SelectStatement subSelectStatement = mock(MySQLSelectStatement.class);
+ SelectStatement subSelectStatement = mock(SelectStatement.class);
ProjectionsSegment subProjectionsSegment = mock(ProjectionsSegment.class);
TopProjectionSegment topProjectionSegment = mock(TopProjectionSegment.class);
when(topProjectionSegment.getAlias()).thenReturn("row_id");
@@ -288,7 +287,7 @@ class ShardingDQLResultMergerTest {
when(subSelectStatement.getProjections()).thenReturn(subProjectionsSegment);
when(subquerySegment.getSelect()).thenReturn(subSelectStatement);
when(subqueryTableSegment.getSubquery()).thenReturn(subquerySegment);
- SelectStatement selectStatement = (SelectStatement) buildSelectStatement(new SelectStatement());
+ SelectStatement selectStatement = buildSelectStatement(new SelectStatement());
selectStatement.setGroupBy(new GroupBySegment(0, 0, Collections.singletonList(new IndexOrderByItemSegment(0, 0, 1, OrderDirection.DESC, NullsOrderType.FIRST))));
selectStatement.setOrderBy(new OrderBySegment(0, 0, Collections.singletonList(new IndexOrderByItemSegment(0, 0, 1, OrderDirection.DESC, NullsOrderType.FIRST))));
selectStatement.setProjections(new ProjectionsSegment(0, 0));
@@ -321,7 +320,7 @@ class ShardingDQLResultMergerTest {
void assertBuildGroupByMemoryMergedResult() throws SQLException {
final ShardingDQLResultMerger resultMerger = new ShardingDQLResultMerger(mysqlDatabaseType);
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
- MySQLSelectStatement selectStatement = (MySQLSelectStatement) buildSelectStatement(new MySQLSelectStatement());
+ SelectStatement selectStatement = buildSelectStatement(new SelectStatement());
selectStatement.setGroupBy(new GroupBySegment(0, 0, Collections.singletonList(new IndexOrderByItemSegment(0, 0, 1, OrderDirection.DESC, NullsOrderType.FIRST))));
selectStatement.setProjections(new ProjectionsSegment(0, 0));
SelectStatementContext selectStatementContext = new SelectStatementContext(
@@ -333,7 +332,7 @@ class ShardingDQLResultMergerTest {
void assertBuildGroupByMemoryMergedResultWithMySQLLimit() throws SQLException {
final ShardingDQLResultMerger resultMerger = new ShardingDQLResultMerger(mysqlDatabaseType);
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
- MySQLSelectStatement selectStatement = (MySQLSelectStatement) buildSelectStatement(new MySQLSelectStatement());
+ SelectStatement selectStatement = buildSelectStatement(new SelectStatement());
selectStatement.setGroupBy(new GroupBySegment(0, 0, Collections.singletonList(new IndexOrderByItemSegment(0, 0, 1, OrderDirection.DESC, NullsOrderType.FIRST))));
selectStatement.setProjections(new ProjectionsSegment(0, 0));
selectStatement.setLimit(new LimitSegment(0, 0, new NumberLiteralLimitValueSegment(0, 0, 1L), null));
@@ -356,7 +355,7 @@ class ShardingDQLResultMergerTest {
when(whereSegment.getExpr()).thenReturn(binaryOperationExpression);
SubqueryTableSegment subqueryTableSegment = mock(SubqueryTableSegment.class);
SubquerySegment subquerySegment = mock(SubquerySegment.class);
- SelectStatement subSelectStatement = mock(MySQLSelectStatement.class);
+ SelectStatement subSelectStatement = mock(SelectStatement.class);
ProjectionsSegment subProjectionsSegment = mock(ProjectionsSegment.class);
TopProjectionSegment topProjectionSegment = mock(TopProjectionSegment.class);
when(topProjectionSegment.getAlias()).thenReturn("row_id");
@@ -364,7 +363,7 @@ class ShardingDQLResultMergerTest {
when(subSelectStatement.getProjections()).thenReturn(subProjectionsSegment);
when(subquerySegment.getSelect()).thenReturn(subSelectStatement);
when(subqueryTableSegment.getSubquery()).thenReturn(subquerySegment);
- SelectStatement selectStatement = (SelectStatement) buildSelectStatement(new SelectStatement());
+ SelectStatement selectStatement = buildSelectStatement(new SelectStatement());
selectStatement.setGroupBy(new GroupBySegment(0, 0, Collections.singletonList(new IndexOrderByItemSegment(0, 0, 1, OrderDirection.DESC, NullsOrderType.FIRST))));
selectStatement.setOrderBy(new OrderBySegment(0, 0, Collections.singletonList(new IndexOrderByItemSegment(0, 0, 1, OrderDirection.DESC, NullsOrderType.FIRST))));
selectStatement.setProjections(new ProjectionsSegment(0, 0));
@@ -398,7 +397,7 @@ class ShardingDQLResultMergerTest {
void assertBuildGroupByMemoryMergedResultWithAggregationOnly() throws SQLException {
final ShardingDQLResultMerger resultMerger = new ShardingDQLResultMerger(mysqlDatabaseType);
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
- MySQLSelectStatement selectStatement = (MySQLSelectStatement) buildSelectStatement(new MySQLSelectStatement());
+ SelectStatement selectStatement = buildSelectStatement(new SelectStatement());
ProjectionsSegment projectionsSegment = new ProjectionsSegment(0, 0);
projectionsSegment.getProjections().add(new AggregationProjectionSegment(0, 0, AggregationType.COUNT, "COUNT(*)"));
selectStatement.setProjections(projectionsSegment);
@@ -409,7 +408,7 @@ class ShardingDQLResultMergerTest {
@Test
void assertBuildGroupByMemoryMergedResultWithAggregationOnlyWithMySQLLimit() throws SQLException {
- MySQLSelectStatement selectStatement = (MySQLSelectStatement) buildSelectStatement(new MySQLSelectStatement());
+ SelectStatement selectStatement = buildSelectStatement(new SelectStatement());
ProjectionsSegment projectionsSegment = new ProjectionsSegment(0, 0);
projectionsSegment.getProjections().add(new AggregationProjectionSegment(0, 0, AggregationType.COUNT, "COUNT(*)"));
selectStatement.setProjections(projectionsSegment);
@@ -434,7 +433,7 @@ class ShardingDQLResultMergerTest {
when(whereSegment.getExpr()).thenReturn(binaryOperationExpression);
SubqueryTableSegment subqueryTableSegment = mock(SubqueryTableSegment.class);
SubquerySegment subquerySegment = mock(SubquerySegment.class);
- SelectStatement subSelectStatement = mock(MySQLSelectStatement.class);
+ SelectStatement subSelectStatement = mock(SelectStatement.class);
ProjectionsSegment subProjectionsSegment = mock(ProjectionsSegment.class);
TopProjectionSegment topProjectionSegment = mock(TopProjectionSegment.class);
when(topProjectionSegment.getAlias()).thenReturn("row_id");
@@ -444,7 +443,7 @@ class ShardingDQLResultMergerTest {
when(subqueryTableSegment.getSubquery()).thenReturn(subquerySegment);
ProjectionsSegment projectionsSegment = new ProjectionsSegment(0, 0);
projectionsSegment.getProjections().add(new AggregationProjectionSegment(0, 0, AggregationType.COUNT, "COUNT(*)"));
- SelectStatement selectStatement = (SelectStatement) buildSelectStatement(new SelectStatement());
+ SelectStatement selectStatement = buildSelectStatement(new SelectStatement());
selectStatement.setProjections(projectionsSegment);
selectStatement.setFrom(subqueryTableSegment);
selectStatement.setWhere(whereSegment);
diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResultTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResultTest.java
index 482312920b5..eb015f9a977 100644
--- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResultTest.java
+++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByMemoryMergedResultTest.java
@@ -41,7 +41,6 @@ import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table
import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableNameSegment;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLSelectStatement;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Answers;
@@ -116,7 +115,7 @@ class GroupByMemoryMergedResultTest {
}
private SelectStatementContext createSelectStatementContext() {
- SelectStatement selectStatement = new MySQLSelectStatement();
+ SelectStatement selectStatement = new SelectStatement();
ProjectionsSegment projectionsSegment = new ProjectionsSegment(0, 0);
projectionsSegment.getProjections().add(new AggregationProjectionSegment(0, 0, AggregationType.COUNT, "COUNT(*)"));
projectionsSegment.getProjections().add(new AggregationProjectionSegment(0, 0, AggregationType.AVG, "AVG(num)"));
@@ -131,7 +130,7 @@ class GroupByMemoryMergedResultTest {
}
private SelectStatementContext createSelectStatementContext(final ShardingSphereDatabase database) {
- SelectStatement selectStatement = new MySQLSelectStatement();
+ SelectStatement selectStatement = new SelectStatement();
ProjectionsSegment projectionsSegment = new ProjectionsSegment(0, 0);
projectionsSegment.setDistinctRow(true);
projectionsSegment.getProjections().add(new ShorthandProjectionSegment(0, 0));
@@ -239,7 +238,7 @@ class GroupByMemoryMergedResultTest {
}
private SelectStatementContext createSelectStatementContextForCountGroupBy() {
- SelectStatement selectStatement = new MySQLSelectStatement();
+ SelectStatement selectStatement = new SelectStatement();
ProjectionsSegment projectionsSegment = new ProjectionsSegment(0, 0);
projectionsSegment.getProjections().add(new AggregationProjectionSegment(0, 0, AggregationType.COUNT, "COUNT(*)"));
selectStatement.setGroupBy(new GroupBySegment(0, 0, Collections.singletonList(new IndexOrderByItemSegment(0, 0, 2, OrderDirection.ASC, NullsOrderType.FIRST))));
@@ -252,7 +251,7 @@ class GroupByMemoryMergedResultTest {
}
private SelectStatementContext createSelectStatementContextForCountGroupByDifferentOrderBy() {
- SelectStatement selectStatement = new MySQLSelectStatement();
+ SelectStatement selectStatement = new SelectStatement();
ProjectionsSegment projectionsSegment = new ProjectionsSegment(0, 0);
projectionsSegment.getProjections().add(new AggregationProjectionSegment(0, 0, AggregationType.COUNT, "COUNT(*)"));
selectStatement.setGroupBy(new GroupBySegment(0, 0, Collections.singletonList(new IndexOrderByItemSegment(0, 0, 2, OrderDirection.ASC, NullsOrderType.FIRST))));
diff --git a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByStreamMergedResultTest.java b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByStreamMergedResultTest.java
index 8fadc7d2235..63ddc8cf791 100644
--- a/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByStreamMergedResultTest.java
+++ b/features/sharding/core/src/test/java/org/apache/shardingsphere/sharding/merge/dql/groupby/GroupByStreamMergedResultTest.java
@@ -43,7 +43,6 @@ import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table
import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableNameSegment;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLSelectStatement;
import org.junit.jupiter.api.Test;
import java.math.BigDecimal;
@@ -165,7 +164,7 @@ class GroupByStreamMergedResultTest {
private SelectStatementContext createSelectStatementContext() {
SimpleTableSegment tableSegment = new SimpleTableSegment(new TableNameSegment(10, 13, new IdentifierValue("tbl")));
- SelectStatement selectStatement = new MySQLSelectStatement();
+ SelectStatement selectStatement = new SelectStatement();
selectStatement.setFrom(tableSegment);
ShardingSphereDatabase database = mock(ShardingSphereDatabase.class, RETURNS_DEEP_STUBS);
when(database.getName()).thenReturn("foo_db");
diff --git a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/dml/SelectStatementContextTest.java b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/dml/SelectStatementContextTest.java
index c6e0f471458..ee468bb4c31 100644
--- a/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/dml/SelectStatementContextTest.java
+++ b/infra/binder/core/src/test/java/org/apache/shardingsphere/infra/binder/context/statement/dml/SelectStatementContextTest.java
@@ -57,7 +57,6 @@ import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table
import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableNameSegment;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLSelectStatement;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
@@ -335,7 +334,7 @@ class SelectStatementContextTest {
void assertIsContainsEnhancedTable() {
ProjectionsSegment projectionsSegment = new ProjectionsSegment(0, 0);
projectionsSegment.getProjections().add(new ColumnProjectionSegment(new ColumnSegment(0, 0, new IdentifierValue("order_id"))));
- SelectStatement selectStatement = new MySQLSelectStatement();
+ SelectStatement selectStatement = new SelectStatement();
selectStatement.setProjections(projectionsSegment);
TableNameSegment tableNameSegment = new TableNameSegment(0, 0, new IdentifierValue("t_order"));
tableNameSegment.setTableBoundInfo(new TableSegmentBoundInfo(new IdentifierValue("foo_db"), new IdentifierValue("foo_schema")));
@@ -348,7 +347,7 @@ class SelectStatementContextTest {
@Test
void assertContainsEnhancedTable() {
- SelectStatement selectStatement = new MySQLSelectStatement();
+ SelectStatement selectStatement = new SelectStatement();
selectStatement.setProjections(new ProjectionsSegment(0, 0));
selectStatement.setFrom(new SubqueryTableSegment(0, 0, new SubquerySegment(0, 0, createSubSelectStatement(), "")));
ShardingSphereMetaData metaData = new ShardingSphereMetaData(
@@ -360,7 +359,7 @@ class SelectStatementContextTest {
private SelectStatement createSubSelectStatement() {
ProjectionsSegment projectionsSegment = new ProjectionsSegment(0, 0);
projectionsSegment.getProjections().add(new ColumnProjectionSegment(new ColumnSegment(0, 0, new IdentifierValue("order_id"))));
- SelectStatement result = new MySQLSelectStatement();
+ SelectStatement result = new SelectStatement();
result.setProjections(projectionsSegment);
TableNameSegment tableNameSegment = new TableNameSegment(0, 0, new IdentifierValue("t_order"));
tableNameSegment.setTableBoundInfo(new TableSegmentBoundInfo(new IdentifierValue("foo_db"), new IdentifierValue("foo_schema")));
diff --git a/parser/sql/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/doris/visitor/statement/DorisStatementVisitor.java b/parser/sql/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/doris/visitor/statement/DorisStatementVisitor.java
index 7806ced8759..36e68b9a8ca 100644
--- a/parser/sql/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/doris/visitor/statement/DorisStatementVisitor.java
+++ b/parser/sql/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/doris/visitor/statement/DorisStatementVisitor.java
@@ -227,7 +227,10 @@ import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table
import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SubqueryTableSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableNameSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableSegment;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.DeleteStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.InsertStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.UpdateStatement;
import org.apache.shardingsphere.sql.parser.statement.core.util.SQLUtils;
import org.apache.shardingsphere.sql.parser.statement.core.value.collection.CollectionValue;
import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
@@ -237,10 +240,6 @@ import org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.Nu
import org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.OtherLiteralValue;
import org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.StringLiteralValue;
import org.apache.shardingsphere.sql.parser.statement.core.value.parametermarker.ParameterMarkerValue;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLDeleteStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLInsertStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLSelectStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLUpdateStatement;
import java.math.BigDecimal;
import java.util.ArrayList;
@@ -689,7 +688,7 @@ public abstract class DorisStatementVisitor extends DorisStatementBaseVisitor<AS
if (null != ctx.queryExpressionParens()) {
return visit(ctx.queryExpressionParens());
}
- MySQLSelectStatement result = (MySQLSelectStatement) visit(ctx.queryExpression());
+ SelectStatement result = (SelectStatement) visit(ctx.queryExpression());
if (null != ctx.lockClauseList()) {
result.setLock((LockSegment) visit(ctx.lockClauseList()));
}
@@ -710,11 +709,11 @@ public abstract class DorisStatementVisitor extends DorisStatementBaseVisitor<AS
@Override
public ASTNode visitQueryExpression(final QueryExpressionContext ctx) {
- MySQLSelectStatement result;
+ SelectStatement result;
if (null != ctx.queryExpressionBody()) {
- result = (MySQLSelectStatement) visit(ctx.queryExpressionBody());
+ result = (SelectStatement) visit(ctx.queryExpressionBody());
} else {
- result = (MySQLSelectStatement) visit(ctx.queryExpressionParens());
+ result = (SelectStatement) visit(ctx.queryExpressionParens());
}
if (null != ctx.orderByClause()) {
result.setOrderBy((OrderBySegment) visit(ctx.orderByClause()));
@@ -733,7 +732,7 @@ public abstract class DorisStatementVisitor extends DorisStatementBaseVisitor<AS
if (null != ctx.selectWithInto()) {
return visit(ctx.selectWithInto());
}
- MySQLSelectStatement result = (MySQLSelectStatement) visit(ctx.queryExpression());
+ SelectStatement result = (SelectStatement) visit(ctx.queryExpression());
if (null != ctx.lockClauseList()) {
result.setLock((LockSegment) visit(ctx.lockClauseList()));
}
@@ -767,9 +766,9 @@ public abstract class DorisStatementVisitor extends DorisStatementBaseVisitor<AS
return visit(ctx.queryPrimary());
}
if (null != ctx.queryExpressionBody() && ctx.queryExpressionBody().size() > 1) {
- MySQLSelectStatement result = new MySQLSelectStatement();
+ SelectStatement result = new SelectStatement();
SubquerySegment left = new SubquerySegment(ctx.queryExpressionBody(0).start.getStartIndex(), ctx.queryExpressionBody(0).stop.getStopIndex(),
- (MySQLSelectStatement) visit(ctx.queryExpressionBody(0)), getOriginalText(ctx.queryExpressionBody(0)));
+ (SelectStatement) visit(ctx.queryExpressionBody(0)), getOriginalText(ctx.queryExpressionBody(0)));
result.setProjections(left.getSelect().getProjections());
left.getSelect().getFrom().ifPresent(result::setFrom);
result.setCombine(createCombineSegment(ctx, left));
@@ -788,13 +787,13 @@ public abstract class DorisStatementVisitor extends DorisStatementBaseVisitor<AS
combineType = null == ctx.combineOption() || null == ctx.combineOption().ALL() ? CombineType.UNION : CombineType.UNION_ALL;
}
ParserRuleContext ruleContext = ctx.queryExpressionBody(1);
- SubquerySegment right = new SubquerySegment(ruleContext.start.getStartIndex(), ruleContext.stop.getStopIndex(), (MySQLSelectStatement) visit(ruleContext), getOriginalText(ruleContext));
+ SubquerySegment right = new SubquerySegment(ruleContext.start.getStartIndex(), ruleContext.stop.getStopIndex(), (SelectStatement) visit(ruleContext), getOriginalText(ruleContext));
return new CombineSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), left, combineType, right);
}
@Override
public ASTNode visitQuerySpecification(final QuerySpecificationContext ctx) {
- MySQLSelectStatement result = new MySQLSelectStatement();
+ SelectStatement result = new SelectStatement();
result.setProjections((ProjectionsSegment) visit(ctx.projections()));
if (null != ctx.selectSpecification()) {
result.getProjections().setDistinctRow(isDistinct(ctx));
@@ -827,7 +826,7 @@ public abstract class DorisStatementVisitor extends DorisStatementBaseVisitor<AS
@Override
public ASTNode visitTableValueConstructor(final TableValueConstructorContext ctx) {
- MySQLSelectStatement result = new MySQLSelectStatement();
+ SelectStatement result = new SelectStatement();
int startIndex = ctx.getStart().getStartIndex();
int stopIndex = ctx.getStop().getStopIndex();
ValuesExpression valuesExpression = new ValuesExpression(startIndex, stopIndex);
@@ -847,7 +846,7 @@ public abstract class DorisStatementVisitor extends DorisStatementBaseVisitor<AS
@Override
public ASTNode visitTableStatement(final TableStatementContext ctx) {
- MySQLSelectStatement result = new MySQLSelectStatement();
+ SelectStatement result = new SelectStatement();
result.setProjections(new ProjectionsSegment(ctx.start.getStartIndex(), ctx.start.getStartIndex()));
result.getProjections().getProjections().add(new ShorthandProjectionSegment(ctx.start.getStartIndex(), ctx.start.getStartIndex()));
result.setFrom(new SimpleTableSegment(new TableNameSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), new IdentifierValue(ctx.tableName().getText()))));
@@ -1430,13 +1429,13 @@ public abstract class DorisStatementVisitor extends DorisStatementBaseVisitor<AS
@Override
public ASTNode visitInsert(final InsertContext ctx) {
// TODO :FIXME, since there is no segment for insertValuesClause, InsertStatement is created by sub rule.
- MySQLInsertStatement result;
+ InsertStatement result;
if (null != ctx.insertValuesClause()) {
- result = (MySQLInsertStatement) visit(ctx.insertValuesClause());
+ result = (InsertStatement) visit(ctx.insertValuesClause());
} else if (null != ctx.insertSelectClause()) {
- result = (MySQLInsertStatement) visit(ctx.insertSelectClause());
+ result = (InsertStatement) visit(ctx.insertSelectClause());
} else {
- result = new MySQLInsertStatement();
+ result = new InsertStatement();
result.setSetAssignment((SetAssignmentSegment) visit(ctx.setAssignmentsClause()));
}
if (null != ctx.onDuplicateKeyClause()) {
@@ -1449,7 +1448,7 @@ public abstract class DorisStatementVisitor extends DorisStatementBaseVisitor<AS
@Override
public ASTNode visitInsertSelectClause(final InsertSelectClauseContext ctx) {
- MySQLInsertStatement result = new MySQLInsertStatement();
+ InsertStatement result = new InsertStatement();
result.setInsertSelect(createInsertSelectSegment(ctx));
if (null != ctx.LP_()) {
if (null != ctx.fields()) {
@@ -1464,14 +1463,14 @@ public abstract class DorisStatementVisitor extends DorisStatementBaseVisitor<AS
}
private SubquerySegment createInsertSelectSegment(final InsertSelectClauseContext ctx) {
- MySQLSelectStatement selectStatement = (MySQLSelectStatement) visit(ctx.select());
+ SelectStatement selectStatement = (SelectStatement) visit(ctx.select());
selectStatement.getParameterMarkerSegments().addAll(getParameterMarkerSegments());
return new SubquerySegment(ctx.select().start.getStartIndex(), ctx.select().stop.getStopIndex(), selectStatement, getOriginalText(ctx.select()));
}
@Override
public ASTNode visitInsertValuesClause(final InsertValuesClauseContext ctx) {
- MySQLInsertStatement result = new MySQLInsertStatement();
+ InsertStatement result = new InsertStatement();
if (null != ctx.LP_()) {
if (null != ctx.fields()) {
result.setInsertColumns(new InsertColumnsSegment(ctx.LP_().getSymbol().getStartIndex(), ctx.RP_().getSymbol().getStopIndex(), createInsertColumns(ctx.fields())));
@@ -1505,13 +1504,13 @@ public abstract class DorisStatementVisitor extends DorisStatementBaseVisitor<AS
@Override
public ASTNode visitReplace(final ReplaceContext ctx) {
// TODO :FIXME, since there is no segment for replaceValuesClause, ReplaceStatement is created by sub rule.
- MySQLInsertStatement result;
+ InsertStatement result;
if (null != ctx.replaceValuesClause()) {
- result = (MySQLInsertStatement) visit(ctx.replaceValuesClause());
+ result = (InsertStatement) visit(ctx.replaceValuesClause());
} else if (null != ctx.replaceSelectClause()) {
- result = (MySQLInsertStatement) visit(ctx.replaceSelectClause());
+ result = (InsertStatement) visit(ctx.replaceSelectClause());
} else {
- result = new MySQLInsertStatement();
+ result = new InsertStatement();
result.setSetAssignment((SetAssignmentSegment) visit(ctx.setAssignmentsClause()));
}
result.setTable((SimpleTableSegment) visit(ctx.tableName()));
@@ -1521,7 +1520,7 @@ public abstract class DorisStatementVisitor extends DorisStatementBaseVisitor<AS
@Override
public ASTNode visitReplaceSelectClause(final ReplaceSelectClauseContext ctx) {
- MySQLInsertStatement result = new MySQLInsertStatement();
+ InsertStatement result = new InsertStatement();
if (null != ctx.LP_()) {
if (null != ctx.fields()) {
result.setInsertColumns(new InsertColumnsSegment(ctx.LP_().getSymbol().getStartIndex(), ctx.RP_().getSymbol().getStopIndex(), createInsertColumns(ctx.fields())));
@@ -1536,13 +1535,13 @@ public abstract class DorisStatementVisitor extends DorisStatementBaseVisitor<AS
}
private SubquerySegment createReplaceSelectSegment(final ReplaceSelectClauseContext ctx) {
- MySQLSelectStatement selectStatement = (MySQLSelectStatement) visit(ctx.select());
+ SelectStatement selectStatement = (SelectStatement) visit(ctx.select());
return new SubquerySegment(ctx.select().start.getStartIndex(), ctx.select().stop.getStopIndex(), selectStatement, getOriginalText(ctx.select()));
}
@Override
public ASTNode visitReplaceValuesClause(final ReplaceValuesClauseContext ctx) {
- MySQLInsertStatement result = new MySQLInsertStatement();
+ InsertStatement result = new InsertStatement();
if (null != ctx.LP_()) {
if (null != ctx.fields()) {
result.setInsertColumns(new InsertColumnsSegment(ctx.LP_().getSymbol().getStartIndex(), ctx.RP_().getSymbol().getStopIndex(), createInsertColumns(ctx.fields())));
@@ -1566,7 +1565,7 @@ public abstract class DorisStatementVisitor extends DorisStatementBaseVisitor<AS
@Override
public ASTNode visitUpdate(final UpdateContext ctx) {
- MySQLUpdateStatement result = new MySQLUpdateStatement();
+ UpdateStatement result = new UpdateStatement();
TableSegment tableSegment = (TableSegment) visit(ctx.tableReferences());
result.setTable(tableSegment);
result.setSetAssignment((SetAssignmentSegment) visit(ctx.setAssignmentsClause()));
@@ -1631,7 +1630,7 @@ public abstract class DorisStatementVisitor extends DorisStatementBaseVisitor<AS
@Override
public ASTNode visitDelete(final DeleteContext ctx) {
- MySQLDeleteStatement result = new MySQLDeleteStatement();
+ DeleteStatement result = new DeleteStatement();
if (null != ctx.multipleTablesClause()) {
result.setTable((TableSegment) visit(ctx.multipleTablesClause()));
} else {
@@ -1678,16 +1677,16 @@ public abstract class DorisStatementVisitor extends DorisStatementBaseVisitor<AS
@Override
public ASTNode visitSelect(final SelectContext ctx) {
- MySQLSelectStatement result;
+ SelectStatement result;
if (null != ctx.queryExpression()) {
- result = (MySQLSelectStatement) visit(ctx.queryExpression());
+ result = (SelectStatement) visit(ctx.queryExpression());
if (null != ctx.lockClauseList()) {
result.setLock((LockSegment) visit(ctx.lockClauseList()));
}
} else if (null != ctx.selectWithInto()) {
- result = (MySQLSelectStatement) visit(ctx.selectWithInto());
+ result = (SelectStatement) visit(ctx.selectWithInto());
} else {
- result = (MySQLSelectStatement) visit(ctx.getChild(0));
+ result = (SelectStatement) visit(ctx.getChild(0));
}
result.addParameterMarkerSegments(getParameterMarkerSegments());
return result;
@@ -1903,7 +1902,7 @@ public abstract class DorisStatementVisitor extends DorisStatementBaseVisitor<AS
@Override
public ASTNode visitTableFactor(final TableFactorContext ctx) {
if (null != ctx.subquery()) {
- MySQLSelectStatement subquery = (MySQLSelectStatement) visit(ctx.subquery());
+ SelectStatement subquery = (SelectStatement) visit(ctx.subquery());
SubquerySegment subquerySegment = new SubquerySegment(ctx.subquery().start.getStartIndex(), ctx.subquery().stop.getStopIndex(), subquery, getOriginalText(ctx.subquery()));
SubqueryTableSegment result = new SubqueryTableSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), subquerySegment);
if (null != ctx.alias()) {
diff --git a/parser/sql/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/doris/visitor/statement/type/DorisDALStatementVisitor.java b/parser/sql/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/doris/visitor/statement/type/DorisDALStatementVisitor.java
index b3be01af042..65b50750376 100644
--- a/parser/sql/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/doris/visitor/statement/type/DorisDALStatementVisitor.java
+++ b/parser/sql/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/doris/visitor/statement/type/DorisDALStatementVisitor.java
@@ -149,6 +149,7 @@ import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.CreateL
import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.CreateResourceGroupStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.DelimiterStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.DropResourceGroupStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.ExplainStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.FlushStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.HelpStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.InstallComponentStatement;
@@ -212,7 +213,6 @@ import org.apache.shardingsphere.sql.parser.statement.core.value.collection.Coll
import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
import org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.NumberLiteralValue;
import org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.StringLiteralValue;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLExplainStatement;
import java.util.Collections;
import java.util.LinkedList;
@@ -488,7 +488,7 @@ public final class DorisDALStatementVisitor extends DorisStatementVisitor implem
@Override
public ASTNode visitExplain(final ExplainContext ctx) {
- MySQLExplainStatement result = new MySQLExplainStatement();
+ ExplainStatement result = new ExplainStatement();
if (null != ctx.tableName()) {
result.setSimpleTable((SimpleTableSegment) visit(ctx.tableName()));
if (null != ctx.columnRef()) {
diff --git a/parser/sql/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/doris/visitor/statement/type/DorisDDLStatementVisitor.java b/parser/sql/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/doris/visitor/statement/type/DorisDDLStatementVisitor.java
index 474f2c4c1c9..7dadc4ae213 100644
--- a/parser/sql/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/doris/visitor/statement/type/DorisDDLStatementVisitor.java
+++ b/parser/sql/dialect/doris/src/main/java/org/apache/shardingsphere/sql/parser/doris/visitor/statement/type/DorisDDLStatementVisitor.java
@@ -153,46 +153,45 @@ import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterEv
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterFunctionStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterProcedureStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterServerStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterTableStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterTablespaceStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterViewStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateDatabaseStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateFunctionStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateIndexStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateMaterializedViewStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateProcedureStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateTableStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateTablespaceStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateTriggerStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateViewStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DeallocateStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropDatabaseStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropFunctionStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropIndexStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropProcedureStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropServerStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropTableStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropTablespaceStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropTriggerStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropViewStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.ExecuteStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.PrepareStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.RenameTableStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.TruncateStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.DeleteStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.InsertStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.UpdateStatement;
import org.apache.shardingsphere.sql.parser.statement.core.value.collection.CollectionValue;
import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLAlterInstanceStatement;
import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLAlterLogfileGroupStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLAlterTableStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLAlterViewStatement;
import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateEventStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateFunctionStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateIndexStatement;
import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateLogfileGroupStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateProcedureStatement;
import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateServerStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateTableStatement;
import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLDropEventStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLDropIndexStatement;
import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLDropLogfileGroupStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLDropTableStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLDropViewStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLDeleteStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLInsertStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLSelectStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLUpdateStatement;
import java.util.Collection;
import java.util.Collections;
@@ -211,23 +210,23 @@ public final class DorisDDLStatementVisitor extends DorisStatementVisitor implem
result.setReplaceView(null != ctx.REPLACE());
result.setView((SimpleTableSegment) visit(ctx.viewName()));
result.setViewDefinition(getOriginalText(ctx.select()));
- result.setSelect((MySQLSelectStatement) visit(ctx.select()));
+ result.setSelect((SelectStatement) visit(ctx.select()));
return result;
}
@Override
public ASTNode visitAlterView(final AlterViewContext ctx) {
- MySQLAlterViewStatement result = new MySQLAlterViewStatement();
+ AlterViewStatement result = new AlterViewStatement();
result.setView((SimpleTableSegment) visit(ctx.viewName()));
result.setViewDefinition(getOriginalText(ctx.select()));
- result.setSelect((MySQLSelectStatement) visit(ctx.select()));
+ result.setSelect((SelectStatement) visit(ctx.select()));
return result;
}
@SuppressWarnings("unchecked")
@Override
public ASTNode visitDropView(final DropViewContext ctx) {
- MySQLDropViewStatement result = new MySQLDropViewStatement();
+ DropViewStatement result = new DropViewStatement();
result.setIfExists(null != ctx.ifExists());
result.getViews().addAll(((CollectionValue<SimpleTableSegment>) visit(ctx.viewNames())).getValue());
return result;
@@ -251,7 +250,7 @@ public final class DorisDDLStatementVisitor extends DorisStatementVisitor implem
@SuppressWarnings("unchecked")
@Override
public ASTNode visitCreateTable(final CreateTableContext ctx) {
- MySQLCreateTableStatement result = new MySQLCreateTableStatement();
+ CreateTableStatement result = new CreateTableStatement();
result.setTable((SimpleTableSegment) visit(ctx.tableName()));
result.setIfNotExists(null != ctx.ifNotExists());
if (null != ctx.createDefinitionClause()) {
@@ -313,7 +312,7 @@ public final class DorisDDLStatementVisitor extends DorisStatementVisitor implem
@SuppressWarnings("unchecked")
@Override
public ASTNode visitAlterTable(final AlterTableContext ctx) {
- MySQLAlterTableStatement result = new MySQLAlterTableStatement();
+ AlterTableStatement result = new AlterTableStatement();
result.setTable((SimpleTableSegment) visit(ctx.tableName()));
if (null == ctx.alterTableActions() || null == ctx.alterTableActions().alterCommandList() || null == ctx.alterTableActions().alterCommandList().alterList()) {
return result;
@@ -324,7 +323,7 @@ public final class DorisDDLStatementVisitor extends DorisStatementVisitor implem
return result;
}
- private void setAlterDefinition(final MySQLAlterTableStatement alterTableStatement, final AlterDefinitionSegment alterDefinitionSegment) {
+ private void setAlterDefinition(final AlterTableStatement alterTableStatement, final AlterDefinitionSegment alterDefinitionSegment) {
if (alterDefinitionSegment instanceof AddColumnDefinitionSegment) {
alterTableStatement.getAddColumnDefinitions().add((AddColumnDefinitionSegment) alterDefinitionSegment);
} else if (alterDefinitionSegment instanceof ModifyColumnDefinitionSegment) {
@@ -662,7 +661,7 @@ public final class DorisDDLStatementVisitor extends DorisStatementVisitor implem
@SuppressWarnings("unchecked")
@Override
public ASTNode visitDropTable(final DropTableContext ctx) {
- MySQLDropTableStatement result = new MySQLDropTableStatement();
+ DropTableStatement result = new DropTableStatement();
result.setIfExists(null != ctx.ifExists());
result.getTables().addAll(((CollectionValue<SimpleTableSegment>) visit(ctx.tableList())).getValue());
return result;
@@ -678,7 +677,7 @@ public final class DorisDDLStatementVisitor extends DorisStatementVisitor implem
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public ASTNode visitCreateIndex(final CreateIndexContext ctx) {
- MySQLCreateIndexStatement result = new MySQLCreateIndexStatement();
+ CreateIndexStatement result = new CreateIndexStatement();
result.setTable((SimpleTableSegment) visit(ctx.tableName()));
IndexNameSegment indexName = new IndexNameSegment(ctx.indexName().start.getStartIndex(), ctx.indexName().stop.getStopIndex(), new IdentifierValue(ctx.indexName().getText()));
result.setIndex(new IndexSegment(ctx.indexName().start.getStartIndex(), ctx.indexName().stop.getStopIndex(), indexName));
@@ -696,7 +695,7 @@ public final class DorisDDLStatementVisitor extends DorisStatementVisitor implem
@Override
public ASTNode visitDropIndex(final DropIndexContext ctx) {
- MySQLDropIndexStatement result = new MySQLDropIndexStatement();
+ DropIndexStatement result = new DropIndexStatement();
result.setSimpleTable((SimpleTableSegment) visit(ctx.tableName()));
IndexNameSegment indexName = new IndexNameSegment(ctx.indexName().start.getStartIndex(), ctx.indexName().stop.getStopIndex(), new IdentifierValue(ctx.indexName().getText()));
result.getIndexes().add(new IndexSegment(ctx.indexName().start.getStartIndex(), ctx.indexName().stop.getStopIndex(), indexName));
@@ -732,7 +731,7 @@ public final class DorisDDLStatementVisitor extends DorisStatementVisitor implem
@Override
public ASTNode visitCreateProcedure(final CreateProcedureContext ctx) {
- MySQLCreateProcedureStatement result = new MySQLCreateProcedureStatement();
+ CreateProcedureStatement result = new CreateProcedureStatement();
result.setProcedureName((FunctionNameSegment) visit(ctx.functionName()));
result.setRoutineBody((RoutineBodySegment) visit(ctx.routineBody()));
return result;
@@ -759,7 +758,7 @@ public final class DorisDDLStatementVisitor extends DorisStatementVisitor implem
@Override
public ASTNode visitCreateFunction(final CreateFunctionContext ctx) {
- MySQLCreateFunctionStatement result = new MySQLCreateFunctionStatement();
+ CreateFunctionStatement result = new CreateFunctionStatement();
result.setFunctionName((FunctionNameSegment) visit(ctx.functionName()));
result.setRoutineBody((RoutineBodySegment) visit(ctx.routineBody()));
return result;
@@ -817,23 +816,23 @@ public final class DorisDDLStatementVisitor extends DorisStatementVisitor implem
ValidStatementSegment result = new ValidStatementSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex());
SQLStatement sqlStatement = null;
if (null != ctx.createTable()) {
- sqlStatement = (MySQLCreateTableStatement) visit(ctx.createTable());
+ sqlStatement = (CreateTableStatement) visit(ctx.createTable());
} else if (null != ctx.alterTable()) {
- sqlStatement = (MySQLAlterTableStatement) visit(ctx.alterTable());
+ sqlStatement = (AlterTableStatement) visit(ctx.alterTable());
} else if (null != ctx.dropTable()) {
- sqlStatement = (MySQLDropTableStatement) visit(ctx.dropTable());
+ sqlStatement = (DropTableStatement) visit(ctx.dropTable());
} else if (null != ctx.truncateTable()) {
sqlStatement = (TruncateStatement) visit(ctx.truncateTable());
} else if (null != ctx.insert()) {
- sqlStatement = (MySQLInsertStatement) visit(ctx.insert());
+ sqlStatement = (InsertStatement) visit(ctx.insert());
} else if (null != ctx.replace()) {
- sqlStatement = (MySQLInsertStatement) visit(ctx.replace());
+ sqlStatement = (InsertStatement) visit(ctx.replace());
} else if (null != ctx.update()) {
- sqlStatement = (MySQLUpdateStatement) visit(ctx.update());
+ sqlStatement = (UpdateStatement) visit(ctx.update());
} else if (null != ctx.delete()) {
- sqlStatement = (MySQLDeleteStatement) visit(ctx.delete());
+ sqlStatement = (DeleteStatement) visit(ctx.delete());
} else if (null != ctx.select()) {
- sqlStatement = (MySQLSelectStatement) visit(ctx.select());
+ sqlStatement = (SelectStatement) visit(ctx.select());
}
result.setSqlStatement(sqlStatement);
return result;
diff --git a/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/MySQLStatementVisitor.java b/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/MySQLStatementVisitor.java
index 657a23fba9c..6e878672c62 100644
--- a/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/MySQLStatementVisitor.java
+++ b/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/MySQLStatementVisitor.java
@@ -232,7 +232,10 @@ import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table
import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SubqueryTableSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableNameSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableSegment;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.DeleteStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.InsertStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.UpdateStatement;
import org.apache.shardingsphere.sql.parser.statement.core.util.SQLUtils;
import org.apache.shardingsphere.sql.parser.statement.core.value.collection.CollectionValue;
import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
@@ -242,10 +245,6 @@ import org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.Nu
import org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.OtherLiteralValue;
import org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.StringLiteralValue;
import org.apache.shardingsphere.sql.parser.statement.core.value.parametermarker.ParameterMarkerValue;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLDeleteStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLInsertStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLSelectStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLUpdateStatement;
import java.math.BigDecimal;
import java.util.ArrayList;
@@ -697,7 +696,7 @@ public abstract class MySQLStatementVisitor extends MySQLStatementBaseVisitor<AS
if (null != ctx.queryExpressionParens()) {
return visit(ctx.queryExpressionParens());
}
- MySQLSelectStatement result = (MySQLSelectStatement) visit(ctx.queryExpression());
+ SelectStatement result = (SelectStatement) visit(ctx.queryExpression());
if (null != ctx.lockClauseList()) {
result.setLock((LockSegment) visit(ctx.lockClauseList()));
}
@@ -718,11 +717,11 @@ public abstract class MySQLStatementVisitor extends MySQLStatementBaseVisitor<AS
@Override
public ASTNode visitQueryExpression(final QueryExpressionContext ctx) {
- MySQLSelectStatement result;
+ SelectStatement result;
if (null != ctx.queryExpressionBody()) {
- result = (MySQLSelectStatement) visit(ctx.queryExpressionBody());
+ result = (SelectStatement) visit(ctx.queryExpressionBody());
} else {
- result = (MySQLSelectStatement) visit(ctx.queryExpressionParens());
+ result = (SelectStatement) visit(ctx.queryExpressionParens());
}
if (null != ctx.orderByClause()) {
result.setOrderBy((OrderBySegment) visit(ctx.orderByClause()));
@@ -741,7 +740,7 @@ public abstract class MySQLStatementVisitor extends MySQLStatementBaseVisitor<AS
if (null != ctx.selectWithInto()) {
return visit(ctx.selectWithInto());
}
- MySQLSelectStatement result = (MySQLSelectStatement) visit(ctx.queryExpression());
+ SelectStatement result = (SelectStatement) visit(ctx.queryExpression());
if (null != ctx.lockClauseList()) {
result.setLock((LockSegment) visit(ctx.lockClauseList()));
}
@@ -775,9 +774,9 @@ public abstract class MySQLStatementVisitor extends MySQLStatementBaseVisitor<AS
return visit(ctx.queryPrimary());
}
if (null != ctx.queryExpressionBody() && ctx.queryExpressionBody().size() > 1) {
- MySQLSelectStatement result = new MySQLSelectStatement();
+ SelectStatement result = new SelectStatement();
SubquerySegment left = new SubquerySegment(ctx.queryExpressionBody(0).start.getStartIndex(), ctx.queryExpressionBody(0).stop.getStopIndex(),
- (MySQLSelectStatement) visit(ctx.queryExpressionBody(0)), getOriginalText(ctx.queryExpressionBody(0)));
+ (SelectStatement) visit(ctx.queryExpressionBody(0)), getOriginalText(ctx.queryExpressionBody(0)));
result.setProjections(left.getSelect().getProjections());
left.getSelect().getFrom().ifPresent(result::setFrom);
result.setCombine(createCombineSegment(ctx, left));
@@ -796,13 +795,13 @@ public abstract class MySQLStatementVisitor extends MySQLStatementBaseVisitor<AS
combineType = null == ctx.combineOption() || null == ctx.combineOption().ALL() ? CombineType.UNION : CombineType.UNION_ALL;
}
ParserRuleContext ruleContext = ctx.queryExpressionBody(1);
- SubquerySegment right = new SubquerySegment(ruleContext.start.getStartIndex(), ruleContext.stop.getStopIndex(), (MySQLSelectStatement) visit(ruleContext), getOriginalText(ruleContext));
+ SubquerySegment right = new SubquerySegment(ruleContext.start.getStartIndex(), ruleContext.stop.getStopIndex(), (SelectStatement) visit(ruleContext), getOriginalText(ruleContext));
return new CombineSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), left, combineType, right);
}
@Override
public ASTNode visitQuerySpecification(final QuerySpecificationContext ctx) {
- MySQLSelectStatement result = new MySQLSelectStatement();
+ SelectStatement result = new SelectStatement();
result.setProjections((ProjectionsSegment) visit(ctx.projections()));
if (null != ctx.selectSpecification()) {
result.getProjections().setDistinctRow(isDistinct(ctx));
@@ -838,7 +837,7 @@ public abstract class MySQLStatementVisitor extends MySQLStatementBaseVisitor<AS
@Override
public ASTNode visitTableValueConstructor(final TableValueConstructorContext ctx) {
- MySQLSelectStatement result = new MySQLSelectStatement();
+ SelectStatement result = new SelectStatement();
int startIndex = ctx.getStart().getStartIndex();
int stopIndex = ctx.getStop().getStopIndex();
ValuesExpression valuesExpression = new ValuesExpression(startIndex, stopIndex);
@@ -858,7 +857,7 @@ public abstract class MySQLStatementVisitor extends MySQLStatementBaseVisitor<AS
@Override
public ASTNode visitTableStatement(final TableStatementContext ctx) {
- MySQLSelectStatement result = new MySQLSelectStatement();
+ SelectStatement result = new SelectStatement();
result.setProjections(new ProjectionsSegment(ctx.start.getStartIndex(), ctx.start.getStartIndex()));
result.getProjections().getProjections().add(new ShorthandProjectionSegment(ctx.start.getStartIndex(), ctx.start.getStartIndex()));
result.setFrom(new SimpleTableSegment(new TableNameSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), new IdentifierValue(ctx.tableName().getText()))));
@@ -1444,13 +1443,13 @@ public abstract class MySQLStatementVisitor extends MySQLStatementBaseVisitor<AS
@Override
public ASTNode visitInsert(final InsertContext ctx) {
// TODO :FIXME, since there is no segment for insertValuesClause, InsertStatement is created by sub rule.
- MySQLInsertStatement result;
+ InsertStatement result;
if (null != ctx.insertValuesClause()) {
- result = (MySQLInsertStatement) visit(ctx.insertValuesClause());
+ result = (InsertStatement) visit(ctx.insertValuesClause());
} else if (null != ctx.insertSelectClause()) {
- result = (MySQLInsertStatement) visit(ctx.insertSelectClause());
+ result = (InsertStatement) visit(ctx.insertSelectClause());
} else {
- result = new MySQLInsertStatement();
+ result = new InsertStatement();
result.setSetAssignment((SetAssignmentSegment) visit(ctx.setAssignmentsClause()));
}
if (null != ctx.onDuplicateKeyClause()) {
@@ -1466,7 +1465,7 @@ public abstract class MySQLStatementVisitor extends MySQLStatementBaseVisitor<AS
@Override
public ASTNode visitInsertSelectClause(final InsertSelectClauseContext ctx) {
- MySQLInsertStatement result = new MySQLInsertStatement();
+ InsertStatement result = new InsertStatement();
result.setInsertSelect(createInsertSelectSegment(ctx));
if (null != ctx.LP_() && !ctx.LP_().isEmpty()) {
if (null != ctx.fields()) {
@@ -1481,14 +1480,14 @@ public abstract class MySQLStatementVisitor extends MySQLStatementBaseVisitor<AS
}
private SubquerySegment createInsertSelectSegment(final InsertSelectClauseContext ctx) {
- MySQLSelectStatement selectStatement = (MySQLSelectStatement) visit(ctx.select());
+ SelectStatement selectStatement = (SelectStatement) visit(ctx.select());
selectStatement.getParameterMarkerSegments().addAll(getParameterMarkerSegments());
return new SubquerySegment(ctx.select().start.getStartIndex(), ctx.select().stop.getStopIndex(), selectStatement, getOriginalText(ctx.select()));
}
@Override
public ASTNode visitInsertValuesClause(final InsertValuesClauseContext ctx) {
- MySQLInsertStatement result = new MySQLInsertStatement();
+ InsertStatement result = new InsertStatement();
if (null != ctx.LP_()) {
if (null != ctx.fields()) {
result.setInsertColumns(new InsertColumnsSegment(ctx.LP_().getSymbol().getStartIndex(), ctx.RP_().getSymbol().getStopIndex(), createInsertColumns(ctx.fields())));
@@ -1522,13 +1521,13 @@ public abstract class MySQLStatementVisitor extends MySQLStatementBaseVisitor<AS
@Override
public ASTNode visitReplace(final ReplaceContext ctx) {
// TODO :FIXME, since there is no segment for replaceValuesClause, ReplaceStatement is created by sub rule.
- MySQLInsertStatement result;
+ InsertStatement result;
if (null != ctx.replaceValuesClause()) {
- result = (MySQLInsertStatement) visit(ctx.replaceValuesClause());
+ result = (InsertStatement) visit(ctx.replaceValuesClause());
} else if (null != ctx.replaceSelectClause()) {
- result = (MySQLInsertStatement) visit(ctx.replaceSelectClause());
+ result = (InsertStatement) visit(ctx.replaceSelectClause());
} else {
- result = new MySQLInsertStatement();
+ result = new InsertStatement();
result.setSetAssignment((SetAssignmentSegment) visit(ctx.setAssignmentsClause()));
}
result.setTable((SimpleTableSegment) visit(ctx.tableName()));
@@ -1541,7 +1540,7 @@ public abstract class MySQLStatementVisitor extends MySQLStatementBaseVisitor<AS
@Override
public ASTNode visitReplaceSelectClause(final ReplaceSelectClauseContext ctx) {
- MySQLInsertStatement result = new MySQLInsertStatement();
+ InsertStatement result = new InsertStatement();
if (null != ctx.LP_()) {
if (null != ctx.fields()) {
result.setInsertColumns(new InsertColumnsSegment(ctx.LP_().getSymbol().getStartIndex(), ctx.RP_().getSymbol().getStopIndex(), createInsertColumns(ctx.fields())));
@@ -1556,13 +1555,13 @@ public abstract class MySQLStatementVisitor extends MySQLStatementBaseVisitor<AS
}
private SubquerySegment createReplaceSelectSegment(final ReplaceSelectClauseContext ctx) {
- MySQLSelectStatement selectStatement = (MySQLSelectStatement) visit(ctx.select());
+ SelectStatement selectStatement = (SelectStatement) visit(ctx.select());
return new SubquerySegment(ctx.select().start.getStartIndex(), ctx.select().stop.getStopIndex(), selectStatement, getOriginalText(ctx.select()));
}
@Override
public ASTNode visitReplaceValuesClause(final ReplaceValuesClauseContext ctx) {
- MySQLInsertStatement result = new MySQLInsertStatement();
+ InsertStatement result = new InsertStatement();
if (null != ctx.LP_()) {
if (null != ctx.fields()) {
result.setInsertColumns(new InsertColumnsSegment(ctx.LP_().getSymbol().getStartIndex(), ctx.RP_().getSymbol().getStopIndex(), createInsertColumns(ctx.fields())));
@@ -1586,7 +1585,7 @@ public abstract class MySQLStatementVisitor extends MySQLStatementBaseVisitor<AS
@Override
public ASTNode visitUpdate(final UpdateContext ctx) {
- MySQLUpdateStatement result = new MySQLUpdateStatement();
+ UpdateStatement result = new UpdateStatement();
TableSegment tableSegment = (TableSegment) visit(ctx.tableReferences());
result.setTable(tableSegment);
result.setSetAssignment((SetAssignmentSegment) visit(ctx.setAssignmentsClause()));
@@ -1649,7 +1648,7 @@ public abstract class MySQLStatementVisitor extends MySQLStatementBaseVisitor<AS
@Override
public ASTNode visitDelete(final DeleteContext ctx) {
- MySQLDeleteStatement result = new MySQLDeleteStatement();
+ DeleteStatement result = new DeleteStatement();
if (null != ctx.multipleTablesClause()) {
result.setTable((TableSegment) visit(ctx.multipleTablesClause()));
} else {
@@ -1702,16 +1701,16 @@ public abstract class MySQLStatementVisitor extends MySQLStatementBaseVisitor<AS
@Override
public ASTNode visitSelect(final SelectContext ctx) {
- MySQLSelectStatement result;
+ SelectStatement result;
if (null != ctx.queryExpression()) {
- result = (MySQLSelectStatement) visit(ctx.queryExpression());
+ result = (SelectStatement) visit(ctx.queryExpression());
if (null != ctx.lockClauseList()) {
result.setLock((LockSegment) visit(ctx.lockClauseList()));
}
} else if (null != ctx.selectWithInto()) {
- result = (MySQLSelectStatement) visit(ctx.selectWithInto());
+ result = (SelectStatement) visit(ctx.selectWithInto());
} else {
- result = (MySQLSelectStatement) visit(ctx.getChild(0));
+ result = (SelectStatement) visit(ctx.getChild(0));
}
result.addParameterMarkerSegments(getParameterMarkerSegments());
return result;
@@ -1913,7 +1912,7 @@ public abstract class MySQLStatementVisitor extends MySQLStatementBaseVisitor<AS
@Override
public ASTNode visitTableFactor(final TableFactorContext ctx) {
if (null != ctx.subquery()) {
- MySQLSelectStatement subquery = (MySQLSelectStatement) visit(ctx.subquery());
+ SelectStatement subquery = (SelectStatement) visit(ctx.subquery());
SubquerySegment subquerySegment = new SubquerySegment(ctx.subquery().start.getStartIndex(), ctx.subquery().stop.getStopIndex(), subquery, getOriginalText(ctx.subquery()));
SubqueryTableSegment result = new SubqueryTableSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex(), subquerySegment);
if (null != ctx.alias()) {
diff --git a/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/type/MySQLDALStatementVisitor.java b/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/type/MySQLDALStatementVisitor.java
index b3dbe3234c6..b9633d7e775 100644
--- a/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/type/MySQLDALStatementVisitor.java
+++ b/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/type/MySQLDALStatementVisitor.java
@@ -149,6 +149,7 @@ import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.CreateL
import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.CreateResourceGroupStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.DelimiterStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.DropResourceGroupStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.ExplainStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.FlushStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.HelpStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.InstallComponentStatement;
@@ -212,7 +213,6 @@ import org.apache.shardingsphere.sql.parser.statement.core.value.collection.Coll
import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
import org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.NumberLiteralValue;
import org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.StringLiteralValue;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLExplainStatement;
import java.util.Collections;
import java.util.LinkedList;
@@ -501,7 +501,7 @@ public final class MySQLDALStatementVisitor extends MySQLStatementVisitor implem
@Override
public ASTNode visitExplain(final ExplainContext ctx) {
- MySQLExplainStatement result = new MySQLExplainStatement();
+ ExplainStatement result = new ExplainStatement();
if (null != ctx.tableName()) {
result.setSimpleTable((SimpleTableSegment) visit(ctx.tableName()));
if (null != ctx.columnRef()) {
diff --git a/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/type/MySQLDDLStatementVisitor.java b/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/type/MySQLDDLStatementVisitor.java
index e89fc0313c9..e22af3c9431 100644
--- a/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/type/MySQLDDLStatementVisitor.java
+++ b/parser/sql/dialect/mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/type/MySQLDDLStatementVisitor.java
@@ -152,46 +152,46 @@ import org.apache.shardingsphere.sql.parser.statement.core.statement.SQLStatemen
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterDatabaseStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterEventStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterFunctionStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLAlterInstanceStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLAlterLogfileGroupStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterProcedureStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterServerStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterTableStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterTablespaceStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterViewStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateDatabaseStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateEventStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateLogfileGroupStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateServerStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateFunctionStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateIndexStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateProcedureStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateTableStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateTablespaceStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateTriggerStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateViewStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DeallocateStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropDatabaseStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLDropEventStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropFunctionStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLDropLogfileGroupStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropIndexStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropProcedureStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropServerStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropTableStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropTablespaceStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropTriggerStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropViewStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.ExecuteStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.PrepareStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.RenameTableStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.TruncateStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.DeleteStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.InsertStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.UpdateStatement;
import org.apache.shardingsphere.sql.parser.statement.core.value.collection.CollectionValue;
import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLAlterTableStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLAlterViewStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateFunctionStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateIndexStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateProcedureStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateTableStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLDropIndexStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLDropTableStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLDropViewStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLDeleteStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLInsertStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLSelectStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLUpdateStatement;
+import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLAlterInstanceStatement;
+import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLAlterLogfileGroupStatement;
+import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateEventStatement;
+import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateLogfileGroupStatement;
+import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateServerStatement;
+import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLDropEventStatement;
+import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLDropLogfileGroupStatement;
import java.util.Collection;
import java.util.Collections;
@@ -210,23 +210,23 @@ public final class MySQLDDLStatementVisitor extends MySQLStatementVisitor implem
result.setReplaceView(null != ctx.REPLACE());
result.setView((SimpleTableSegment) visit(ctx.viewName()));
result.setViewDefinition(getOriginalText(ctx.select()));
- result.setSelect((MySQLSelectStatement) visit(ctx.select()));
+ result.setSelect((SelectStatement) visit(ctx.select()));
return result;
}
@Override
public ASTNode visitAlterView(final AlterViewContext ctx) {
- MySQLAlterViewStatement result = new MySQLAlterViewStatement();
+ AlterViewStatement result = new AlterViewStatement();
result.setView((SimpleTableSegment) visit(ctx.viewName()));
result.setViewDefinition(getOriginalText(ctx.select()));
- result.setSelect((MySQLSelectStatement) visit(ctx.select()));
+ result.setSelect((SelectStatement) visit(ctx.select()));
return result;
}
@SuppressWarnings("unchecked")
@Override
public ASTNode visitDropView(final DropViewContext ctx) {
- MySQLDropViewStatement result = new MySQLDropViewStatement();
+ DropViewStatement result = new DropViewStatement();
result.setIfExists(null != ctx.ifExists());
result.getViews().addAll(((CollectionValue<SimpleTableSegment>) visit(ctx.viewNames())).getValue());
return result;
@@ -250,7 +250,7 @@ public final class MySQLDDLStatementVisitor extends MySQLStatementVisitor implem
@SuppressWarnings("unchecked")
@Override
public ASTNode visitCreateTable(final CreateTableContext ctx) {
- MySQLCreateTableStatement result = new MySQLCreateTableStatement();
+ CreateTableStatement result = new CreateTableStatement();
result.setTable((SimpleTableSegment) visit(ctx.tableName()));
result.setIfNotExists(null != ctx.ifNotExists());
if (null != ctx.createDefinitionClause()) {
@@ -313,7 +313,7 @@ public final class MySQLDDLStatementVisitor extends MySQLStatementVisitor implem
@SuppressWarnings("unchecked")
@Override
public ASTNode visitAlterTable(final AlterTableContext ctx) {
- MySQLAlterTableStatement result = new MySQLAlterTableStatement();
+ AlterTableStatement result = new AlterTableStatement();
result.setTable((SimpleTableSegment) visit(ctx.tableName()));
if (null == ctx.alterTableActions() || null == ctx.alterTableActions().alterCommandList() || null == ctx.alterTableActions().alterCommandList().alterList()) {
return result;
@@ -324,7 +324,7 @@ public final class MySQLDDLStatementVisitor extends MySQLStatementVisitor implem
return result;
}
- private void setAlterDefinition(final MySQLAlterTableStatement alterTableStatement, final AlterDefinitionSegment alterDefinitionSegment) {
+ private void setAlterDefinition(final AlterTableStatement alterTableStatement, final AlterDefinitionSegment alterDefinitionSegment) {
if (alterDefinitionSegment instanceof AddColumnDefinitionSegment) {
alterTableStatement.getAddColumnDefinitions().add((AddColumnDefinitionSegment) alterDefinitionSegment);
} else if (alterDefinitionSegment instanceof ModifyColumnDefinitionSegment) {
@@ -667,7 +667,7 @@ public final class MySQLDDLStatementVisitor extends MySQLStatementVisitor implem
@SuppressWarnings("unchecked")
@Override
public ASTNode visitDropTable(final DropTableContext ctx) {
- MySQLDropTableStatement result = new MySQLDropTableStatement();
+ DropTableStatement result = new DropTableStatement();
result.setIfExists(null != ctx.ifExists());
result.getTables().addAll(((CollectionValue<SimpleTableSegment>) visit(ctx.tableList())).getValue());
return result;
@@ -683,7 +683,7 @@ public final class MySQLDDLStatementVisitor extends MySQLStatementVisitor implem
@SuppressWarnings({"unchecked", "rawtypes"})
@Override
public ASTNode visitCreateIndex(final CreateIndexContext ctx) {
- MySQLCreateIndexStatement result = new MySQLCreateIndexStatement();
+ CreateIndexStatement result = new CreateIndexStatement();
result.setTable((SimpleTableSegment) visit(ctx.tableName()));
IndexNameSegment indexName = new IndexNameSegment(ctx.indexName().start.getStartIndex(), ctx.indexName().stop.getStopIndex(), new IdentifierValue(ctx.indexName().getText()));
result.setIndex(new IndexSegment(ctx.indexName().start.getStartIndex(), ctx.indexName().stop.getStopIndex(), indexName));
@@ -701,7 +701,7 @@ public final class MySQLDDLStatementVisitor extends MySQLStatementVisitor implem
@Override
public ASTNode visitDropIndex(final DropIndexContext ctx) {
- MySQLDropIndexStatement result = new MySQLDropIndexStatement();
+ DropIndexStatement result = new DropIndexStatement();
result.setSimpleTable((SimpleTableSegment) visit(ctx.tableName()));
IndexNameSegment indexName = new IndexNameSegment(ctx.indexName().start.getStartIndex(), ctx.indexName().stop.getStopIndex(), new IdentifierValue(ctx.indexName().getText()));
result.getIndexes().add(new IndexSegment(ctx.indexName().start.getStartIndex(), ctx.indexName().stop.getStopIndex(), indexName));
@@ -737,7 +737,7 @@ public final class MySQLDDLStatementVisitor extends MySQLStatementVisitor implem
@Override
public ASTNode visitCreateProcedure(final CreateProcedureContext ctx) {
- MySQLCreateProcedureStatement result = new MySQLCreateProcedureStatement();
+ CreateProcedureStatement result = new CreateProcedureStatement();
result.setProcedureName((FunctionNameSegment) visit(ctx.functionName()));
result.setRoutineBody((RoutineBodySegment) visit(ctx.routineBody()));
return result;
@@ -764,7 +764,7 @@ public final class MySQLDDLStatementVisitor extends MySQLStatementVisitor implem
@Override
public ASTNode visitCreateFunction(final CreateFunctionContext ctx) {
- MySQLCreateFunctionStatement result = new MySQLCreateFunctionStatement();
+ CreateFunctionStatement result = new CreateFunctionStatement();
result.setFunctionName((FunctionNameSegment) visit(ctx.functionName()));
result.setRoutineBody((RoutineBodySegment) visit(ctx.routineBody()));
return result;
@@ -822,23 +822,23 @@ public final class MySQLDDLStatementVisitor extends MySQLStatementVisitor implem
ValidStatementSegment result = new ValidStatementSegment(ctx.start.getStartIndex(), ctx.stop.getStopIndex());
SQLStatement sqlStatement = null;
if (null != ctx.createTable()) {
- sqlStatement = (MySQLCreateTableStatement) visit(ctx.createTable());
+ sqlStatement = (CreateTableStatement) visit(ctx.createTable());
} else if (null != ctx.alterTable()) {
- sqlStatement = (MySQLAlterTableStatement) visit(ctx.alterTable());
+ sqlStatement = (AlterTableStatement) visit(ctx.alterTable());
} else if (null != ctx.dropTable()) {
- sqlStatement = (MySQLDropTableStatement) visit(ctx.dropTable());
+ sqlStatement = (DropTableStatement) visit(ctx.dropTable());
} else if (null != ctx.truncateTable()) {
sqlStatement = (TruncateStatement) visit(ctx.truncateTable());
} else if (null != ctx.insert()) {
- sqlStatement = (MySQLInsertStatement) visit(ctx.insert());
+ sqlStatement = (InsertStatement) visit(ctx.insert());
} else if (null != ctx.replace()) {
- sqlStatement = (MySQLInsertStatement) visit(ctx.replace());
+ sqlStatement = (InsertStatement) visit(ctx.replace());
} else if (null != ctx.update()) {
- sqlStatement = (MySQLUpdateStatement) visit(ctx.update());
+ sqlStatement = (UpdateStatement) visit(ctx.update());
} else if (null != ctx.delete()) {
- sqlStatement = (MySQLDeleteStatement) visit(ctx.delete());
+ sqlStatement = (DeleteStatement) visit(ctx.delete());
} else if (null != ctx.select()) {
- sqlStatement = (MySQLSelectStatement) visit(ctx.select());
+ sqlStatement = (SelectStatement) visit(ctx.select());
}
result.setSqlStatement(sqlStatement);
return result;
diff --git a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dal/ExplainStatement.java b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dal/ExplainStatement.java
index d1b5cefafb3..7a44d3a8552 100644
--- a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dal/ExplainStatement.java
+++ b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/dal/ExplainStatement.java
@@ -35,21 +35,17 @@ public class ExplainStatement extends AbstractSQLStatement implements DALStateme
private SQLStatement sqlStatement;
+ private SimpleTableSegment simpleTable;
+
+ private ColumnSegment columnWild;
+
/**
* Get simple table.
*
* @return simple table
*/
public Optional<SimpleTableSegment> getSimpleTable() {
- return Optional.empty();
- }
-
- /**
- * Set simple table.
- *
- * @param simpleTable simple table
- */
- public void setSimpleTable(final SimpleTableSegment simpleTable) {
+ return Optional.ofNullable(simpleTable);
}
/**
@@ -58,14 +54,6 @@ public class ExplainStatement extends AbstractSQLStatement implements DALStateme
* @return column segment
*/
public Optional<ColumnSegment> getColumnWild() {
- return Optional.empty();
- }
-
- /**
- * Set column wild.
- *
- * @param columnWild column wild
- */
- public void setColumnWild(final ColumnSegment columnWild) {
+ return Optional.ofNullable(columnWild);
}
}
diff --git a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/AlterTableStatement.java b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/AlterTableStatement.java
index e8d142683a5..5104a0e645c 100644
--- a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/AlterTableStatement.java
+++ b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/AlterTableStatement.java
@@ -31,7 +31,9 @@ import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.constrain
import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.constraint.alter.ValidateConstraintDefinitionSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.index.DropIndexDefinitionSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.index.RenameIndexDefinitionSegment;
+import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.table.AlgorithmTypeSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.table.ConvertTableDefinitionSegment;
+import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.table.LockTableSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
import org.apache.shardingsphere.sql.parser.statement.core.statement.AbstractSQLStatement;
@@ -54,6 +56,10 @@ public class AlterTableStatement extends AbstractSQLStatement implements DDLStat
private ModifyCollectionRetrievalSegment modifyCollectionRetrieval;
+ private AlgorithmTypeSegment algorithmSegment;
+
+ private LockTableSegment lockTableSegment;
+
private final Collection<AddColumnDefinitionSegment> addColumnDefinitions = new LinkedList<>();
private final Collection<ModifyColumnDefinitionSegment> modifyColumnDefinitions = new LinkedList<>();
@@ -102,4 +108,22 @@ public class AlterTableStatement extends AbstractSQLStatement implements DDLStat
public Optional<ModifyCollectionRetrievalSegment> getModifyCollectionRetrieval() {
return Optional.ofNullable(modifyCollectionRetrieval);
}
+
+ /**
+ * Get algorithm segment.
+ *
+ * @return algorithm segment
+ */
+ public Optional<AlgorithmTypeSegment> getGetAlgorithmSegment() {
+ return Optional.ofNullable(algorithmSegment);
+ }
+
+ /**
+ * Get lock table Segment.
+ *
+ * @return lock table segment
+ */
+ public Optional<LockTableSegment> getLockTableSegment() {
+ return Optional.ofNullable(lockTableSegment);
+ }
}
diff --git a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/CreateFunctionStatement.java b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/CreateFunctionStatement.java
index 0b08f40e22a..f4686386866 100644
--- a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/CreateFunctionStatement.java
+++ b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/CreateFunctionStatement.java
@@ -37,6 +37,8 @@ public class CreateFunctionStatement extends AbstractSQLStatement implements DDL
private FunctionNameSegment functionName;
+ private RoutineBodySegment routineBody;
+
private final List<ExpressionSegment> dynamicSqlStatementExpressions = new ArrayList<>();
/**
@@ -54,6 +56,6 @@ public class CreateFunctionStatement extends AbstractSQLStatement implements DDL
* @return routine body
*/
public Optional<RoutineBodySegment> getRoutineBody() {
- return Optional.empty();
+ return Optional.ofNullable(routineBody);
}
}
diff --git a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/CreateIndexStatement.java b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/CreateIndexStatement.java
index b76448f34a4..5ae161db4ab 100644
--- a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/CreateIndexStatement.java
+++ b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/CreateIndexStatement.java
@@ -45,6 +45,10 @@ public class CreateIndexStatement extends AbstractSQLStatement implements DDLSta
private Integer generatedIndexStartIndex;
+ private AlgorithmTypeSegment algorithmType;
+
+ private LockTableSegment lockTable;
+
private final Collection<ColumnSegment> columns = new LinkedList<>();
/**
@@ -62,15 +66,7 @@ public class CreateIndexStatement extends AbstractSQLStatement implements DDLSta
* @return algorithm type
*/
public Optional<AlgorithmTypeSegment> getAlgorithmType() {
- return Optional.empty();
- }
-
- /**
- * Set algorithm type.
- *
- * @param algorithmType algorithm type
- */
- public void setAlgorithmType(final AlgorithmTypeSegment algorithmType) {
+ return Optional.ofNullable(algorithmType);
}
/**
@@ -79,14 +75,6 @@ public class CreateIndexStatement extends AbstractSQLStatement implements DDLSta
* @return lock table
*/
public Optional<LockTableSegment> getLockTable() {
- return Optional.empty();
- }
-
- /**
- * Set lock table.
- *
- * @param lockTable lock table
- */
- public void setLockTable(final LockTableSegment lockTable) {
+ return Optional.ofNullable(lockTable);
}
}
diff --git a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/CreateProcedureStatement.java b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/CreateProcedureStatement.java
index 14216d66c30..7499ebd9c62 100644
--- a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/CreateProcedureStatement.java
+++ b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/CreateProcedureStatement.java
@@ -40,6 +40,8 @@ public class CreateProcedureStatement extends AbstractSQLStatement implements DD
private FunctionNameSegment procedureName;
+ private RoutineBodySegment routineBody;
+
private final List<SQLStatementSegment> sqlStatements = new ArrayList<>();
private final List<ProcedureCallNameSegment> procedureCallNames = new ArrayList<>();
@@ -63,6 +65,6 @@ public class CreateProcedureStatement extends AbstractSQLStatement implements DD
* @return routine body
*/
public Optional<RoutineBodySegment> getRoutineBody() {
- return Optional.empty();
+ return Optional.ofNullable(routineBody);
}
}
diff --git a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/DropIndexStatement.java b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/DropIndexStatement.java
index fbc5bbedf95..29025bbaab4 100644
--- a/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/DropIndexStatement.java
+++ b/parser/sql/statement/core/src/main/java/org/apache/shardingsphere/sql/parser/statement/core/statement/ddl/DropIndexStatement.java
@@ -42,6 +42,10 @@ public class DropIndexStatement extends AbstractSQLStatement implements DDLState
private SimpleTableSegment simpleTable;
+ private AlgorithmTypeSegment algorithmType;
+
+ private LockTableSegment lockTable;
+
/**
* Get simple table.
*
@@ -57,15 +61,7 @@ public class DropIndexStatement extends AbstractSQLStatement implements DDLState
* @return algorithm type
*/
public Optional<AlgorithmTypeSegment> getAlgorithmType() {
- return Optional.empty();
- }
-
- /**
- * Set algorithm type.
- *
- * @param algorithmTypeSegment algorithm type
- */
- public void setAlgorithmType(final AlgorithmTypeSegment algorithmTypeSegment) {
+ return Optional.ofNullable(algorithmType);
}
/**
@@ -74,14 +70,6 @@ public class DropIndexStatement extends AbstractSQLStatement implements DDLState
* @return lock table segment
*/
public Optional<LockTableSegment> getLockTable() {
- return Optional.empty();
- }
-
- /**
- * Set lock table segment.
- *
- * @param lockTableSegment lock table segment
- */
- public void setLockTable(final LockTableSegment lockTableSegment) {
+ return Optional.ofNullable(lockTable);
}
}
diff --git a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/MySQLStatement.java b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/MySQLStatement.java
deleted file mode 100644
index 15ddfb444d4..00000000000
--- a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/MySQLStatement.java
+++ /dev/null
@@ -1,26 +0,0 @@
-/*
- * 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.statement.mysql;
-
-import org.apache.shardingsphere.sql.parser.statement.core.statement.SQLStatement;
-
-/**
- * MySQL statement.
- */
-public interface MySQLStatement extends SQLStatement {
-}
diff --git a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dal/MySQLExplainStatement.java b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dal/MySQLExplainStatement.java
deleted file mode 100644
index 8bbce505487..00000000000
--- a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dal/MySQLExplainStatement.java
+++ /dev/null
@@ -1,47 +0,0 @@
-/*
- * 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.statement.mysql.dal;
-
-import lombok.Setter;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.ColumnSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.ExplainStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.MySQLStatement;
-
-import java.util.Optional;
-
-/**
- * MySQL explain statement.
- */
-@Setter
-public final class MySQLExplainStatement extends ExplainStatement implements MySQLStatement {
-
- private SimpleTableSegment simpleTable;
-
- private ColumnSegment columnWild;
-
- @Override
- public Optional<SimpleTableSegment> getSimpleTable() {
- return Optional.ofNullable(simpleTable);
- }
-
- @Override
- public Optional<ColumnSegment> getColumnWild() {
- return Optional.ofNullable(columnWild);
- }
-}
diff --git a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dcl/MySQLCreateUserStatement.java b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dcl/MySQLCreateUserStatement.java
index f5ad29fa98e..9424214514a 100644
--- a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dcl/MySQLCreateUserStatement.java
+++ b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dcl/MySQLCreateUserStatement.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.sql.parser.statement.core.segment.dcl.PasswordO
import org.apache.shardingsphere.sql.parser.statement.core.segment.dcl.TLSOptionSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.dcl.UserResourceSegment;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dcl.CreateUserStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.MySQLStatement;
import java.util.Collection;
import java.util.LinkedList;
@@ -33,7 +32,7 @@ import java.util.LinkedList;
*/
@Getter
@Setter
-public final class MySQLCreateUserStatement extends CreateUserStatement implements MySQLStatement {
+public final class MySQLCreateUserStatement extends CreateUserStatement {
private final Collection<String> defaultRoles = new LinkedList<>();
diff --git a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dcl/MySQLGrantStatement.java b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dcl/MySQLGrantStatement.java
index 0c9fcc00f37..2ceb55d23ec 100644
--- a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dcl/MySQLGrantStatement.java
+++ b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dcl/MySQLGrantStatement.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.sql.parser.statement.core.segment.dcl.RoleOrPri
import org.apache.shardingsphere.sql.parser.statement.core.segment.dcl.UserSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.GrantLevelSegment;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dcl.GrantStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.MySQLStatement;
import java.util.Collection;
import java.util.LinkedList;
@@ -33,7 +32,7 @@ import java.util.LinkedList;
*/
@Getter
@Setter
-public final class MySQLGrantStatement extends GrantStatement implements MySQLStatement {
+public final class MySQLGrantStatement extends GrantStatement {
private final Collection<RoleOrPrivilegeSegment> roleOrPrivileges = new LinkedList<>();
diff --git a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dcl/MySQLRevokeStatement.java b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dcl/MySQLRevokeStatement.java
index 4dedb00d046..ba9abcf9665 100644
--- a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dcl/MySQLRevokeStatement.java
+++ b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dcl/MySQLRevokeStatement.java
@@ -23,7 +23,6 @@ import org.apache.shardingsphere.sql.parser.statement.core.segment.dcl.RoleOrPri
import org.apache.shardingsphere.sql.parser.statement.core.segment.dcl.UserSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.GrantLevelSegment;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dcl.RevokeStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.MySQLStatement;
import java.util.Collection;
import java.util.LinkedList;
@@ -33,7 +32,7 @@ import java.util.LinkedList;
*/
@Getter
@Setter
-public final class MySQLRevokeStatement extends RevokeStatement implements MySQLStatement {
+public final class MySQLRevokeStatement extends RevokeStatement {
private final Collection<RoleOrPrivilegeSegment> roleOrPrivileges = new LinkedList<>();
diff --git a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLAlterTableStatement.java b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLAlterTableStatement.java
deleted file mode 100644
index 35200468189..00000000000
--- a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLAlterTableStatement.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.statement.mysql.ddl;
-
-import lombok.Setter;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.table.AlgorithmTypeSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.table.LockTableSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterTableStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.MySQLStatement;
-
-import java.util.Optional;
-
-/**
- * MySQL alter table statement.
- */
-@Setter
-public final class MySQLAlterTableStatement extends AlterTableStatement implements MySQLStatement {
-
- private AlgorithmTypeSegment algorithmSegment;
-
- private LockTableSegment lockTableSegment;
-
- /**
- * Get algorithm segment.
- *
- * @return algorithm segment
- */
- public Optional<AlgorithmTypeSegment> getGetAlgorithmSegment() {
- return Optional.ofNullable(algorithmSegment);
- }
-
- /**
- * Get lock table Segment.
- *
- * @return lock table segment
- */
- public Optional<LockTableSegment> getLockTableSegment() {
- return Optional.ofNullable(lockTableSegment);
- }
-}
diff --git a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLAlterViewStatement.java b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLAlterViewStatement.java
deleted file mode 100644
index e7382e3dade..00000000000
--- a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLAlterViewStatement.java
+++ /dev/null
@@ -1,46 +0,0 @@
-/*
- * 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.statement.mysql.ddl;
-
-import lombok.Setter;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterViewStatement;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.MySQLStatement;
-
-import java.util.Optional;
-
-/**
- * MySQL alter view statement.
- */
-@Setter
-public final class MySQLAlterViewStatement extends AlterViewStatement implements MySQLStatement {
-
- private SelectStatement select;
-
- private String viewDefinition;
-
- @Override
- public Optional<SelectStatement> getSelect() {
- return Optional.ofNullable(select);
- }
-
- @Override
- public Optional<String> getViewDefinition() {
- return Optional.ofNullable(viewDefinition);
- }
-}
diff --git a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLCreateFunctionStatement.java b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLCreateFunctionStatement.java
deleted file mode 100644
index 44d04b95e91..00000000000
--- a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLCreateFunctionStatement.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.statement.mysql.ddl;
-
-import lombok.Setter;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.routine.RoutineBodySegment;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateFunctionStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.MySQLStatement;
-
-import java.util.Optional;
-
-/**
- * MySQL create function statement.
- */
-@Setter
-public final class MySQLCreateFunctionStatement extends CreateFunctionStatement implements MySQLStatement {
-
- private RoutineBodySegment routineBody;
-
- @Override
- public Optional<RoutineBodySegment> getRoutineBody() {
- return Optional.ofNullable(routineBody);
- }
-}
diff --git a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLCreateIndexStatement.java b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLCreateIndexStatement.java
deleted file mode 100644
index 95d8d6c0d63..00000000000
--- a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLCreateIndexStatement.java
+++ /dev/null
@@ -1,52 +0,0 @@
-/*
- * 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.statement.mysql.ddl;
-
-import lombok.Setter;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.table.AlgorithmTypeSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.table.LockTableSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateIndexStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.MySQLStatement;
-
-import java.util.Optional;
-
-/**
- * MySQL create index statement.
- */
-@Setter
-public final class MySQLCreateIndexStatement extends CreateIndexStatement implements MySQLStatement {
-
- private AlgorithmTypeSegment algorithmType;
-
- private LockTableSegment lockTable;
-
- /**
- * Get algorithm segment.
- *
- * @return algorithm segment
- */
- @Override
- public Optional<AlgorithmTypeSegment> getAlgorithmType() {
- return Optional.ofNullable(algorithmType);
- }
-
- @Override
- public Optional<LockTableSegment> getLockTable() {
- return Optional.ofNullable(lockTable);
- }
-}
diff --git a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLCreateProcedureStatement.java b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLCreateProcedureStatement.java
deleted file mode 100644
index 9221a12b59a..00000000000
--- a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLCreateProcedureStatement.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.statement.mysql.ddl;
-
-import lombok.Setter;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.routine.RoutineBodySegment;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateProcedureStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.MySQLStatement;
-
-import java.util.Optional;
-
-/**
- * MySQL create procedure statement.
- */
-@Setter
-public final class MySQLCreateProcedureStatement extends CreateProcedureStatement implements MySQLStatement {
-
- private RoutineBodySegment routineBody;
-
- @Override
- public Optional<RoutineBodySegment> getRoutineBody() {
- return Optional.ofNullable(routineBody);
- }
-}
diff --git a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLCreateTableStatement.java b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLCreateTableStatement.java
deleted file mode 100644
index 38aa911998e..00000000000
--- a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLCreateTableStatement.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.statement.mysql.ddl;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import lombok.Setter;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.table.CreateTableOptionSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateTableStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.MySQLStatement;
-
-import java.util.Optional;
-
-/**
- * MySQL create table statement.
- */
-@RequiredArgsConstructor
-@Getter
-@Setter
-public final class MySQLCreateTableStatement extends CreateTableStatement implements MySQLStatement {
-
- private boolean ifNotExists;
-
- private SimpleTableSegment likeTable;
-
- private CreateTableOptionSegment createTableOption;
-
- @Override
- public Optional<SimpleTableSegment> getLikeTable() {
- return Optional.ofNullable(likeTable);
- }
-
- @Override
- public Optional<CreateTableOptionSegment> getCreateTableOption() {
- return Optional.ofNullable(createTableOption);
- }
-}
diff --git a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLDropIndexStatement.java b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLDropIndexStatement.java
deleted file mode 100644
index 8eb2ca50b54..00000000000
--- a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLDropIndexStatement.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.statement.mysql.ddl;
-
-import lombok.Setter;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.table.AlgorithmTypeSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.ddl.table.LockTableSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropIndexStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.MySQLStatement;
-
-import java.util.Optional;
-
-/**
- * MySQL drop index statement.
- */
-@Setter
-public final class MySQLDropIndexStatement extends DropIndexStatement implements MySQLStatement {
-
- private SimpleTableSegment simpleTable;
-
- private AlgorithmTypeSegment algorithmType;
-
- private LockTableSegment lockTable;
-
- @Override
- public Optional<SimpleTableSegment> getSimpleTable() {
- return Optional.ofNullable(simpleTable);
- }
-
- @Override
- public Optional<AlgorithmTypeSegment> getAlgorithmType() {
- return Optional.ofNullable(algorithmType);
- }
-
- @Override
- public Optional<LockTableSegment> getLockTable() {
- return Optional.ofNullable(lockTable);
- }
-}
diff --git a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLDropTableStatement.java b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLDropTableStatement.java
deleted file mode 100644
index 289e86eeaf7..00000000000
--- a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLDropTableStatement.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * 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.statement.mysql.ddl;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import lombok.Setter;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropTableStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.MySQLStatement;
-
-/**
- * MySQL drop table statement.
- */
-@RequiredArgsConstructor
-@Getter
-@Setter
-public final class MySQLDropTableStatement extends DropTableStatement implements MySQLStatement {
-
- private boolean ifExists;
-}
diff --git a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLDropViewStatement.java b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLDropViewStatement.java
deleted file mode 100644
index 4f39ccff41d..00000000000
--- a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/ddl/MySQLDropViewStatement.java
+++ /dev/null
@@ -1,33 +0,0 @@
-/*
- * 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.statement.mysql.ddl;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropViewStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.MySQLStatement;
-
-/**
- * MySQL drop view statement.
- */
-@Getter
-@Setter
-public final class MySQLDropViewStatement extends DropViewStatement implements MySQLStatement {
-
- private boolean ifExists;
-}
diff --git a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dml/MySQLDeleteStatement.java b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dml/MySQLDeleteStatement.java
deleted file mode 100644
index 35bd0b8c22a..00000000000
--- a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dml/MySQLDeleteStatement.java
+++ /dev/null
@@ -1,63 +0,0 @@
-/*
- * 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.statement.mysql.dml;
-
-import lombok.Setter;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.ReturningSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.order.OrderBySegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.pagination.limit.LimitSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.WithSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.DeleteStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.MySQLStatement;
-
-import java.util.Optional;
-
-/**
- * MySQL delete statement.
- */
-@Setter
-public final class MySQLDeleteStatement extends DeleteStatement implements MySQLStatement {
-
- private OrderBySegment orderBy;
-
- private LimitSegment limit;
-
- private ReturningSegment returningSegment;
-
- private WithSegment withSegment;
-
- @Override
- public Optional<OrderBySegment> getOrderBy() {
- return Optional.ofNullable(orderBy);
- }
-
- @Override
- public Optional<LimitSegment> getLimit() {
- return Optional.ofNullable(limit);
- }
-
- @Override
- public Optional<ReturningSegment> getReturningSegment() {
- return Optional.ofNullable(returningSegment);
- }
-
- @Override
- public Optional<WithSegment> getWithSegment() {
- return Optional.ofNullable(withSegment);
- }
-}
diff --git a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dml/MySQLInsertStatement.java b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dml/MySQLInsertStatement.java
deleted file mode 100644
index db67a178a19..00000000000
--- a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dml/MySQLInsertStatement.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.statement.mysql.dml;
-
-import lombok.Setter;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.ReturningSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.assignment.SetAssignmentSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.OnDuplicateKeyColumnsSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.InsertStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.MySQLStatement;
-
-import java.util.Optional;
-
-/**
- * MySQL insert statement.
- */
-@Setter
-public final class MySQLInsertStatement extends InsertStatement implements MySQLStatement {
-
- private SetAssignmentSegment setAssignment;
-
- private OnDuplicateKeyColumnsSegment onDuplicateKeyColumns;
-
- private ReturningSegment returningSegment;
-
- @Override
- public Optional<SetAssignmentSegment> getSetAssignment() {
- return Optional.ofNullable(setAssignment);
- }
-
- @Override
- public Optional<OnDuplicateKeyColumnsSegment> getOnDuplicateKeyColumns() {
- return Optional.ofNullable(onDuplicateKeyColumns);
- }
-
- @Override
- public Optional<ReturningSegment> getReturningSegment() {
- return Optional.ofNullable(returningSegment);
- }
-}
diff --git a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dml/MySQLSelectStatement.java b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dml/MySQLSelectStatement.java
deleted file mode 100644
index d0abb5e5a12..00000000000
--- a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dml/MySQLSelectStatement.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.statement.mysql.dml;
-
-import lombok.Setter;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.pagination.limit.LimitSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.predicate.LockSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.WindowSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.MySQLStatement;
-
-import java.util.Optional;
-
-/**
- * MySQL select statement.
- */
-@Setter
-public final class MySQLSelectStatement extends SelectStatement implements MySQLStatement {
-
- private LimitSegment limit;
-
- private LockSegment lock;
-
- private WindowSegment window;
-
- @Override
- public Optional<LimitSegment> getLimit() {
- return Optional.ofNullable(limit);
- }
-
- @Override
- public Optional<LockSegment> getLock() {
- return Optional.ofNullable(lock);
- }
-
- @Override
- public Optional<WindowSegment> getWindow() {
- return Optional.ofNullable(window);
- }
-}
diff --git a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dml/MySQLUpdateStatement.java b/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dml/MySQLUpdateStatement.java
deleted file mode 100644
index b8cdd634a7c..00000000000
--- a/parser/sql/statement/type/mysql/src/main/java/org/apache/shardingsphere/sql/parser/statement/mysql/dml/MySQLUpdateStatement.java
+++ /dev/null
@@ -1,55 +0,0 @@
-/*
- * 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.statement.mysql.dml;
-
-import lombok.Setter;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.order.OrderBySegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.pagination.limit.LimitSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.WithSegment;
-import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.UpdateStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.MySQLStatement;
-
-import java.util.Optional;
-
-/**
- * MySQL update statement.
- */
-@Setter
-public final class MySQLUpdateStatement extends UpdateStatement implements MySQLStatement {
-
- private OrderBySegment orderBy;
-
- private LimitSegment limit;
-
- private WithSegment withSegment;
-
- @Override
- public Optional<OrderBySegment> getOrderBy() {
- return Optional.ofNullable(orderBy);
- }
-
- @Override
- public Optional<LimitSegment> getLimit() {
- return Optional.ofNullable(limit);
- }
-
- @Override
- public Optional<WithSegment> getWithSegment() {
- return Optional.ofNullable(withSegment);
- }
-}
diff --git a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rul/ParseDistSQLExecutorTest.java b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rul/ParseDistSQLExecutorTest.java
index 2f8bf6c6bce..2eb114594c8 100644
--- a/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rul/ParseDistSQLExecutorTest.java
+++ b/proxy/backend/core/src/test/java/org/apache/shardingsphere/proxy/backend/handler/distsql/rul/ParseDistSQLExecutorTest.java
@@ -73,7 +73,7 @@ class ParseDistSQLExecutorTest {
handler.execute();
handler.next();
SQLStatement statement = sqlParserRule.getSQLParserEngine(TypedSPILoader.getService(DatabaseType.class, "MySQL")).parse(sql, false);
- assertThat(new LinkedList<>(handler.getRowData().getData()).getFirst(), is("MySQLSelectStatement"));
+ assertThat(new LinkedList<>(handler.getRowData().getData()).getFirst(), is("SelectStatement"));
assertThat(new LinkedList<>(handler.getRowData().getData()).getLast().toString(), is(JsonUtils.toJsonString(statement)));
}
diff --git a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/connector/sane/MySQLDialectSaneQueryResultEngineTest.java b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/connector/sane/MySQLDialectSaneQueryResultEngineTest.java
index 454a77bd7af..9a832056b62 100644
--- a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/connector/sane/MySQLDialectSaneQueryResultEngineTest.java
+++ b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/connector/sane/MySQLDialectSaneQueryResultEngineTest.java
@@ -27,9 +27,9 @@ import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table
import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.TableNameSegment;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.SetStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.ShowOtherStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.InsertStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLInsertStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLSelectStatement;
import org.junit.jupiter.api.Test;
import java.sql.SQLException;
@@ -52,14 +52,14 @@ class MySQLDialectSaneQueryResultEngineTest {
@Test
void assertGetSaneQueryResultForSelectStatementWithFrom() {
- MySQLSelectStatement selectStatement = new MySQLSelectStatement();
+ SelectStatement selectStatement = new SelectStatement();
selectStatement.setFrom(new SimpleTableSegment(new TableNameSegment(0, 0, new IdentifierValue("t"))));
assertThat(new MySQLDialectSaneQueryResultEngine().getSaneQueryResult(selectStatement, new SQLException("")), is(Optional.empty()));
}
@Test
void assertGetSaneQueryResultForSelectStatementWithoutFrom() {
- MySQLSelectStatement selectStatement = new MySQLSelectStatement();
+ SelectStatement selectStatement = new SelectStatement();
selectStatement.setProjections(new ProjectionsSegment(0, 0));
selectStatement.getProjections().getProjections().add(new ExpressionProjectionSegment(0, 0, "@@session.transaction_read_only", new VariableSegment(0, 0, "transaction_read_only")));
selectStatement.getProjections().getProjections().add(new ExpressionProjectionSegment(0, 0, "unknown_variable"));
@@ -76,7 +76,7 @@ class MySQLDialectSaneQueryResultEngineTest {
@Test
void assertGetSaneQueryResultForSelectNoProjectionsStatementWithoutFrom() {
- MySQLSelectStatement selectStatement = new MySQLSelectStatement();
+ SelectStatement selectStatement = new SelectStatement();
selectStatement.setProjections(new ProjectionsSegment(0, 0));
assertThat(new MySQLDialectSaneQueryResultEngine().getSaneQueryResult(selectStatement, new SQLException("")), is(Optional.empty()));
}
@@ -102,7 +102,7 @@ class MySQLDialectSaneQueryResultEngineTest {
@Test
void assertGetSaneQueryResultForOtherStatements() {
- assertThat(new MySQLDialectSaneQueryResultEngine().getSaneQueryResult(new MySQLInsertStatement(), new SQLException("")), is(Optional.empty()));
+ assertThat(new MySQLDialectSaneQueryResultEngine().getSaneQueryResult(new InsertStatement(), new SQLException("")), is(Optional.empty()));
}
@Test
diff --git a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/MySQLAdminExecutorCreatorTest.java b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/MySQLAdminExecutorCreatorTest.java
index 7089428b783..64431861827 100644
--- a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/MySQLAdminExecutorCreatorTest.java
+++ b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/MySQLAdminExecutorCreatorTest.java
@@ -63,9 +63,9 @@ import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.ShowPro
import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.ShowProcessListStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.ShowTablesStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.UseStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.DeleteStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLDeleteStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLSelectStatement;
import org.apache.shardingsphere.test.fixture.jdbc.MockedDataSource;
import org.apache.shardingsphere.test.mock.AutoMockExtension;
import org.apache.shardingsphere.test.mock.StaticMockSettings;
@@ -173,7 +173,7 @@ class MySQLAdminExecutorCreatorTest {
@Test
void assertCreateWithSelectStatementForShowConnectionId() {
SelectStatementContext sqlStatementContext = mock(SelectStatementContext.class);
- MySQLSelectStatement selectStatement = mock(MySQLSelectStatement.class);
+ SelectStatement selectStatement = mock(SelectStatement.class);
when(selectStatement.getFrom()).thenReturn(Optional.empty());
ProjectionsSegment projectionsSegment = mock(ProjectionsSegment.class);
when(projectionsSegment.getProjections()).thenReturn(Collections.singletonList(new ExpressionProjectionSegment(0, 10, "CONNECTION_ID()")));
@@ -187,7 +187,7 @@ class MySQLAdminExecutorCreatorTest {
@Test
void assertCreateWithSelectStatementForShowVersion() {
SelectStatementContext sqlStatementContext = mock(SelectStatementContext.class);
- MySQLSelectStatement selectStatement = mock(MySQLSelectStatement.class);
+ SelectStatement selectStatement = mock(SelectStatement.class);
when(selectStatement.getFrom()).thenReturn(Optional.empty());
ProjectionsSegment projectionsSegment = mock(ProjectionsSegment.class);
when(projectionsSegment.getProjections()).thenReturn(Collections.singletonList(new ExpressionProjectionSegment(0, 10, "version()")));
@@ -201,7 +201,7 @@ class MySQLAdminExecutorCreatorTest {
@Test
void assertCreateWithSelectStatementForCurrentUser() {
SelectStatementContext sqlStatementContext = mock(SelectStatementContext.class);
- MySQLSelectStatement selectStatement = mock(MySQLSelectStatement.class);
+ SelectStatement selectStatement = mock(SelectStatement.class);
when(selectStatement.getFrom()).thenReturn(Optional.empty());
ProjectionsSegment projectionsSegment = mock(ProjectionsSegment.class);
when(projectionsSegment.getProjections()).thenReturn(Collections.singletonList(new ExpressionProjectionSegment(0, 10, "CURRENT_USER()")));
@@ -216,7 +216,7 @@ class MySQLAdminExecutorCreatorTest {
void assertCreateWithSelectStatementForTransactionReadOnly() {
initProxyContext(Collections.emptyList());
- MySQLSelectStatement selectStatement = mock(MySQLSelectStatement.class);
+ SelectStatement selectStatement = mock(SelectStatement.class);
when(selectStatement.getFrom()).thenReturn(Optional.empty());
ProjectionsSegment projectionsSegment = mock(ProjectionsSegment.class);
VariableSegment variableSegment = new VariableSegment(0, 0, "transaction_read_only", "SESSION");
@@ -232,7 +232,7 @@ class MySQLAdminExecutorCreatorTest {
@Test
void assertCreateWithSelectStatementForTransactionIsolation() {
initProxyContext(Collections.emptyList());
- MySQLSelectStatement selectStatement = mock(MySQLSelectStatement.class);
+ SelectStatement selectStatement = mock(SelectStatement.class);
when(selectStatement.getFrom()).thenReturn(Optional.empty());
ProjectionsSegment projectionsSegment = mock(ProjectionsSegment.class);
VariableSegment variableSegment = new VariableSegment(0, 0, "transaction_isolation", "SESSION");
@@ -248,7 +248,7 @@ class MySQLAdminExecutorCreatorTest {
@Test
void assertCreateWithSelectStatementForShowDatabase() {
initProxyContext(Collections.emptyList());
- MySQLSelectStatement selectStatement = mock(MySQLSelectStatement.class);
+ SelectStatement selectStatement = mock(SelectStatement.class);
when(selectStatement.getFrom()).thenReturn(Optional.empty());
ProjectionsSegment projectionsSegment = mock(ProjectionsSegment.class);
when(projectionsSegment.getProjections()).thenReturn(Collections.singletonList(new ExpressionProjectionSegment(0, 10, "DATABASE()")));
@@ -263,7 +263,7 @@ class MySQLAdminExecutorCreatorTest {
@Test
void assertCreateWithOtherSelectStatementForNoResource() {
initProxyContext(Collections.emptyList());
- MySQLSelectStatement selectStatement = mock(MySQLSelectStatement.class);
+ SelectStatement selectStatement = mock(SelectStatement.class);
when(selectStatement.getFrom()).thenReturn(Optional.empty());
ProjectionsSegment projectionsSegment = mock(ProjectionsSegment.class);
when(projectionsSegment.getProjections()).thenReturn(Collections.singletonList(new ExpressionProjectionSegment(0, 10, "CURRENT_DATE()")));
@@ -282,7 +282,7 @@ class MySQLAdminExecutorCreatorTest {
initProxyContext(Collections.singleton(database));
when(ProxyContext.getInstance().getAllDatabaseNames()).thenReturn(Collections.singleton("db_0"));
when(ProxyContext.getInstance().getContextManager().getDatabase("db_0")).thenReturn(database);
- MySQLSelectStatement selectStatement = mock(MySQLSelectStatement.class);
+ SelectStatement selectStatement = mock(SelectStatement.class);
when(selectStatement.getFrom()).thenReturn(Optional.empty());
ProjectionsSegment projectionsSegment = mock(ProjectionsSegment.class);
when(projectionsSegment.getProjections()).thenReturn(Collections.singletonList(new ExpressionProjectionSegment(0, 10, "CURRENT_DATE()")));
@@ -300,7 +300,7 @@ class MySQLAdminExecutorCreatorTest {
initProxyContext(Collections.singleton(database));
when(ProxyContext.getInstance().getAllDatabaseNames()).thenReturn(Collections.singleton("db_0"));
when(ProxyContext.getInstance().getContextManager().getDatabase("db_0")).thenReturn(database);
- MySQLSelectStatement selectStatement = mock(MySQLSelectStatement.class);
+ SelectStatement selectStatement = mock(SelectStatement.class);
when(selectStatement.getFrom()).thenReturn(Optional.empty());
ProjectionsSegment projectionsSegment = mock(ProjectionsSegment.class);
when(projectionsSegment.getProjections()).thenReturn(Collections.singletonList(new ExpressionProjectionSegment(0, 10, "CURRENT_DATE()")));
@@ -317,7 +317,7 @@ class MySQLAdminExecutorCreatorTest {
initProxyContext(Collections.emptyList());
SimpleTableSegment tableSegment = new SimpleTableSegment(new TableNameSegment(10, 13, new IdentifierValue("ENGINES")));
tableSegment.setOwner(new OwnerSegment(7, 8, new IdentifierValue("information_schema")));
- MySQLSelectStatement selectStatement = mock(MySQLSelectStatement.class);
+ SelectStatement selectStatement = mock(SelectStatement.class);
when(selectStatement.getFrom()).thenReturn(Optional.of(tableSegment));
SelectStatementContext sqlStatementContext = mock(SelectStatementContext.class);
when(sqlStatementContext.getSqlStatement()).thenReturn(selectStatement);
@@ -331,7 +331,7 @@ class MySQLAdminExecutorCreatorTest {
initProxyContext(Collections.emptyList());
SimpleTableSegment tableSegment = new SimpleTableSegment(new TableNameSegment(10, 13, new IdentifierValue("SCHEMATA")));
tableSegment.setOwner(new OwnerSegment(7, 8, new IdentifierValue("information_schema")));
- MySQLSelectStatement selectStatement = mock(MySQLSelectStatement.class);
+ SelectStatement selectStatement = mock(SelectStatement.class);
when(selectStatement.getFrom()).thenReturn(Optional.of(tableSegment));
SelectStatementContext sqlStatementContext = mock(SelectStatementContext.class);
when(sqlStatementContext.getSqlStatement()).thenReturn(selectStatement);
@@ -348,7 +348,7 @@ class MySQLAdminExecutorCreatorTest {
initProxyContext(Collections.emptyList());
SimpleTableSegment tableSegment = new SimpleTableSegment(new TableNameSegment(10, 13, new IdentifierValue("CHARACTER_SETS")));
tableSegment.setOwner(new OwnerSegment(7, 8, new IdentifierValue("information_schema")));
- MySQLSelectStatement selectStatement = mock(MySQLSelectStatement.class);
+ SelectStatement selectStatement = mock(SelectStatement.class);
SelectStatementContext sqlStatementContext = mock(SelectStatementContext.class);
when(selectStatement.getFrom()).thenReturn(Optional.of(tableSegment));
when(sqlStatementContext.getSqlStatement()).thenReturn(selectStatement);
@@ -361,7 +361,7 @@ class MySQLAdminExecutorCreatorTest {
initProxyContext(Collections.emptyList());
SimpleTableSegment tableSegment = new SimpleTableSegment(new TableNameSegment(10, 13, new IdentifierValue("accounts")));
tableSegment.setOwner(new OwnerSegment(7, 8, new IdentifierValue("performance_schema")));
- MySQLSelectStatement selectStatement = mock(MySQLSelectStatement.class);
+ SelectStatement selectStatement = mock(SelectStatement.class);
when(selectStatement.getFrom()).thenReturn(Optional.of(tableSegment));
SelectStatementContext sqlStatementContext = mock(SelectStatementContext.class);
when(sqlStatementContext.getSqlStatement()).thenReturn(selectStatement);
@@ -380,7 +380,7 @@ class MySQLAdminExecutorCreatorTest {
@Test
void assertCreateWithDMLStatement() {
SQLStatementContext sqlStatementContext = mock(SQLStatementContext.class);
- when(sqlStatementContext.getSqlStatement()).thenReturn(new MySQLDeleteStatement());
+ when(sqlStatementContext.getSqlStatement()).thenReturn(new DeleteStatement());
Optional<DatabaseAdminExecutor> actual = new MySQLAdminExecutorCreator().create(sqlStatementContext, "delete from t", "", Collections.emptyList());
assertThat(actual, is(Optional.empty()));
}
diff --git a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/MySQLSystemVariableQueryExecutorTest.java b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/MySQLSystemVariableQueryExecutorTest.java
index 22bcd49130a..54412c2ef81 100644
--- a/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/MySQLSystemVariableQueryExecutorTest.java
+++ b/proxy/backend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/backend/mysql/handler/admin/executor/MySQLSystemVariableQueryExecutorTest.java
@@ -28,8 +28,8 @@ import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.item.Colu
import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.item.ExpressionProjectionSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.item.ProjectionsSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.generic.AliasSegment;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLSelectStatement;
import org.junit.jupiter.api.Test;
import java.sql.SQLException;
@@ -45,7 +45,7 @@ class MySQLSystemVariableQueryExecutorTest {
@Test
void assertTryGetSystemVariableQueryExecutorWithOtherExpressionProjection() {
- MySQLSelectStatement selectStatement = new MySQLSelectStatement();
+ SelectStatement selectStatement = new SelectStatement();
selectStatement.setProjections(new ProjectionsSegment(0, 0));
VariableSegment variable = new VariableSegment(0, 0, "max_connections", "session");
selectStatement.getProjections().getProjections().add(new ExpressionProjectionSegment(0, 0, "@@session.max_connections", variable));
@@ -55,7 +55,7 @@ class MySQLSystemVariableQueryExecutorTest {
@Test
void assertTryGetSystemVariableQueryExecutorWithUnknownVariable() {
- MySQLSelectStatement selectStatement = new MySQLSelectStatement();
+ SelectStatement selectStatement = new SelectStatement();
selectStatement.setProjections(new ProjectionsSegment(0, 0));
selectStatement.getProjections().getProjections().add(new ExpressionProjectionSegment(0, 0, "@@unknown_variable", new VariableSegment(0, 0, "unknown_variable")));
assertFalse(MySQLSystemVariableQueryExecutor.tryGetSystemVariableQueryExecutor(selectStatement).isPresent());
@@ -63,7 +63,7 @@ class MySQLSystemVariableQueryExecutorTest {
@Test
void assertTryGetSystemVariableQueryExecutorAndExecuteWithCorrectScope() throws SQLException {
- MySQLSelectStatement selectStatement = new MySQLSelectStatement();
+ SelectStatement selectStatement = new SelectStatement();
selectStatement.setProjections(new ProjectionsSegment(0, 0));
VariableSegment maxConnectionsVariable = new VariableSegment(0, 0, "max_connections", "global");
selectStatement.getProjections().getProjections().add(new ExpressionProjectionSegment(0, 0, "@@global.max_connections", maxConnectionsVariable));
@@ -91,7 +91,7 @@ class MySQLSystemVariableQueryExecutorTest {
@Test
void assertExecuteWithIncorrectScope() {
- MySQLSelectStatement selectStatement = new MySQLSelectStatement();
+ SelectStatement selectStatement = new SelectStatement();
selectStatement.setProjections(new ProjectionsSegment(0, 0));
VariableSegment variable = new VariableSegment(0, 0, "max_connections", "session");
selectStatement.getProjections().getProjections().add(new ExpressionProjectionSegment(0, 0, "@@session.max_connections", variable));
diff --git a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareChecker.java b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareChecker.java
index b55d1e17a3b..8d32697a1a9 100644
--- a/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareChecker.java
+++ b/proxy/frontend/type/mysql/src/main/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareChecker.java
@@ -45,13 +45,23 @@ import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.Uninsta
import org.apache.shardingsphere.sql.parser.statement.core.statement.dcl.AlterUserStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dcl.DropUserStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dcl.RenameUserStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterTableStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateDatabaseStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateIndexStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateTableStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateViewStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropDatabaseStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropIndexStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropTableStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropViewStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.RenameTableStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.TruncateStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.CallStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.DeleteStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.DoStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.InsertStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.UpdateStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.rl.ChangeMasterStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.rl.StartSlaveStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.rl.StopSlaveStatement;
@@ -65,16 +75,6 @@ import org.apache.shardingsphere.sql.parser.statement.core.statement.tcl.xa.XARo
import org.apache.shardingsphere.sql.parser.statement.mysql.dcl.MySQLCreateUserStatement;
import org.apache.shardingsphere.sql.parser.statement.mysql.dcl.MySQLGrantStatement;
import org.apache.shardingsphere.sql.parser.statement.mysql.dcl.MySQLRevokeStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLAlterTableStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateIndexStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateTableStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLDropIndexStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLDropTableStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLDropViewStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLDeleteStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLInsertStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLSelectStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLUpdateStatement;
import java.util.Arrays;
import java.util.Collection;
@@ -91,17 +91,17 @@ public final class MySQLComStmtPrepareChecker {
private static final Collection<Class<?>> ALLOWED_SQL_STATEMENTS = new HashSet<>();
static {
- ALLOWED_SQL_STATEMENTS.addAll(Arrays.asList(MySQLAlterTableStatement.class, AlterUserStatement.class, AnalyzeTableStatement.class,
+ ALLOWED_SQL_STATEMENTS.addAll(Arrays.asList(AlterTableStatement.class, AlterUserStatement.class, AnalyzeTableStatement.class,
CacheIndexStatement.class, CallStatement.class, ChangeMasterStatement.class, ChecksumTableStatement.class, CommitStatement.class,
- MySQLCreateIndexStatement.class, MySQLDropIndexStatement.class, CreateDatabaseStatement.class, DropDatabaseStatement.class,
- MySQLCreateTableStatement.class, MySQLDropTableStatement.class, MySQLCreateUserStatement.class, RenameUserStatement.class, DropUserStatement.class,
- CreateViewStatement.class, MySQLDropViewStatement.class, MySQLDeleteStatement.class, DoStatement.class, FlushStatement.class,
- MySQLGrantStatement.class, MySQLInsertStatement.class, InstallPluginStatement.class, KillStatement.class, LoadIndexInfoStatement.class,
+ CreateIndexStatement.class, DropIndexStatement.class, CreateDatabaseStatement.class, DropDatabaseStatement.class,
+ CreateTableStatement.class, DropTableStatement.class, MySQLCreateUserStatement.class, RenameUserStatement.class, DropUserStatement.class,
+ CreateViewStatement.class, DropViewStatement.class, DeleteStatement.class, DoStatement.class, FlushStatement.class,
+ MySQLGrantStatement.class, InsertStatement.class, InstallPluginStatement.class, KillStatement.class, LoadIndexInfoStatement.class,
OptimizeTableStatement.class, RenameTableStatement.class, RepairTableStatement.class, ResetStatement.class,
- MySQLRevokeStatement.class, MySQLSelectStatement.class, SetStatement.class, ShowWarningsStatement.class, ShowErrorsStatement.class,
+ MySQLRevokeStatement.class, SelectStatement.class, SetStatement.class, ShowWarningsStatement.class, ShowErrorsStatement.class,
ShowBinlogEventsStatement.class, ShowCreateProcedureStatement.class, ShowCreateFunctionStatement.class, ShowCreateEventStatement.class,
ShowCreateTableStatement.class, ShowCreateViewStatement.class, ShowBinaryLogsStatement.class, ShowStatusStatement.class,
- StartSlaveStatement.class, StopSlaveStatement.class, TruncateStatement.class, UninstallPluginStatement.class, MySQLUpdateStatement.class,
+ StartSlaveStatement.class, StopSlaveStatement.class, TruncateStatement.class, UninstallPluginStatement.class, UpdateStatement.class,
XABeginStatement.class, XAPrepareStatement.class, XACommitStatement.class, XARollbackStatement.class, XAEndStatement.class, XARecoveryStatement.class));
}
diff --git a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/MySQLCommandPacketFactoryTest.java b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/MySQLCommandPacketFactoryTest.java
index 025fc677c8b..8dcf0deb3e1 100644
--- a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/MySQLCommandPacketFactoryTest.java
+++ b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/MySQLCommandPacketFactoryTest.java
@@ -38,7 +38,7 @@ import org.apache.shardingsphere.infra.hint.HintValueContext;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
import org.apache.shardingsphere.proxy.backend.session.ServerPreparedStatementRegistry;
import org.apache.shardingsphere.proxy.frontend.mysql.command.query.binary.MySQLServerPreparedStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLSelectStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
import org.junit.jupiter.api.Test;
import org.junit.jupiter.api.extension.ExtendWith;
import org.mockito.Answers;
@@ -97,7 +97,7 @@ class MySQLCommandPacketFactoryTest {
ServerPreparedStatementRegistry serverPreparedStatementRegistry = new ServerPreparedStatementRegistry();
when(connectionSession.getServerPreparedStatementRegistry()).thenReturn(serverPreparedStatementRegistry);
SQLStatementContext sqlStatementContext = mock(SQLStatementContext.class);
- when(sqlStatementContext.getSqlStatement()).thenReturn(new MySQLSelectStatement());
+ when(sqlStatementContext.getSqlStatement()).thenReturn(new SelectStatement());
serverPreparedStatementRegistry.addPreparedStatement(1, new MySQLServerPreparedStatement("select 1", sqlStatementContext, new HintValueContext(), Collections.emptyList()));
assertThat(MySQLCommandPacketFactory.newInstance(MySQLCommandPacketType.COM_STMT_EXECUTE, payload, connectionSession), instanceOf(MySQLComStmtExecutePacket.class));
}
diff --git a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/execute/MySQLComStmtExecuteExecutorTest.java b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/execute/MySQLComStmtExecuteExecutorTest.java
index b897d022627..e6720602d63 100644
--- a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/execute/MySQLComStmtExecuteExecutorTest.java
+++ b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/execute/MySQLComStmtExecuteExecutorTest.java
@@ -55,10 +55,10 @@ import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.assignmen
import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.column.ColumnSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.expr.simple.ParameterMarkerExpressionSegment;
import org.apache.shardingsphere.sql.parser.statement.core.segment.dml.item.ProjectionsSegment;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.UpdateStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.tcl.CommitStatement;
import org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLSelectStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLUpdateStatement;
import org.apache.shardingsphere.test.mock.AutoMockExtension;
import org.apache.shardingsphere.test.mock.StaticMockSettings;
import org.junit.jupiter.api.BeforeEach;
@@ -136,14 +136,14 @@ class MySQLComStmtExecuteExecutorTest {
return result;
}
- private MySQLSelectStatement prepareSelectStatement() {
- MySQLSelectStatement result = new MySQLSelectStatement();
+ private SelectStatement prepareSelectStatement() {
+ SelectStatement result = new SelectStatement();
result.setProjections(new ProjectionsSegment(0, 0));
return result;
}
- private MySQLUpdateStatement prepareUpdateStatement() {
- MySQLUpdateStatement result = new MySQLUpdateStatement();
+ private UpdateStatement prepareUpdateStatement() {
+ UpdateStatement result = new UpdateStatement();
ColumnSegment columnSegment = new ColumnSegment(0, 0, new IdentifierValue("col"));
ColumnAssignmentSegment columnAssignmentSegment = new ColumnAssignmentSegment(0, 0, Collections.singletonList(columnSegment), new ParameterMarkerExpressionSegment(0, 0, 0));
result.setSetAssignment(new SetAssignmentSegment(0, 0, Collections.singletonList(columnAssignmentSegment)));
@@ -180,7 +180,7 @@ class MySQLComStmtExecuteExecutorTest {
when(packet.getStatementId()).thenReturn(2);
when(packet.getNewParametersBoundFlag()).thenReturn(MySQLNewParametersBoundFlag.PARAMETER_TYPE_EXIST);
MySQLComStmtExecuteExecutor executor = new MySQLComStmtExecuteExecutor(packet, connectionSession);
- when(proxyBackendHandler.execute()).thenReturn(new UpdateResponseHeader(new MySQLUpdateStatement()));
+ when(proxyBackendHandler.execute()).thenReturn(new UpdateResponseHeader(new UpdateStatement()));
when(ProxyBackendHandlerFactory.newInstance(eq(databaseType), any(QueryContext.class), eq(connectionSession), anyBoolean())).thenReturn(proxyBackendHandler);
Iterator<DatabasePacket> actual = executor.execute().iterator();
assertThat(executor.getResponseType(), is(ResponseType.UPDATE));
diff --git a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareCheckerTest.java b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareCheckerTest.java
index 37170c69144..f8d88e53460 100644
--- a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareCheckerTest.java
+++ b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareCheckerTest.java
@@ -43,13 +43,23 @@ import org.apache.shardingsphere.sql.parser.statement.core.statement.dal.Uninsta
import org.apache.shardingsphere.sql.parser.statement.core.statement.dcl.AlterUserStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dcl.DropUserStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dcl.RenameUserStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.AlterTableStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateDatabaseStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateIndexStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateTableStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.CreateViewStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropDatabaseStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropIndexStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropTableStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.DropViewStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.RenameTableStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.ddl.TruncateStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.CallStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.DeleteStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.DoStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.InsertStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.UpdateStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.rl.ChangeMasterStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.rl.StartSlaveStatement;
import org.apache.shardingsphere.sql.parser.statement.core.statement.rl.StopSlaveStatement;
@@ -63,16 +73,6 @@ import org.apache.shardingsphere.sql.parser.statement.core.statement.tcl.xa.XARo
import org.apache.shardingsphere.sql.parser.statement.mysql.dcl.MySQLCreateUserStatement;
import org.apache.shardingsphere.sql.parser.statement.mysql.dcl.MySQLGrantStatement;
import org.apache.shardingsphere.sql.parser.statement.mysql.dcl.MySQLRevokeStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLAlterTableStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateIndexStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLCreateTableStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLDropIndexStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLDropTableStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.ddl.MySQLDropViewStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLDeleteStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLInsertStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLSelectStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLUpdateStatement;
import org.junit.jupiter.api.Test;
import java.util.Arrays;
@@ -85,20 +85,20 @@ class MySQLComStmtPrepareCheckerTest {
@Test
void assertIsStatementAllowed() {
- MySQLCreateTableStatement createTableStatement = new MySQLCreateTableStatement();
+ CreateTableStatement createTableStatement = new CreateTableStatement();
Collection<SQLStatement> sqlStatements = Arrays.asList(
- new MySQLAlterTableStatement(), new AlterUserStatement(), new AnalyzeTableStatement(Collections.emptyList()), new CacheIndexStatement(),
+ new AlterTableStatement(), new AlterUserStatement(), new AnalyzeTableStatement(Collections.emptyList()), new CacheIndexStatement(),
new CallStatement(null, Collections.emptyList()), new ChangeMasterStatement(), new ChecksumTableStatement(Collections.emptyList()), new CommitStatement(),
- new MySQLCreateIndexStatement(), new MySQLDropIndexStatement(), new CreateDatabaseStatement(null, false), new DropDatabaseStatement(null, false), createTableStatement,
- new MySQLDropTableStatement(), new MySQLCreateUserStatement(), new RenameUserStatement(), new DropUserStatement(Collections.emptyList()),
- new CreateViewStatement(), new MySQLDropViewStatement(), new MySQLDeleteStatement(), new DoStatement(Collections.emptyList()), new FlushStatement(Collections.emptyList(), false),
- new MySQLGrantStatement(), new MySQLInsertStatement(), new InstallPluginStatement(null), new KillStatement(null, null),
+ new CreateIndexStatement(), new DropIndexStatement(), new CreateDatabaseStatement(null, false), new DropDatabaseStatement(null, false), createTableStatement,
+ new DropTableStatement(), new MySQLCreateUserStatement(), new RenameUserStatement(), new DropUserStatement(Collections.emptyList()),
+ new CreateViewStatement(), new DropViewStatement(), new DeleteStatement(), new DoStatement(Collections.emptyList()), new FlushStatement(Collections.emptyList(), false),
+ new MySQLGrantStatement(), new InsertStatement(), new InstallPluginStatement(null), new KillStatement(null, null),
new LoadIndexInfoStatement(Collections.emptyList()), new OptimizeTableStatement(null), new RenameTableStatement(Collections.emptyList()),
new RepairTableStatement(Collections.emptyList()),
- new ResetStatement(Collections.emptyList()), new MySQLRevokeStatement(), new MySQLSelectStatement(), new SetStatement(Collections.emptyList()), new ShowWarningsStatement(null),
+ new ResetStatement(Collections.emptyList()), new MySQLRevokeStatement(), new SelectStatement(), new SetStatement(Collections.emptyList()), new ShowWarningsStatement(null),
new ShowErrorsStatement(null), new ShowBinlogEventsStatement(null, null), new ShowCreateProcedureStatement(null), new ShowCreateFunctionStatement(null),
new ShowCreateEventStatement(null), new ShowCreateTableStatement(null), new ShowCreateViewStatement(null), new ShowBinaryLogsStatement(), new ShowStatusStatement(null),
- new StartSlaveStatement(), new StopSlaveStatement(), new TruncateStatement(), new UninstallPluginStatement(null), new MySQLUpdateStatement(),
+ new StartSlaveStatement(), new StopSlaveStatement(), new TruncateStatement(), new UninstallPluginStatement(null), new UpdateStatement(),
new XABeginStatement("1"), new XAPrepareStatement("1"), new XACommitStatement("1"), new XARollbackStatement("1"), new XAEndStatement("1"), new XARecoveryStatement());
for (SQLStatement each : sqlStatements) {
assertTrue(MySQLComStmtPrepareChecker.isAllowedStatement(each));
diff --git a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutorTest.java b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutorTest.java
index 8f73f5025cf..b5afbe63d7a 100644
--- a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutorTest.java
+++ b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/binary/prepare/MySQLComStmtPrepareExecutorTest.java
@@ -51,9 +51,9 @@ import org.apache.shardingsphere.proxy.backend.session.ServerPreparedStatementRe
import org.apache.shardingsphere.proxy.frontend.mysql.command.query.binary.MySQLServerPreparedStatement;
import org.apache.shardingsphere.proxy.frontend.mysql.command.query.binary.MySQLStatementIdGenerator;
import org.apache.shardingsphere.sql.parser.api.CacheOption;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLInsertStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLSelectStatement;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLUpdateStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.InsertStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.SelectStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.UpdateStatement;
import org.apache.shardingsphere.test.mock.AutoMockExtension;
import org.apache.shardingsphere.test.mock.StaticMockSettings;
import org.junit.jupiter.api.BeforeEach;
@@ -126,7 +126,7 @@ class MySQLComStmtPrepareExecutorTest {
MySQLServerPreparedStatement actualPreparedStatement = connectionSession.getServerPreparedStatementRegistry().getPreparedStatement(1);
assertThat(actualPreparedStatement.getSql(), is(sql));
assertThat(actualPreparedStatement.getSqlStatementContext(), instanceOf(SelectStatementContext.class));
- assertThat(actualPreparedStatement.getSqlStatementContext().getSqlStatement(), instanceOf(MySQLSelectStatement.class));
+ assertThat(actualPreparedStatement.getSqlStatementContext().getSqlStatement(), instanceOf(SelectStatement.class));
MySQLStatementIdGenerator.getInstance().unregisterConnection(1);
}
@@ -159,7 +159,7 @@ class MySQLComStmtPrepareExecutorTest {
MySQLServerPreparedStatement actualPreparedStatement = connectionSession.getServerPreparedStatementRegistry().getPreparedStatement(1);
assertThat(actualPreparedStatement.getSql(), is(sql));
assertThat(actualPreparedStatement.getSqlStatementContext(), instanceOf(InsertStatementContext.class));
- assertThat(actualPreparedStatement.getSqlStatementContext().getSqlStatement(), instanceOf(MySQLInsertStatement.class));
+ assertThat(actualPreparedStatement.getSqlStatementContext().getSqlStatement(), instanceOf(InsertStatement.class));
MySQLStatementIdGenerator.getInstance().unregisterConnection(connectionId);
}
@@ -211,7 +211,7 @@ class MySQLComStmtPrepareExecutorTest {
MySQLServerPreparedStatement actualPreparedStatement = connectionSession.getServerPreparedStatementRegistry().getPreparedStatement(1);
assertThat(actualPreparedStatement.getSql(), is(sql));
assertThat(actualPreparedStatement.getSqlStatementContext(), instanceOf(UpdateStatementContext.class));
- assertThat(actualPreparedStatement.getSqlStatementContext().getSqlStatement(), instanceOf(MySQLUpdateStatement.class));
+ assertThat(actualPreparedStatement.getSqlStatementContext().getSqlStatement(), instanceOf(UpdateStatement.class));
MySQLStatementIdGenerator.getInstance().unregisterConnection(1);
}
diff --git a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLMultiStatementsHandlerTest.java b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLMultiStatementsHandlerTest.java
index 71f657be444..1a9da3b8f0a 100644
--- a/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLMultiStatementsHandlerTest.java
+++ b/proxy/frontend/type/mysql/src/test/java/org/apache/shardingsphere/proxy/frontend/mysql/command/query/text/query/MySQLMultiStatementsHandlerTest.java
@@ -37,7 +37,7 @@ import org.apache.shardingsphere.proxy.backend.response.header.ResponseHeader;
import org.apache.shardingsphere.proxy.backend.response.header.update.MultiStatementsUpdateResponseHeader;
import org.apache.shardingsphere.proxy.backend.response.header.update.UpdateResponseHeader;
import org.apache.shardingsphere.proxy.backend.session.ConnectionSession;
-import org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLUpdateStatement;
+import org.apache.shardingsphere.sql.parser.statement.core.statement.dml.UpdateStatement;
import org.apache.shardingsphere.sqltranslator.rule.SQLTranslatorRule;
import org.apache.shardingsphere.sqltranslator.rule.builder.DefaultSQLTranslatorRuleConfigurationBuilder;
import org.apache.shardingsphere.test.mock.AutoMockExtension;
@@ -75,7 +75,7 @@ class MySQLMultiStatementsHandlerTest {
void assertExecute() throws SQLException {
String sql = "update t set v=v+1 where id=1;update t set v=v+1 where id=2;update t set v=v+1 where id=3";
ConnectionSession connectionSession = mockConnectionSession();
- MySQLUpdateStatement expectedStatement = mock(MySQLUpdateStatement.class);
+ UpdateStatement expectedStatement = mock(UpdateStatement.class);
ContextManager contextManager = mockContextManager();
when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
ResponseHeader actual = new MySQLMultiStatementsHandler(connectionSession, expectedStatement, sql).execute();
@@ -101,7 +101,7 @@ class MySQLMultiStatementsHandlerTest {
void assertExecuteWithSpecifiedDatabaseName() throws SQLException {
String sql = "update foo_db.t set v=v+1 where id=1;update foo_db.t set v=v+1 where id=2;update foo_db.t set v=v+1 where id=3";
ConnectionSession connectionSession = mockConnectionSession();
- MySQLUpdateStatement expectedStatement = mock(MySQLUpdateStatement.class);
+ UpdateStatement expectedStatement = mock(UpdateStatement.class);
ContextManager contextManager = mockContextManager();
when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
ResponseHeader actual = new MySQLMultiStatementsHandler(connectionSession, expectedStatement, sql).execute();
@@ -129,7 +129,7 @@ class MySQLMultiStatementsHandlerTest {
"insert into t (id, v) values(1,1) on duplicate key update v=2;insert into t (id, v) values(2,1) "
+ "on duplicate key update v=3;insert into t (id, v) values(2,1) on duplicate key update v=3";
ConnectionSession connectionSession = mockConnectionSession();
- MySQLUpdateStatement expectedStatement = mock(MySQLUpdateStatement.class);
+ UpdateStatement expectedStatement = mock(UpdateStatement.class);
ContextManager contextManager = mockContextManager();
when(ProxyContext.getInstance().getContextManager()).thenReturn(contextManager);
ResponseHeader actual = new MySQLMultiStatementsHandler(connectionSession, expectedStatement, sql).execute();
diff --git a/test/it/parser/src/main/resources/case/ddl/create-procedure.xml b/test/it/parser/src/main/resources/case/ddl/create-procedure.xml
index 1bf4176f540..8c6deb22613 100644
--- a/test/it/parser/src/main/resources/case/ddl/create-procedure.xml
+++ b/test/it/parser/src/main/resources/case/ddl/create-procedure.xml
@@ -67,27 +67,27 @@
<create-procedure sql-case-id="create_procedure_with_handler_and_table_creation">
<procedure-name name="peter1" />
<sql-statements>
- <sql-statement start-index="65" stop-index="158" statement-class-simple-name="MySQLHandlerStatement" />
- <sql-statement start-index="160" stop-index="202" statement-class-simple-name="MySQLCreateTableStatement" />
- <sql-statement start-index="204" stop-index="218" statement-class-simple-name="MySQLCallStatement" />
+ <sql-statement start-index="65" stop-index="158" statement-class-simple-name="HandlerStatement" />
+ <sql-statement start-index="160" stop-index="202" statement-class-simple-name="CreateTableStatement" />
+ <sql-statement start-index="204" stop-index="218" statement-class-simple-name="CallStatement" />
</sql-statements>
</create-procedure>
<create-procedure sql-case-id="create_procedure_with_decimal_variable">
<procedure-name name="bug15231_4" />
<sql-statements>
- <sql-statement start-index="60" stop-index="73" statement-class-simple-name="MySQLSetStatement" />
- <sql-statement start-index="75" stop-index="88" statement-class-simple-name="MySQLShowWarningsStatement" />
+ <sql-statement start-index="60" stop-index="73" statement-class-simple-name="SetStatement" />
+ <sql-statement start-index="75" stop-index="88" statement-class-simple-name="ShowWarningsStatement" />
</sql-statements>
</create-procedure>
<create-procedure sql-case-id="create_procedure_with_transaction_read_only_and_isolation">
<procedure-name name="p1" />
<sql-statements>
- <sql-statement start-index="22" stop-index="84" statement-class-simple-name="MySQLSetStatement" />
+ <sql-statement start-index="22" stop-index="84" statement-class-simple-name="SetStatement" />
</sql-statements>
</create-procedure>
<create-procedure sql-case-id="create_procedure_with_transaction_read_only" >
<sql-statements>
- <sql-statement start-index="22" stop-index="54" statement-class-simple-name="MySQLSetStatement" />
+ <sql-statement start-index="22" stop-index="54" statement-class-simple-name="SetStatement" />
</sql-statements>
</create-procedure>
<create-procedure sql-case-id="create_procedure_if_not_exists" />
@@ -105,20 +105,20 @@
<create-procedure sql-case-id="create_procedure_with_charset_parameters_and_insert">
<procedure-name name="bug18293" />
<sql-statements>
- <sql-statement start-index="125" stop-index="172" statement-class-simple-name="MySQLInsertStatement" />
+ <sql-statement start-index="125" stop-index="172" statement-class-simple-name="InsertStatement" />
</sql-statements>
</create-procedure>
<create-procedure sql-case-id="create_procedure_with_create_table_and_show_create_table_schema">
<procedure-name name="p2" />
<sql-statements>
- <sql-statement start-index="47" stop-index="90" statement-class-simple-name="MySQLCreateTableStatement" />
+ <sql-statement start-index="47" stop-index="90" statement-class-simple-name="CreateTableStatement" />
<sql-statement start-index="92" stop-index="116" statement-class-simple-name="ShowCreateTableStatement" />
</sql-statements>
</create-procedure>
<create-procedure sql-case-id="create_procedure_with_show_create_table_in_default_schema">
<procedure-name name="p1" />
<sql-statements>
- <sql-statement start-index="33" stop-index="76" statement-class-simple-name="MySQLCreateTableStatement" />
+ <sql-statement start-index="33" stop-index="76" statement-class-simple-name="CreateTableStatement" />
<sql-statement start-index="78" stop-index="102" statement-class-simple-name="ShowCreateTableStatement" />
</sql-statements>
</create-procedure>