You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by pa...@apache.org on 2022/06/25 07:19:18 UTC
[shardingsphere] branch master updated: Unify names of ifExists and ifNotExists (#18580)
This is an automated email from the ASF dual-hosted git repository.
panjuan 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 c7adfc87df1 Unify names of ifExists and ifNotExists (#18580)
c7adfc87df1 is described below
commit c7adfc87df1e81bb96483a222d6ad3869ca23a79
Author: Liang Zhang <zh...@apache.org>
AuthorDate: Sat Jun 25 15:19:12 2022 +0800
Unify names of ifExists and ifNotExists (#18580)
---
.../src/main/antlr4/imports/RDLStatement.g4 | 6 +-
.../core/common/CommonDistSQLStatementVisitor.java | 6 +-
.../common/updatable/DropTrafficRuleStatement.java | 4 +-
.../drop/DropDefaultSingleTableRuleStatement.java | 4 +-
.../statement/rdl/drop/DropResourceStatement.java | 4 +-
.../statement/rdl/drop/DropRuleStatement.java | 2 +-
...DatabaseDiscoveryHeartbeatStatementUpdater.java | 2 +-
.../DropDatabaseDiscoveryRuleStatementUpdater.java | 2 +-
.../DropDatabaseDiscoveryTypeStatementUpdater.java | 2 +-
...baseDiscoveryHeartbeatStatementUpdaterTest.java | 4 +-
...pDatabaseDiscoveryRuleStatementUpdaterTest.java | 2 +-
.../antlr4/imports/db-discovery/RDLStatement.g4 | 8 +-
.../DatabaseDiscoveryDistSQLStatementVisitor.java | 6 +-
.../DropDatabaseDiscoveryHeartbeatStatement.java | 4 +-
.../DropDatabaseDiscoveryRuleStatement.java | 4 +-
.../DropDatabaseDiscoveryTypeStatement.java | 4 +-
.../update/DropEncryptRuleStatementUpdater.java | 2 +-
.../DropEncryptRuleStatementUpdaterTest.java | 4 +-
.../main/antlr4/imports/encrypt/RDLStatement.g4 | 4 +-
.../core/EncryptDistSQLStatementVisitor.java | 2 +-
.../parser/statement/DropEncryptRuleStatement.java | 4 +-
...DropReadwriteSplittingRuleStatementUpdater.java | 4 +-
.../imports/readwrite-splitting/RDLStatement.g4 | 4 +-
.../ReadwriteSplittingDistSQLStatementVisitor.java | 2 +-
.../DropReadwriteSplittingRuleStatement.java | 4 +-
...DropDefaultShadowAlgorithmStatementUpdater.java | 4 +-
.../DropShadowAlgorithmStatementUpdater.java | 4 +-
.../update/DropShadowRuleStatementUpdater.java | 4 +-
.../DropShadowAlgorithmStatementUpdaterTest.java | 4 +-
.../update/DropShadowRuleStatementUpdaterTest.java | 4 +-
.../src/main/antlr4/imports/shadow/RDLStatement.g4 | 8 +-
.../parser/core/ShadowDistSQLStatementVisitor.java | 6 +-
.../DropDefaultShadowAlgorithmStatement.java | 4 +-
.../statement/DropShadowAlgorithmStatement.java | 4 +-
.../parser/statement/DropShadowRuleStatement.java | 4 +-
.../ShardingCreateTableStatementValidator.java | 2 +-
.../impl/ShardingDropIndexStatementValidator.java | 2 +-
.../impl/ShardingDropTableStatementValidator.java | 2 +-
.../DropShardingScalingRuleStatementUpdater.java | 4 +-
.../DropDefaultStrategyStatementUpdater.java | 4 +-
.../DropShardingAlgorithmStatementUpdater.java | 4 +-
...opShardingBindingTableRuleStatementUpdater.java | 4 +-
...ShardingBroadcastTableRuleStatementUpdater.java | 4 +-
.../DropShardingKeyGeneratorStatementUpdater.java | 4 +-
.../DropShardingTableRuleStatementUpdater.java | 4 +-
...ardingBindingTableRuleStatementUpdaterTest.java | 4 +-
...dingBroadcastTableRuleStatementUpdaterTest.java | 7 +-
.../main/antlr4/imports/scaling/RDLStatement.g4 | 4 +-
.../src/main/antlr4/imports/sharding/BaseRule.g4 | 2 +-
.../main/antlr4/imports/sharding/RDLStatement.g4 | 14 +-
.../parser/core/ScalingSQLStatementVisitor.java | 2 +-
.../core/ShardingDistSQLStatementVisitor.java | 12 +-
.../DropShardingScalingRuleStatement.java | 4 +-
.../DropDefaultShardingStrategyStatement.java | 4 +-
.../statement/DropShardingAlgorithmStatement.java | 4 +-
.../DropShardingBindingTableRulesStatement.java | 4 +-
.../DropShardingBroadcastTableRulesStatement.java | 4 +-
.../DropShardingKeyGeneratorStatement.java | 4 +-
.../statement/DropShardingTableRuleStatement.java | 4 +-
.../database/CreateDatabaseBackendHandler.java | 2 +-
.../text/database/DropDatabaseBackendHandler.java | 2 +-
.../common/updatable/DropTrafficRuleHandler.java | 2 +-
.../rdl/resource/DropResourceBackendHandler.java | 2 +-
...DropDefaultSingleTableRuleStatementUpdater.java | 2 +-
.../database/CreateDatabaseBackendHandlerTest.java | 2 +-
.../database/DropDatabaseBackendHandlerTest.java | 2 +-
.../updatable/DropTrafficRuleHandlerTest.java | 6 +-
.../src/main/antlr4/imports/mysql/BaseRule.g4 | 4 +-
.../src/main/antlr4/imports/mysql/DALStatement.g4 | 4 +-
.../src/main/antlr4/imports/mysql/DCLStatement.g4 | 14 +-
.../src/main/antlr4/imports/mysql/DDLStatement.g4 | 26 ++--
.../impl/MySQLDALStatementSQLVisitor.java | 2 +-
.../impl/MySQLDDLStatementSQLVisitor.java | 8 +-
.../src/main/antlr4/imports/opengauss/BaseRule.g4 | 4 +-
.../main/antlr4/imports/opengauss/DCLStatement.g4 | 6 +-
.../main/antlr4/imports/opengauss/DDLStatement.g4 | 146 ++++++++++-----------
.../impl/OpenGaussDDLStatementSQLVisitor.java | 8 +-
.../src/main/antlr4/imports/postgresql/BaseRule.g4 | 8 +-
.../main/antlr4/imports/postgresql/DCLStatement.g4 | 6 +-
.../main/antlr4/imports/postgresql/DDLStatement.g4 | 142 ++++++++++----------
.../impl/PostgreSQLDDLStatementSQLVisitor.java | 8 +-
.../src/main/antlr4/imports/sqlserver/BaseRule.g4 | 4 +
.../main/antlr4/imports/sqlserver/DCLStatement.g4 | 4 +-
.../main/antlr4/imports/sqlserver/DDLStatement.g4 | 26 ++--
.../impl/SQLServerDDLStatementSQLVisitor.java | 4 +-
.../sql/common/extractor/TableExtractor.java | 2 +-
.../statement/ddl/CreateDatabaseStatement.java | 2 +-
.../statement/ddl/DropDatabaseStatement.java | 2 +-
.../handler/ddl/CreateTableStatementHandler.java | 12 +-
.../handler/ddl/DropIndexStatementHandler.java | 8 +-
.../handler/ddl/DropTableStatementHandler.java | 14 +-
.../mysql/dal/MySQLResetPersistStatement.java | 2 +-
.../mysql/ddl/MySQLCreateTableStatement.java | 2 +-
.../mysql/ddl/MySQLDropTableStatement.java | 2 +-
.../ddl/OpenGaussCreateTableStatement.java | 2 +-
.../opengauss/ddl/OpenGaussDropIndexStatement.java | 2 +-
.../opengauss/ddl/OpenGaussDropTableStatement.java | 2 +-
.../ddl/PostgreSQLCreateTableStatement.java | 2 +-
.../ddl/PostgreSQLDropIndexStatement.java | 2 +-
.../ddl/PostgreSQLDropTableStatement.java | 2 +-
.../sqlserver/ddl/SQLServerDropIndexStatement.java | 2 +-
.../sqlserver/ddl/SQLServerDropTableStatement.java | 2 +-
.../ddl/CreateTableStatementHandlerTest.java | 28 ++--
.../handler/ddl/DropTableStatementHandlerTest.java | 32 ++---
.../dal/impl/MySQLResetPersistStatementAssert.java | 2 +-
.../rdl/drop/DropResourceStatementAssert.java | 2 +-
...pDatabaseDiscoveryHeartbeatStatementAssert.java | 2 +-
.../DropDatabaseDiscoveryTypeStatementAssert.java | 2 +-
...DropDefaultShardingStrategyStatementAssert.java | 2 +-
.../impl/DropDefaultSingleTableRuleAssert.java | 2 +-
.../DropReadwriteSplittingRuleStatementAssert.java | 2 +-
.../impl/DropShadowAlgorithmStatementAssert.java | 2 +-
.../drop/impl/DropShadowRuleStatementAssert.java | 2 +-
.../impl/DropShardingAlgorithmStatementAssert.java | 2 +-
...opShardingBindingTableRulesStatementAssert.java | 2 +-
...ShardingBroadcastTableRulesStatementAssert.java | 2 +-
.../DropShardingKeyGeneratorStatementAssert.java | 2 +-
.../DropShardingScalingRuleStatementAssert.java | 2 +-
.../impl/DropShardingTableRuleStatementAssert.java | 2 +-
.../statement/DropRuleStatementTestCase.java | 4 +-
.../dal/ResetPersistStatementTestCase.java | 6 +-
...ataBaseDiscoveryHeartbeatStatementTestCase.java | 4 +-
...DropDataBaseDiscoveryRuleStatementTestCase.java | 4 +-
...DropDataBaseDiscoveryTypeStatementTestCase.java | 4 +-
...ropDefaultSingleTableRuleStatementTestCase.java | 4 +-
.../rdl/drop/DropEncryptRuleStatementTestCase.java | 4 +-
.../rdl/drop/DropResourceStatementTestCase.java | 4 +-
.../drop/DropShadowAlgorithmStatementTestCase.java | 4 +-
.../rdl/drop/DropShadowRuleStatementTestCase.java | 4 +-
.../src/main/resources/case/dal/reset.xml | 2 +-
.../src/main/resources/case/rdl/drop.xml | 34 ++---
.../src/main/resources/sql/supported/rdl/drop.xml | 2 +-
132 files changed, 464 insertions(+), 459 deletions(-)
diff --git a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RDLStatement.g4 b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RDLStatement.g4
index 55d26aacd14..a2d15167cfd 100644
--- a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RDLStatement.g4
+++ b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/antlr4/imports/RDLStatement.g4
@@ -28,7 +28,7 @@ alterResource
;
dropResource
- : DROP RESOURCE existClause? IDENTIFIER (COMMA IDENTIFIER)* ignoreSingleTables?
+ : DROP RESOURCE ifExists? IDENTIFIER (COMMA IDENTIFIER)* ignoreSingleTables?
;
createDefaultSingleTableRule
@@ -40,7 +40,7 @@ alterDefaultSingleTableRule
;
dropDefaultSingleTableRule
- : DROP DEFAULT SINGLE TABLE RULE existClause?
+ : DROP DEFAULT SINGLE TABLE RULE ifExists?
;
dataSource
@@ -87,6 +87,6 @@ ignoreSingleTables
: IGNORE SINGLE TABLES
;
-existClause
+ifExists
: IF EXISTS
;
diff --git a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLStatementVisitor.java b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLStatementVisitor.java
index cb24b232495..7fbd104a210 100644
--- a/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLStatementVisitor.java
+++ b/shardingsphere-distsql/shardingsphere-distsql-parser/src/main/java/org/apache/shardingsphere/distsql/parser/core/common/CommonDistSQLStatementVisitor.java
@@ -237,7 +237,7 @@ public final class CommonDistSQLStatementVisitor extends CommonDistSQLStatementB
@Override
public ASTNode visitDropDefaultSingleTableRule(final DropDefaultSingleTableRuleContext ctx) {
- return new DropDefaultSingleTableRuleStatement(null != ctx.existClause());
+ return new DropDefaultSingleTableRuleStatement(null != ctx.ifExists());
}
private Properties getProperties(final PropertiesDefinitionContext ctx) {
@@ -254,7 +254,7 @@ public final class CommonDistSQLStatementVisitor extends CommonDistSQLStatementB
@Override
public ASTNode visitDropResource(final DropResourceContext ctx) {
boolean ignoreSingleTables = null != ctx.ignoreSingleTables();
- return new DropResourceStatement(ctx.existClause() != null,
+ return new DropResourceStatement(ctx.ifExists() != null,
ctx.IDENTIFIER().stream().map(ParseTree::getText).map(each -> new IdentifierValue(each).getValue()).collect(Collectors.toList()), ignoreSingleTables);
}
@@ -337,7 +337,7 @@ public final class CommonDistSQLStatementVisitor extends CommonDistSQLStatementB
@Override
public ASTNode visitDropTrafficRule(final DropTrafficRuleContext ctx) {
Collection<String> ruleNames = null == ctx.ruleName() ? null : ctx.ruleName().stream().map(this::getIdentifierValue).collect(Collectors.toSet());
- return new DropTrafficRuleStatement(ruleNames, null != ctx.ifExists());
+ return new DropTrafficRuleStatement(null != ctx.ifExists(), ruleNames);
}
@Override
diff --git a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/common/updatable/DropTrafficRuleStatement.java b/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/common/updatable/DropTrafficRuleStatement.java
index 1e6f8fbd57a..5c679302928 100644
--- a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/common/updatable/DropTrafficRuleStatement.java
+++ b/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/ral/common/updatable/DropTrafficRuleStatement.java
@@ -30,7 +30,7 @@ import java.util.Collection;
@Getter
public final class DropTrafficRuleStatement extends UpdatableRALStatement {
- private final Collection<String> ruleNames;
+ private final boolean ifExists;
- private final boolean ifExist;
+ private final Collection<String> ruleNames;
}
diff --git a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropDefaultSingleTableRuleStatement.java b/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropDefaultSingleTableRuleStatement.java
index e72ea980e13..cba05c0bf3e 100644
--- a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropDefaultSingleTableRuleStatement.java
+++ b/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropDefaultSingleTableRuleStatement.java
@@ -25,7 +25,7 @@ import lombok.NoArgsConstructor;
@NoArgsConstructor
public final class DropDefaultSingleTableRuleStatement extends DropRuleStatement {
- public DropDefaultSingleTableRuleStatement(final boolean ifExist) {
- super(ifExist);
+ public DropDefaultSingleTableRuleStatement(final boolean ifExists) {
+ super(ifExists);
}
}
diff --git a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropResourceStatement.java b/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropResourceStatement.java
index 4032c83a0a5..f4a0ce8fa71 100644
--- a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropResourceStatement.java
+++ b/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropResourceStatement.java
@@ -30,14 +30,14 @@ import java.util.Collection;
@Getter
public final class DropResourceStatement extends ResourceDefinitionStatement {
- private final boolean ifExist;
+ private final boolean ifExists;
private final Collection<String> names;
private final boolean ignoreSingleTables;
public DropResourceStatement(final Collection<String> names, final boolean ignoreSingleTables) {
- this.ifExist = false;
+ this.ifExists = false;
this.names = names;
this.ignoreSingleTables = ignoreSingleTables;
}
diff --git a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropRuleStatement.java b/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropRuleStatement.java
index f808779c652..af9ccbed96c 100644
--- a/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropRuleStatement.java
+++ b/shardingsphere-distsql/shardingsphere-distsql-statement/src/main/java/org/apache/shardingsphere/distsql/parser/statement/rdl/drop/DropRuleStatement.java
@@ -28,7 +28,7 @@ import org.apache.shardingsphere.distsql.parser.statement.rdl.RuleDefinitionStat
@Getter
public abstract class DropRuleStatement extends RuleDefinitionStatement {
- private final boolean ifExist;
+ private final boolean ifExists;
public DropRuleStatement() {
this(false);
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryHeartbeatStatementUpdater.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabase [...]
index a7833fe84bb..e1bd2bc4ad9 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryHeartbeatStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryHeartbeatStatementUpdater.java
@@ -46,7 +46,7 @@ public final class DropDatabaseDiscoveryHeartbeatStatementUpdater implements Rul
private void checkCurrentRuleConfiguration(final String databaseName,
final DropDatabaseDiscoveryHeartbeatStatement sqlStatement, final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
- if (sqlStatement.isIfExist()) {
+ if (sqlStatement.isIfExists()) {
return;
}
DistSQLException.predictionThrow(null != currentRuleConfig, () -> new RequiredRuleMissedException(RULE_TYPE, databaseName));
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDisco [...]
index 3a5ccdc94ea..6e824d7cb61 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryRuleStatementUpdater.java
@@ -54,7 +54,7 @@ public final class DropDatabaseDiscoveryRuleStatementUpdater implements RuleDefi
private void checkCurrentRuleConfiguration(final String databaseName, final DropDatabaseDiscoveryRuleStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
- if (sqlStatement.isIfExist()) {
+ if (sqlStatement.isIfExists()) {
return;
}
DistSQLException.predictionThrow(null != currentRuleConfig, () -> new RequiredRuleMissedException(RULE_TYPE, databaseName));
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryTypeStatementUpdater.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDisco [...]
index 8691545eafe..f35f9f7bf28 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryTypeStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryTypeStatementUpdater.java
@@ -46,7 +46,7 @@ public final class DropDatabaseDiscoveryTypeStatementUpdater implements RuleDefi
private void checkCurrentRuleConfiguration(final String databaseName, final DropDatabaseDiscoveryTypeStatement sqlStatement,
final DatabaseDiscoveryRuleConfiguration currentRuleConfig) throws DistSQLException {
- if (sqlStatement.isIfExist()) {
+ if (sqlStatement.isIfExists()) {
return;
}
DistSQLException.predictionThrow(null != currentRuleConfig, () -> new RequiredRuleMissedException(RULE_TYPE, databaseName));
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryHeartbeatStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropData [...]
index 654110e5d91..cce5ae3cc61 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryHeartbeatStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryHeartbeatStatementUpdaterTest.java
@@ -84,11 +84,11 @@ public final class DropDatabaseDiscoveryHeartbeatStatementUpdaterTest {
}
private DropDatabaseDiscoveryHeartbeatStatement createSQLStatement() {
- return new DropDatabaseDiscoveryHeartbeatStatement(Collections.singleton("heartbeat_name"), false);
+ return new DropDatabaseDiscoveryHeartbeatStatement(false, Collections.singleton("heartbeat_name"));
}
private DropDatabaseDiscoveryHeartbeatStatement createSQLStatementWithIfExists() {
- return new DropDatabaseDiscoveryHeartbeatStatement(Collections.singleton("heartbeat_name_0"), true);
+ return new DropDatabaseDiscoveryHeartbeatStatement(true, Collections.singleton("heartbeat_name_0"));
}
private DatabaseDiscoveryRuleConfiguration createCurrentRuleConfiguration() {
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseD [...]
index 67d5aee7887..8625510cf2a 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-handler/src/test/java/org/apache/shardingsphere/dbdiscovery/distsql/handler/update/DropDatabaseDiscoveryRuleStatementUpdaterTest.java
@@ -133,7 +133,7 @@ public final class DropDatabaseDiscoveryRuleStatementUpdaterTest {
}
private DropDatabaseDiscoveryRuleStatement createSQLStatementWithIfExists() {
- return new DropDatabaseDiscoveryRuleStatement(Collections.singleton("ha_group_0"), true);
+ return new DropDatabaseDiscoveryRuleStatement(true, Collections.singleton("ha_group_0"));
}
private DatabaseDiscoveryRuleConfiguration createCurrentRuleConfiguration() {
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-parser/src/main/antlr4/imports/db-discovery/RDLStatement.g4 b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-parser/src/main/antlr4/imports/db-discovery/RDLStatement.g4
index 51215267d3f..48f4323b5df 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-parser/src/main/antlr4/imports/db-discovery/RDLStatement.g4
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-parser/src/main/antlr4/imports/db-discovery/RDLStatement.g4
@@ -28,7 +28,7 @@ alterDatabaseDiscoveryRule
;
dropDatabaseDiscoveryRule
- : DROP DB_DISCOVERY RULE existClause? ruleName (COMMA ruleName)*
+ : DROP DB_DISCOVERY RULE ifExists? ruleName (COMMA ruleName)*
;
createDatabaseDiscoveryType
@@ -40,7 +40,7 @@ alterDatabaseDiscoveryType
;
dropDatabaseDiscoveryType
- : DROP DB_DISCOVERY TYPE existClause? discoveryTypeName (COMMA discoveryTypeName)*
+ : DROP DB_DISCOVERY TYPE ifExists? discoveryTypeName (COMMA discoveryTypeName)*
;
createDatabaseDiscoveryHeartbeat
@@ -52,7 +52,7 @@ alterDatabaseDiscoveryHeartbeat
;
dropDatabaseDiscoveryHeartbeat
- : DROP DB_DISCOVERY HEARTBEAT existClause? discoveryHeartbeatName (COMMA discoveryHeartbeatName)*
+ : DROP DB_DISCOVERY HEARTBEAT ifExists? discoveryHeartbeatName (COMMA discoveryHeartbeatName)*
;
databaseDiscoveryRule
@@ -111,6 +111,6 @@ discoveryHeartbeatName
: IDENTIFIER
;
-existClause
+ifExists
: IF EXISTS
;
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-parser/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/parser/core/DatabaseDiscoveryDistSQLStatementVisitor.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-parser/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/parser/core/DatabaseDiscoveryDistSQLSt [...]
index f710152258d..d8be660e7ef 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-parser/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/parser/core/DatabaseDiscoveryDistSQLStatementVisitor.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-parser/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/parser/core/DatabaseDiscoveryDistSQLStatementVisitor.java
@@ -111,7 +111,7 @@ public final class DatabaseDiscoveryDistSQLStatementVisitor extends DatabaseDisc
@Override
public ASTNode visitDropDatabaseDiscoveryRule(final DropDatabaseDiscoveryRuleContext ctx) {
- return new DropDatabaseDiscoveryRuleStatement(ctx.ruleName().stream().map(this::getIdentifierValue).collect(Collectors.toList()), null != ctx.existClause());
+ return new DropDatabaseDiscoveryRuleStatement(null != ctx.ifExists(), ctx.ruleName().stream().map(this::getIdentifierValue).collect(Collectors.toList()));
}
@Override
@@ -179,12 +179,12 @@ public final class DatabaseDiscoveryDistSQLStatementVisitor extends DatabaseDisc
@Override
public ASTNode visitDropDatabaseDiscoveryType(final DropDatabaseDiscoveryTypeContext ctx) {
- return new DropDatabaseDiscoveryTypeStatement(null != ctx.existClause(), ctx.discoveryTypeName().stream().map(this::getIdentifierValue).collect(Collectors.toList()));
+ return new DropDatabaseDiscoveryTypeStatement(null != ctx.ifExists(), ctx.discoveryTypeName().stream().map(this::getIdentifierValue).collect(Collectors.toList()));
}
@Override
public ASTNode visitDropDatabaseDiscoveryHeartbeat(final DropDatabaseDiscoveryHeartbeatContext ctx) {
- return new DropDatabaseDiscoveryHeartbeatStatement(ctx.discoveryHeartbeatName().stream().map(this::getIdentifierValue).collect(Collectors.toList()), null != ctx.existClause());
+ return new DropDatabaseDiscoveryHeartbeatStatement(null != ctx.ifExists(), ctx.discoveryHeartbeatName().stream().map(this::getIdentifierValue).collect(Collectors.toList()));
}
private Properties getProperties(final PropertiesContext ctx) {
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-statement/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/parser/statement/DropDatabaseDiscoveryHeartbeatStatement.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-statement/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/parser/statement/DropDatabas [...]
index b744aa575dd..a131a5f41e8 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-statement/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/parser/statement/DropDatabaseDiscoveryHeartbeatStatement.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-statement/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/parser/statement/DropDatabaseDiscoveryHeartbeatStatement.java
@@ -30,8 +30,8 @@ public final class DropDatabaseDiscoveryHeartbeatStatement extends DropRuleState
private final Collection<String> heartbeatNames;
- public DropDatabaseDiscoveryHeartbeatStatement(final Collection<String> heartbeatNames, final boolean ifExist) {
- super(ifExist);
+ public DropDatabaseDiscoveryHeartbeatStatement(final boolean ifExists, final Collection<String> heartbeatNames) {
+ super(ifExists);
this.heartbeatNames = heartbeatNames;
}
}
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-statement/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/parser/statement/DropDatabaseDiscoveryRuleStatement.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-statement/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/parser/statement/DropDatabaseDisc [...]
index f10b299af19..08f42e41d8f 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-statement/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/parser/statement/DropDatabaseDiscoveryRuleStatement.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-statement/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/parser/statement/DropDatabaseDiscoveryRuleStatement.java
@@ -32,8 +32,8 @@ public final class DropDatabaseDiscoveryRuleStatement extends DropRuleStatement
private final Collection<String> ruleNames;
- public DropDatabaseDiscoveryRuleStatement(final Collection<String> ruleNames, final boolean ifExist) {
- super(ifExist);
+ public DropDatabaseDiscoveryRuleStatement(final boolean ifExists, final Collection<String> ruleNames) {
+ super(ifExists);
this.ruleNames = ruleNames;
}
}
diff --git a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-statement/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/parser/statement/DropDatabaseDiscoveryTypeStatement.java b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-statement/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/parser/statement/DropDatabaseDisc [...]
index e74066b01e5..eb53e50650d 100644
--- a/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-statement/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/parser/statement/DropDatabaseDiscoveryTypeStatement.java
+++ b/shardingsphere-features/shardingsphere-db-discovery/shardingsphere-db-discovery-distsql/shardingsphere-db-discovery-distsql-statement/src/main/java/org/apache/shardingsphere/dbdiscovery/distsql/parser/statement/DropDatabaseDiscoveryTypeStatement.java
@@ -30,8 +30,8 @@ public final class DropDatabaseDiscoveryTypeStatement extends DropRuleStatement
private final Collection<String> types;
- public DropDatabaseDiscoveryTypeStatement(final boolean ifExist, final Collection<String> types) {
- super(ifExist);
+ public DropDatabaseDiscoveryTypeStatement(final boolean ifExists, final Collection<String> types) {
+ super(ifExists);
this.types = types;
}
}
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdater.java
index c67fbd2fd22..e0e81a898f0 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/main/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdater.java
@@ -41,7 +41,7 @@ public final class DropEncryptRuleStatementUpdater implements RuleDefinitionDrop
private void checkToBeDroppedEncryptTableNames(final String databaseName, final DropEncryptRuleStatement sqlStatement,
final EncryptRuleConfiguration currentRuleConfig) throws DistSQLException {
- if (sqlStatement.isIfExist()) {
+ if (sqlStatement.isIfExists()) {
return;
}
DistSQLException.predictionThrow(isExistRuleConfig(currentRuleConfig), () -> new RequiredRuleMissedException("Encrypt", databaseName));
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdaterTest.java
index ab0590ce2d0..386126dd912 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-handler/src/test/java/org/apache/shardingsphere/encrypt/distsql/handler/update/DropEncryptRuleStatementUpdaterTest.java
@@ -89,8 +89,8 @@ public final class DropEncryptRuleStatementUpdaterTest {
return new DropEncryptRuleStatement(false, Collections.singleton(tableName));
}
- private DropEncryptRuleStatement createSQLStatement(final boolean containsExistClause, final String tableName) {
- return new DropEncryptRuleStatement(containsExistClause, Collections.singleton(tableName));
+ private DropEncryptRuleStatement createSQLStatement(final boolean ifExists, final String tableName) {
+ return new DropEncryptRuleStatement(ifExists, Collections.singleton(tableName));
}
private EncryptRuleConfiguration createCurrentRuleConfiguration() {
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-parser/src/main/antlr4/imports/encrypt/RDLStatement.g4 b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-parser/src/main/antlr4/imports/encrypt/RDLStatement.g4
index 0713e64fffd..b2cd1f0ea03 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-parser/src/main/antlr4/imports/encrypt/RDLStatement.g4
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-parser/src/main/antlr4/imports/encrypt/RDLStatement.g4
@@ -28,7 +28,7 @@ alterEncryptRule
;
dropEncryptRule
- : DROP ENCRYPT RULE existClause? tableName (COMMA tableName)*
+ : DROP ENCRYPT RULE ifExists? tableName (COMMA tableName)*
;
encryptRuleDefinition
@@ -103,6 +103,6 @@ queryWithCipherColumn
: TRUE | FALSE
;
-existClause
+ifExists
: IF EXISTS
;
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/core/EncryptDistSQLStatementVisitor.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/core/EncryptDistSQLStatementVisitor.java
index 4f39fcc2676..ce7388900cd 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/core/EncryptDistSQLStatementVisitor.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-parser/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/core/EncryptDistSQLStatementVisitor.java
@@ -64,7 +64,7 @@ public final class EncryptDistSQLStatementVisitor extends EncryptDistSQLStatemen
@Override
public ASTNode visitDropEncryptRule(final DropEncryptRuleContext ctx) {
- return new DropEncryptRuleStatement(null != ctx.existClause(), ctx.tableName().stream().map(this::getIdentifierValue).collect(Collectors.toList()));
+ return new DropEncryptRuleStatement(null != ctx.ifExists(), ctx.tableName().stream().map(this::getIdentifierValue).collect(Collectors.toList()));
}
@Override
diff --git a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-statement/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/statement/DropEncryptRuleStatement.java b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-statement/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/statement/DropEncryptRuleStatement.java
index a4d5b93fa1d..34e91ea18f3 100644
--- a/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-statement/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/statement/DropEncryptRuleStatement.java
+++ b/shardingsphere-features/shardingsphere-encrypt/shardingsphere-encrypt-distsql/shardingsphere-encrypt-distsql-statement/src/main/java/org/apache/shardingsphere/encrypt/distsql/parser/statement/DropEncryptRuleStatement.java
@@ -30,8 +30,8 @@ public final class DropEncryptRuleStatement extends DropRuleStatement {
private final Collection<String> tables;
- public DropEncryptRuleStatement(final boolean ifExist, final Collection<String> tables) {
- super(ifExist);
+ public DropEncryptRuleStatement(final boolean ifExists, final Collection<String> tables) {
+ super(ifExists);
this.tables = tables;
}
}
diff --git a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/DropReadwriteSplittingRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/re [...]
index f74f2c28bc3..edc2fa17eda 100644
--- a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/DropReadwriteSplittingRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/update/DropReadwriteSplittingRuleStatementUpdater.java
@@ -40,7 +40,7 @@ public final class DropReadwriteSplittingRuleStatementUpdater implements RuleDef
@Override
public void checkSQLStatement(final ShardingSphereDatabase database, final DropReadwriteSplittingRuleStatement sqlStatement,
final ReadwriteSplittingRuleConfiguration currentRuleConfig) throws RuleDefinitionViolationException {
- if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isIfExist()) {
+ if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isIfExists()) {
return;
}
String databaseName = database.getName();
@@ -57,7 +57,7 @@ public final class DropReadwriteSplittingRuleStatementUpdater implements RuleDef
private void checkToBeDroppedRuleNames(final String databaseName, final DropReadwriteSplittingRuleStatement sqlStatement,
final ReadwriteSplittingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
- if (sqlStatement.isIfExist()) {
+ if (sqlStatement.isIfExists()) {
return;
}
Collection<String> currentRuleNames = currentRuleConfig.getDataSources().stream().map(ReadwriteSplittingDataSourceRuleConfiguration::getName).collect(Collectors.toList());
diff --git a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-parser/src/main/antlr4/imports/readwrite-splitting/RDLStatement.g4 b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-parser/src/main/antlr4/imports/readwrite-splitting/RDLStatement.g4
index ebfebeafbc2..52118956249 100644
--- a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-parser/src/main/antlr4/imports/readwrite-splitting/RDLStatement.g4
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-parser/src/main/antlr4/imports/readwrite-splitting/RDLStatement.g4
@@ -28,7 +28,7 @@ alterReadwriteSplittingRule
;
dropReadwriteSplittingRule
- : DROP READWRITE_SPLITTING RULE existClause? ruleName (COMMA ruleName)*
+ : DROP READWRITE_SPLITTING RULE ifExists? ruleName (COMMA ruleName)*
;
readwriteSplittingRuleDefinition
@@ -71,6 +71,6 @@ algorithmProperty
: key=(IDENTIFIER | STRING) EQ value=(NUMBER | INT | STRING)
;
-existClause
+ifExists
: IF EXISTS
;
diff --git a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-parser/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingDistSQLStatementVisitor.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-parser/src/main/java/org/apache/shardingsphere/readwrit [...]
index a9e2c4772ed..b2b81794428 100644
--- a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-parser/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingDistSQLStatementVisitor.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-parser/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/core/ReadwriteSplittingDistSQLStatementVisitor.java
@@ -71,7 +71,7 @@ public final class ReadwriteSplittingDistSQLStatementVisitor extends ReadwriteSp
@Override
public ASTNode visitDropReadwriteSplittingRule(final DropReadwriteSplittingRuleContext ctx) {
- return new DropReadwriteSplittingRuleStatement(ctx.existClause() != null, ctx.ruleName().stream().map(this::getIdentifierValue).collect(Collectors.toList()));
+ return new DropReadwriteSplittingRuleStatement(ctx.ifExists() != null, ctx.ruleName().stream().map(this::getIdentifierValue).collect(Collectors.toList()));
}
@Override
diff --git a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-statement/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/statement/DropReadwriteSplittingRuleStatement.java b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-statement/src/main/java/org/apache/shardingsphere/rea [...]
index 2940721120a..c41af2d4a28 100644
--- a/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-statement/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/statement/DropReadwriteSplittingRuleStatement.java
+++ b/shardingsphere-features/shardingsphere-readwrite-splitting/shardingsphere-readwrite-splitting-distsql/shardingsphere-readwrite-splitting-distsql-statement/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/parser/statement/DropReadwriteSplittingRuleStatement.java
@@ -30,8 +30,8 @@ public final class DropReadwriteSplittingRuleStatement extends DropRuleStatement
private final Collection<String> ruleNames;
- public DropReadwriteSplittingRuleStatement(final boolean ifExist, final Collection<String> ruleNames) {
- super(ifExist);
+ public DropReadwriteSplittingRuleStatement(final boolean ifExists, final Collection<String> ruleNames) {
+ super(ifExists);
this.ruleNames = ruleNames;
}
}
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropDefaultShadowAlgorithmStatementUpdater.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropDefaultShadowAlgorithmStatementUpdater.java
index b0570c958c4..67251fca8cb 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropDefaultShadowAlgorithmStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropDefaultShadowAlgorithmStatementUpdater.java
@@ -38,7 +38,7 @@ public final class DropDefaultShadowAlgorithmStatementUpdater implements RuleDef
@Override
public void checkSQLStatement(final ShardingSphereDatabase database, final DropDefaultShadowAlgorithmStatement sqlStatement,
final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
- if (sqlStatement.isIfExist() && !isExistRuleConfig(currentRuleConfig)) {
+ if (sqlStatement.isIfExists() && !isExistRuleConfig(currentRuleConfig)) {
return;
}
checkConfigurationExist(database.getName(), currentRuleConfig);
@@ -50,7 +50,7 @@ public final class DropDefaultShadowAlgorithmStatementUpdater implements RuleDef
}
private void checkAlgorithm(final String databaseName, final DropDefaultShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
- if (!sqlStatement.isIfExist()) {
+ if (!sqlStatement.isIfExists()) {
DistSQLException.predictionThrow(null != currentRuleConfig.getDefaultShadowAlgorithmName(), () -> new RequiredAlgorithmMissedException(
SHADOW, databaseName, Collections.singleton("default")));
}
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowAlgorithmStatementUpdater.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowAlgorithmStatementUpdater.java
index f18c32fc662..414bdfe3529 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowAlgorithmStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowAlgorithmStatementUpdater.java
@@ -45,7 +45,7 @@ public final class DropShadowAlgorithmStatementUpdater implements RuleDefinition
@Override
public void checkSQLStatement(final ShardingSphereDatabase database, final DropShadowAlgorithmStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
- if (sqlStatement.isIfExist() && !isExistRuleConfig(currentRuleConfig)) {
+ if (sqlStatement.isIfExists() && !isExistRuleConfig(currentRuleConfig)) {
return;
}
checkConfigurationExist(database.getName(), currentRuleConfig);
@@ -60,7 +60,7 @@ public final class DropShadowAlgorithmStatementUpdater implements RuleDefinition
Collection<String> currentAlgorithms = ShadowRuleStatementSupporter.getAlgorithmNames(currentRuleConfig);
Collection<String> requireAlgorithms = sqlStatement.getAlgorithmNames();
String defaultShadowAlgorithmName = currentRuleConfig.getDefaultShadowAlgorithmName();
- if (!sqlStatement.isIfExist()) {
+ if (!sqlStatement.isIfExists()) {
ShadowRuleStatementChecker.checkAlgorithmExist(requireAlgorithms, currentAlgorithms, different -> new RequiredAlgorithmMissedException(SHADOW, databaseName, different));
}
checkAlgorithmInUsed(requireAlgorithms, getAlgorithmInUse(currentRuleConfig), identical -> new AlgorithmInUsedException(databaseName, identical));
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowRuleStatementUpdater.java
index e20597a93b1..13c4d650d34 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/update/DropShadowRuleStatementUpdater.java
@@ -37,7 +37,7 @@ public final class DropShadowRuleStatementUpdater implements RuleDefinitionDropU
@Override
public void checkSQLStatement(final ShardingSphereDatabase database,
final DropShadowRuleStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
- if (sqlStatement.isIfExist() && !isExistRuleConfig(currentRuleConfig)) {
+ if (sqlStatement.isIfExists() && !isExistRuleConfig(currentRuleConfig)) {
return;
}
checkConfigurationExist(database.getName(), currentRuleConfig);
@@ -50,7 +50,7 @@ public final class DropShadowRuleStatementUpdater implements RuleDefinitionDropU
private void checkRuleNames(final String databaseName, final DropShadowRuleStatement sqlStatement, final ShadowRuleConfiguration currentRuleConfig) throws DistSQLException {
Collection<String> currentRuleNames = currentRuleConfig.getDataSources().keySet();
- if (!sqlStatement.isIfExist()) {
+ if (!sqlStatement.isIfExists()) {
ShadowRuleStatementChecker.checkRulesExist(sqlStatement.getRuleNames(), currentRuleNames, different -> new RequiredRuleMissedException(SHADOW, databaseName, different));
}
}
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowAlgorithmStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowAlgorithmStatementUpdaterTest.java
index 918e31ac11e..adbbf0cde62 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowAlgorithmStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowAlgorithmStatementUpdaterTest.java
@@ -70,7 +70,7 @@ public final class DropShadowAlgorithmStatementUpdaterTest {
return new DropShadowAlgorithmStatement(false, Arrays.asList(ruleName));
}
- private DropShadowAlgorithmStatement createSQLStatement(final boolean ifExist, final String... ruleName) {
- return new DropShadowAlgorithmStatement(ifExist, Arrays.asList(ruleName));
+ private DropShadowAlgorithmStatement createSQLStatement(final boolean ifExists, final String... ruleName) {
+ return new DropShadowAlgorithmStatement(ifExists, Arrays.asList(ruleName));
}
}
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowRuleStatementUpdaterTest.java
index 791e4d6755c..f62c414691a 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/update/DropShadowRuleStatementUpdaterTest.java
@@ -85,7 +85,7 @@ public final class DropShadowRuleStatementUpdaterTest {
return new DropShadowRuleStatement(false, Arrays.asList(ruleName));
}
- private DropShadowRuleStatement createSQLStatement(final boolean ifExist, final String... ruleName) {
- return new DropShadowRuleStatement(ifExist, Arrays.asList(ruleName));
+ private DropShadowRuleStatement createSQLStatement(final boolean ifExists, final String... ruleName) {
+ return new DropShadowRuleStatement(ifExists, Arrays.asList(ruleName));
}
}
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-parser/src/main/antlr4/imports/shadow/RDLStatement.g4 b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-parser/src/main/antlr4/imports/shadow/RDLStatement.g4
index 2fbbb868062..920a870df63 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-parser/src/main/antlr4/imports/shadow/RDLStatement.g4
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-parser/src/main/antlr4/imports/shadow/RDLStatement.g4
@@ -28,7 +28,7 @@ alterShadowRule
;
dropShadowRule
- : DROP SHADOW RULE existClause? ruleName (COMMA ruleName)*
+ : DROP SHADOW RULE ifExists? ruleName (COMMA ruleName)*
;
createShadowAlgorithm
@@ -40,7 +40,7 @@ alterShadowAlgorithm
;
dropShadowAlgorithm
- : DROP SHADOW ALGORITHM existClause? algorithmName (COMMA algorithmName)*
+ : DROP SHADOW ALGORITHM ifExists? algorithmName (COMMA algorithmName)*
;
createDefaultShadowAlgorithm
@@ -48,7 +48,7 @@ createDefaultShadowAlgorithm
;
dropDefaultShadowAlgorithm
- : DROP DEFAULT SHADOW ALGORITHM existClause?
+ : DROP DEFAULT SHADOW ALGORITHM ifExists?
;
shadowRuleDefinition
@@ -91,6 +91,6 @@ algorithmProperty
: key = (SHADOW | IDENTIFIER | STRING) EQ value = (NUMBER | INT | STRING)
;
-existClause
+ifExists
: IF EXISTS
;
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-parser/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/core/ShadowDistSQLStatementVisitor.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-parser/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/core/ShadowDistSQLStatementVisitor.java
index e8a20fed148..e2516f67c3b 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-parser/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/core/ShadowDistSQLStatementVisitor.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-parser/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/core/ShadowDistSQLStatementVisitor.java
@@ -117,7 +117,7 @@ public final class ShadowDistSQLStatementVisitor extends ShadowDistSQLStatementB
@Override
public ASTNode visitDropShadowRule(final DropShadowRuleContext ctx) {
- return new DropShadowRuleStatement(null != ctx.existClause(), ctx.ruleName().stream().map(each -> new IdentifierValue(each.getText()).getValue()).collect(Collectors.toList()));
+ return new DropShadowRuleStatement(null != ctx.ifExists(), ctx.ruleName().stream().map(each -> new IdentifierValue(each.getText()).getValue()).collect(Collectors.toList()));
}
@Override
@@ -127,13 +127,13 @@ public final class ShadowDistSQLStatementVisitor extends ShadowDistSQLStatementB
@Override
public ASTNode visitDropShadowAlgorithm(final DropShadowAlgorithmContext ctx) {
- return new DropShadowAlgorithmStatement(null != ctx.existClause(), null == ctx.algorithmName() ? Collections.emptyList()
+ return new DropShadowAlgorithmStatement(null != ctx.ifExists(), null == ctx.algorithmName() ? Collections.emptyList()
: ctx.algorithmName().stream().map(this::getIdentifierValue).collect(Collectors.toSet()));
}
@Override
public ASTNode visitDropDefaultShadowAlgorithm(final DropDefaultShadowAlgorithmContext ctx) {
- return new DropDefaultShadowAlgorithmStatement(null != ctx.existClause());
+ return new DropDefaultShadowAlgorithmStatement(null != ctx.ifExists());
}
@Override
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-statement/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/statement/DropDefaultShadowAlgorithmStatement.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-statement/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/statement/DropDefaultShadowAlgorithmStatement.java
index c74cdbac6df..33ebf7bf6d3 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-statement/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/statement/DropDefaultShadowAlgorithmStatement.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-statement/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/statement/DropDefaultShadowAlgorithmStatement.java
@@ -24,7 +24,7 @@ import org.apache.shardingsphere.distsql.parser.statement.rdl.drop.DropRuleState
*/
public final class DropDefaultShadowAlgorithmStatement extends DropRuleStatement {
- public DropDefaultShadowAlgorithmStatement(final boolean ifExist) {
- super(ifExist);
+ public DropDefaultShadowAlgorithmStatement(final boolean ifExists) {
+ super(ifExists);
}
}
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-statement/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/statement/DropShadowAlgorithmStatement.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-statement/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/statement/DropShadowAlgorithmStatement.java
index f7ada114012..1b83bed7918 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-statement/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/statement/DropShadowAlgorithmStatement.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-statement/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/statement/DropShadowAlgorithmStatement.java
@@ -30,8 +30,8 @@ public final class DropShadowAlgorithmStatement extends DropRuleStatement {
private final Collection<String> algorithmNames;
- public DropShadowAlgorithmStatement(final boolean ifExist, final Collection<String> algorithmNames) {
- super(ifExist);
+ public DropShadowAlgorithmStatement(final boolean ifExists, final Collection<String> algorithmNames) {
+ super(ifExists);
this.algorithmNames = algorithmNames;
}
}
diff --git a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-statement/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/statement/DropShadowRuleStatement.java b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-statement/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/statement/DropShadowRuleStatement.java
index 7886b7b2c85..b90cad1bedd 100644
--- a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-statement/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/statement/DropShadowRuleStatement.java
+++ b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-statement/src/main/java/org/apache/shardingsphere/shadow/distsql/parser/statement/DropShadowRuleStatement.java
@@ -30,8 +30,8 @@ public final class DropShadowRuleStatement extends DropRuleStatement {
private final Collection<String> ruleNames;
- public DropShadowRuleStatement(final boolean ifExist, final Collection<String> ruleNames) {
- super(ifExist);
+ public DropShadowRuleStatement(final boolean ifExists, final Collection<String> ruleNames) {
+ super(ifExists);
this.ruleNames = ruleNames;
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateTableStatementValidator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateTableStatementValidator.java
index 3828b0006a1..4b014d2e8bf 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateTableStatementValidator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingCreateTableStatementValidator.java
@@ -40,7 +40,7 @@ public final class ShardingCreateTableStatementValidator extends ShardingDDLStat
@Override
public void preValidate(final ShardingRule shardingRule,
final SQLStatementContext<CreateTableStatement> sqlStatementContext, final List<Object> parameters, final ShardingSphereDatabase database) {
- if (!CreateTableStatementHandler.containsNotExistClause(sqlStatementContext.getSqlStatement())) {
+ if (!CreateTableStatementHandler.ifNotExists(sqlStatementContext.getSqlStatement())) {
String defaultSchemaName = DatabaseTypeEngine.getDefaultSchemaName(sqlStatementContext.getDatabaseType(), database.getName());
ShardingSphereSchema schema = sqlStatementContext.getTablesContext().getSchemaName()
.map(optional -> database.getSchemas().get(optional)).orElseGet(() -> database.getSchemas().get(defaultSchemaName));
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropIndexStatementValidator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropIndexStatementValidator.java
index c40d7bb6e64..6681223c600 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropIndexStatementValidator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropIndexStatementValidator.java
@@ -42,7 +42,7 @@ public final class ShardingDropIndexStatementValidator extends ShardingDDLStatem
@Override
public void preValidate(final ShardingRule shardingRule, final SQLStatementContext<DropIndexStatement> sqlStatementContext, final List<Object> parameters, final ShardingSphereDatabase database) {
- if (DropIndexStatementHandler.containsExistClause(sqlStatementContext.getSqlStatement())) {
+ if (DropIndexStatementHandler.ifExists(sqlStatementContext.getSqlStatement())) {
return;
}
String defaultSchemaName = DatabaseTypeEngine.getDefaultSchemaName(sqlStatementContext.getDatabaseType(), database.getName());
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropTableStatementValidator.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropTableStatementValidator.java
index ccc68a98d85..a9e976b75c1 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropTableStatementValidator.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/route/engine/validator/ddl/impl/ShardingDropTableStatementValidator.java
@@ -46,7 +46,7 @@ public final class ShardingDropTableStatementValidator extends ShardingDDLStatem
@Override
public void preValidate(final ShardingRule shardingRule,
final SQLStatementContext<DropTableStatement> sqlStatementContext, final List<Object> parameters, final ShardingSphereDatabase database) {
- if (!DropTableStatementHandler.containsExistClause(sqlStatementContext.getSqlStatement())) {
+ if (!DropTableStatementHandler.ifExists(sqlStatementContext.getSqlStatement())) {
String defaultSchemaName = DatabaseTypeEngine.getDefaultSchemaName(sqlStatementContext.getDatabaseType(), database.getName());
ShardingSphereSchema schema = sqlStatementContext.getTablesContext().getSchemaName()
.map(optional -> database.getSchemas().get(optional)).orElseGet(() -> database.getSchemas().get(defaultSchemaName));
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/update/DropShardingScalingRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/update/DropShardingScalingRuleStatementUpdater.java
index 8cb526232ff..750a18388bf 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/update/DropShardingScalingRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/scaling/distsql/handler/update/DropShardingScalingRuleStatementUpdater.java
@@ -32,7 +32,7 @@ public final class DropShardingScalingRuleStatementUpdater implements RuleDefini
@Override
public void checkSQLStatement(final ShardingSphereDatabase database,
final DropShardingScalingRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isIfExist()) {
+ if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isIfExists()) {
return;
}
String databaseName = database.getName();
@@ -52,7 +52,7 @@ public final class DropShardingScalingRuleStatementUpdater implements RuleDefini
}
private void checkExist(final String databaseName, final DropShardingScalingRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- if (sqlStatement.isIfExist()) {
+ if (sqlStatement.isIfExists()) {
return;
}
if (!currentRuleConfig.getScaling().containsKey(sqlStatement.getScalingName())) {
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropDefaultStrategyStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropDefaultStrategyStatementUpdater.java
index f05f2f0cfde..59978df3c07 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropDefaultStrategyStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropDefaultStrategyStatementUpdater.java
@@ -36,7 +36,7 @@ public final class DropDefaultStrategyStatementUpdater implements RuleDefinition
@Override
public void checkSQLStatement(final ShardingSphereDatabase database, final DropDefaultShardingStrategyStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isIfExist()) {
+ if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isIfExists()) {
return;
}
String databaseName = database.getName();
@@ -45,7 +45,7 @@ public final class DropDefaultStrategyStatementUpdater implements RuleDefinition
}
private void checkExist(final String databaseName, final DropDefaultShardingStrategyStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- if (sqlStatement.isIfExist()) {
+ if (sqlStatement.isIfExists()) {
return;
}
Optional<ShardingStrategyConfiguration> strategyConfig = getStrategyConfiguration(currentRuleConfig, sqlStatement.getDefaultType());
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingAlgorithmStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingAlgorithmStatementUpdater.java
index 98b4e869f25..5c8b7cc16b7 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingAlgorithmStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingAlgorithmStatementUpdater.java
@@ -39,7 +39,7 @@ public final class DropShardingAlgorithmStatementUpdater implements RuleDefiniti
@Override
public void checkSQLStatement(final ShardingSphereDatabase database,
final DropShardingAlgorithmStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws RuleDefinitionViolationException {
- if (null == currentRuleConfig && sqlStatement.isIfExist()) {
+ if (null == currentRuleConfig && sqlStatement.isIfExists()) {
return;
}
String databaseName = database.getName();
@@ -56,7 +56,7 @@ public final class DropShardingAlgorithmStatementUpdater implements RuleDefiniti
private void checkToBeDroppedShardingAlgorithms(final String databaseName, final DropShardingAlgorithmStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws RequiredAlgorithmMissedException {
- if (sqlStatement.isIfExist()) {
+ if (sqlStatement.isIfExists()) {
return;
}
Collection<String> currentShardingAlgorithms = getCurrentShardingAlgorithms(currentRuleConfig);
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBindingTableRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBindingTableRuleStatementUpdater.java
index 0adf3e062d2..872b9321925 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBindingTableRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBindingTableRuleStatementUpdater.java
@@ -48,7 +48,7 @@ public final class DropShardingBindingTableRuleStatementUpdater implements RuleD
@Override
public void checkSQLStatement(final ShardingSphereDatabase database,
final DropShardingBindingTableRulesStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isIfExist()) {
+ if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isIfExists()) {
return;
}
String databaseName = database.getName();
@@ -69,7 +69,7 @@ public final class DropShardingBindingTableRuleStatementUpdater implements RuleD
private void checkBindingTableRuleExist(final String databaseName, final DropShardingBindingTableRulesStatement sqlStatement,
final Map<String, String> bindingRelationship) throws DistSQLException {
- if (sqlStatement.isIfExist()) {
+ if (sqlStatement.isIfExists()) {
return;
}
Collection<String> notExistBindingGroups = new LinkedList<>();
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBroadcastTableRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBroadcastTableRuleStatementUpd [...]
index 51a49705d2c..41066991090 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBroadcastTableRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingBroadcastTableRuleStatementUpdater.java
@@ -36,7 +36,7 @@ public final class DropShardingBroadcastTableRuleStatementUpdater implements Rul
public void checkSQLStatement(final ShardingSphereDatabase database,
final DropShardingBroadcastTableRulesStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
String databaseName = database.getName();
- if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isIfExist()) {
+ if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isIfExists()) {
return;
}
checkCurrentRuleConfiguration(databaseName, currentRuleConfig);
@@ -45,7 +45,7 @@ public final class DropShardingBroadcastTableRuleStatementUpdater implements Rul
private void checkBroadcastTableRuleExist(final String databaseName,
final DropShardingBroadcastTableRulesStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- if (sqlStatement.isIfExist()) {
+ if (sqlStatement.isIfExists()) {
return;
}
if (!sqlStatement.getRules().isEmpty()) {
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingKeyGeneratorStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingKeyGeneratorStatementUpdater.java
index 581a272b7fa..0d9fd441dd1 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingKeyGeneratorStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingKeyGeneratorStatementUpdater.java
@@ -41,7 +41,7 @@ public final class DropShardingKeyGeneratorStatementUpdater implements RuleDefin
@Override
public void checkSQLStatement(final ShardingSphereDatabase database,
final DropShardingKeyGeneratorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws DistSQLException {
- if (null == currentRuleConfig && sqlStatement.isIfExist()) {
+ if (null == currentRuleConfig && sqlStatement.isIfExists()) {
return;
}
String databaseName = database.getName();
@@ -52,7 +52,7 @@ public final class DropShardingKeyGeneratorStatementUpdater implements RuleDefin
private void checkExist(final String databaseName, final Collection<String> keyGeneratorNames, final ShardingRuleConfiguration currentRuleConfig,
final DropShardingKeyGeneratorStatement sqlStatement) throws DistSQLException {
- if (sqlStatement.isIfExist()) {
+ if (sqlStatement.isIfExists()) {
return;
}
Collection<String> notExistKeyGenerators = keyGeneratorNames.stream().filter(each -> !currentRuleConfig.getKeyGenerators().containsKey(each)).collect(Collectors.toList());
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingTableRuleStatementUpdater.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingTableRuleStatementUpdater.java
index dcc34ca90d6..11adce50bef 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingTableRuleStatementUpdater.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropShardingTableRuleStatementUpdater.java
@@ -44,7 +44,7 @@ public final class DropShardingTableRuleStatementUpdater implements RuleDefiniti
@Override
public void checkSQLStatement(final ShardingSphereDatabase database,
final DropShardingTableRuleStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) throws RuleDefinitionViolationException {
- if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isIfExist()) {
+ if (!isExistRuleConfig(currentRuleConfig) && sqlStatement.isIfExists()) {
return;
}
String databaseName = database.getName();
@@ -65,7 +65,7 @@ public final class DropShardingTableRuleStatementUpdater implements RuleDefiniti
private void checkToBeDroppedShardingTableNames(final String databaseName, final DropShardingTableRuleStatement sqlStatement,
final ShardingRuleConfiguration currentRuleConfig) throws RequiredRuleMissedException {
- if (sqlStatement.isIfExist()) {
+ if (sqlStatement.isIfExists()) {
return;
}
Collection<String> currentShardingTableNames = getCurrentShardingTableNames(currentRuleConfig);
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBindingTableRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBindingTableRuleStatementUpdaterTest.java
index 7ab9919ea3b..92f9dc06732 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBindingTableRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBindingTableRuleStatementUpdaterTest.java
@@ -129,9 +129,9 @@ public final class DropShardingBindingTableRuleStatementUpdaterTest {
return new DropShardingBindingTableRulesStatement(false, segments);
}
- private DropShardingBindingTableRulesStatement createSQLStatement(final boolean ifExist, final String... group) {
+ private DropShardingBindingTableRulesStatement createSQLStatement(final boolean ifExists, final String... group) {
Collection<BindingTableRuleSegment> segments = Arrays.stream(group).map(BindingTableRuleSegment::new).collect(Collectors.toList());
- return new DropShardingBindingTableRulesStatement(ifExist, segments);
+ return new DropShardingBindingTableRulesStatement(ifExists, segments);
}
private ShardingRuleConfiguration createCurrentRuleConfiguration() {
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBroadcastTableRuleStatementUpdaterTest.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBroadcastTableRuleStatementUpdaterTest.java
index 7a9e9ec52b0..1d57660c3d8 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBroadcastTableRuleStatementUpdaterTest.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/DropShardingBroadcastTableRuleStatementUpdaterTest.java
@@ -98,9 +98,10 @@ public final class DropShardingBroadcastTableRuleStatementUpdaterTest {
: new DropShardingBroadcastTableRulesStatement(false, Collections.singleton(tableName));
}
- private DropShardingBroadcastTableRulesStatement createSQLStatement(final boolean containsExistClause, final String tableName) {
- return null == tableName ? new DropShardingBroadcastTableRulesStatement(false, Collections.emptyList())
- : new DropShardingBroadcastTableRulesStatement(containsExistClause, Collections.singleton(tableName));
+ private DropShardingBroadcastTableRulesStatement createSQLStatement(final boolean ifExists, final String tableName) {
+ return null == tableName
+ ? new DropShardingBroadcastTableRulesStatement(false, Collections.emptyList())
+ : new DropShardingBroadcastTableRulesStatement(ifExists, Collections.singleton(tableName));
}
private ShardingRuleConfiguration createCurrentRuleConfiguration() {
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/scaling/RDLStatement.g4 b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/scaling/RDLStatement.g4
index a67d038dede..ff8563c8f05 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/scaling/RDLStatement.g4
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/scaling/RDLStatement.g4
@@ -24,7 +24,7 @@ createShardingScalingRule
;
dropShardingScalingRule
- : DROP SHARDING SCALING RULE existsClause? scalingName
+ : DROP SHARDING SCALING RULE ifExists? scalingName
;
enableShardingScalingRule
@@ -83,6 +83,6 @@ intValue
: INT
;
-existsClause
+ifExists
: IF EXISTS
;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/sharding/BaseRule.g4 b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/sharding/BaseRule.g4
index e3abe787ae2..b3166907e7b 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/sharding/BaseRule.g4
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/sharding/BaseRule.g4
@@ -31,6 +31,6 @@ keyGeneratorName
: IDENTIFIER
;
-existsClause
+ifExists
: IF EXISTS
;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/sharding/RDLStatement.g4 b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/sharding/RDLStatement.g4
index f3697aeeee8..0c147c5fd09 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/sharding/RDLStatement.g4
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/antlr4/imports/sharding/RDLStatement.g4
@@ -44,7 +44,7 @@ alterDefaultShardingStrategy
;
dropDefaultShardingStrategy
- : DROP DEFAULT SHARDING type=(DATABASE | TABLE) STRATEGY existsClause?
+ : DROP DEFAULT SHARDING type=(DATABASE | TABLE) STRATEGY ifExists?
;
createShardingKeyGenerator
@@ -72,23 +72,23 @@ alterShardingKeyGenerator
;
dropShardingTableRule
- : DROP SHARDING TABLE RULE existsClause? tableName (COMMA tableName)* withUnusedAlgorithmsClause?
+ : DROP SHARDING TABLE RULE ifExists? tableName (COMMA tableName)* withUnusedAlgorithmsClause?
;
dropShardingBindingTableRules
- : DROP SHARDING BINDING TABLE RULES existsClause? (bindTableRulesDefinition (COMMA bindTableRulesDefinition)*)?
+ : DROP SHARDING BINDING TABLE RULES ifExists? (bindTableRulesDefinition (COMMA bindTableRulesDefinition)*)?
;
dropShardingBroadcastTableRules
- : DROP SHARDING BROADCAST TABLE RULES existsClause? (tableName (COMMA tableName)*)?
+ : DROP SHARDING BROADCAST TABLE RULES ifExists? (tableName (COMMA tableName)*)?
;
dropShardingAlgorithm
- : DROP SHARDING ALGORITHM existsClause? algorithmName (COMMA algorithmName)*
+ : DROP SHARDING ALGORITHM ifExists? algorithmName (COMMA algorithmName)*
;
dropShardingKeyGenerator
- : DROP SHARDING KEY GENERATOR existsClause? keyGeneratorName (COMMA keyGeneratorName)*
+ : DROP SHARDING KEY GENERATOR ifExists? keyGeneratorName (COMMA keyGeneratorName)*
;
shardingTableRuleDefinition
@@ -215,7 +215,7 @@ algorithmProperty
: key=(IDENTIFIER | STRING) EQ value=(NUMBER | INT | IDENTIFIER | STRING)
;
-existClause
+ifExists
: IF EXISTS
;
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingSQLStatementVisitor.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingSQLStatementVisitor.java
index 3414c7080e3..a8f3d68a17b 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingSQLStatementVisitor.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/scaling/distsql/parser/core/ScalingSQLStatementVisitor.java
@@ -231,7 +231,7 @@ public final class ScalingSQLStatementVisitor extends ScalingStatementBaseVisito
@Override
public ASTNode visitDropShardingScalingRule(final DropShardingScalingRuleContext ctx) {
- return new DropShardingScalingRuleStatement(null != ctx.existsClause(), getIdentifierValue(ctx.scalingName()));
+ return new DropShardingScalingRuleStatement(null != ctx.ifExists(), getIdentifierValue(ctx.scalingName()));
}
@Override
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java
index 4ce4cb095d9..1bd8285ede9 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-parser/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/core/ShardingDistSQLStatementVisitor.java
@@ -190,7 +190,7 @@ public final class ShardingDistSQLStatementVisitor extends ShardingDistSQLStatem
@Override
public ASTNode visitDropShardingTableRule(final DropShardingTableRuleContext ctx) {
- DropShardingTableRuleStatement result = new DropShardingTableRuleStatement(null != ctx.existsClause(),
+ DropShardingTableRuleStatement result = new DropShardingTableRuleStatement(null != ctx.ifExists(),
ctx.tableName().stream().map(each -> (TableNameSegment) visit(each)).collect(Collectors.toList()));
result.setDropUnusedAlgorithms(null != ctx.withUnusedAlgorithmsClause());
return result;
@@ -200,7 +200,7 @@ public final class ShardingDistSQLStatementVisitor extends ShardingDistSQLStatem
public ASTNode visitDropShardingBindingTableRules(final DropShardingBindingTableRulesContext ctx) {
Collection<BindingTableRuleSegment> tableNames = null == ctx.bindTableRulesDefinition() ? Collections.emptyList()
: createBindingTableRuleSegment(ctx.bindTableRulesDefinition());
- return new DropShardingBindingTableRulesStatement(null != ctx.existsClause(), tableNames);
+ return new DropShardingBindingTableRulesStatement(null != ctx.ifExists(), tableNames);
}
@Override
@@ -259,7 +259,7 @@ public final class ShardingDistSQLStatementVisitor extends ShardingDistSQLStatem
@Override
public ASTNode visitDropDefaultShardingStrategy(final DropDefaultShardingStrategyContext ctx) {
- return new DropDefaultShardingStrategyStatement(null != ctx.existsClause(), new IdentifierValue(ctx.type.getText()).getValue().toLowerCase());
+ return new DropDefaultShardingStrategyStatement(null != ctx.ifExists(), new IdentifierValue(ctx.type.getText()).getValue().toLowerCase());
}
@Override
@@ -270,12 +270,12 @@ public final class ShardingDistSQLStatementVisitor extends ShardingDistSQLStatem
@Override
public ASTNode visitDropShardingBroadcastTableRules(final DropShardingBroadcastTableRulesContext ctx) {
Collection<String> tableNames = null == ctx.tableName() ? Collections.emptyList() : ctx.tableName().stream().map(this::getIdentifierValue).collect(Collectors.toList());
- return new DropShardingBroadcastTableRulesStatement(null != ctx.existsClause(), tableNames);
+ return new DropShardingBroadcastTableRulesStatement(null != ctx.ifExists(), tableNames);
}
@Override
public ASTNode visitDropShardingAlgorithm(final DropShardingAlgorithmContext ctx) {
- return new DropShardingAlgorithmStatement(null != ctx.existsClause(), ctx.algorithmName().stream().map(this::getIdentifierValue).collect(Collectors.toList()));
+ return new DropShardingAlgorithmStatement(null != ctx.ifExists(), ctx.algorithmName().stream().map(this::getIdentifierValue).collect(Collectors.toList()));
}
@Override
@@ -447,7 +447,7 @@ public final class ShardingDistSQLStatementVisitor extends ShardingDistSQLStatem
@Override
public ASTNode visitDropShardingKeyGenerator(final DropShardingKeyGeneratorContext ctx) {
- return new DropShardingKeyGeneratorStatement(null != ctx.existsClause(), ctx.keyGeneratorName().stream().map(this::getIdentifierValue).collect(Collectors.toList()));
+ return new DropShardingKeyGeneratorStatement(null != ctx.ifExists(), ctx.keyGeneratorName().stream().map(this::getIdentifierValue).collect(Collectors.toList()));
}
@Override
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/scaling/distsql/statement/DropShardingScalingRuleStatement.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/scaling/distsql/statement/DropShardingScalingRuleStatement.java
index 315a17490ea..c1dde889943 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/scaling/distsql/statement/DropShardingScalingRuleStatement.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/scaling/distsql/statement/DropShardingScalingRuleStatement.java
@@ -28,8 +28,8 @@ public final class DropShardingScalingRuleStatement extends DropRuleStatement {
private final String scalingName;
- public DropShardingScalingRuleStatement(final boolean ifExist, final String scalingName) {
- super(ifExist);
+ public DropShardingScalingRuleStatement(final boolean ifExists, final String scalingName) {
+ super(ifExists);
this.scalingName = scalingName;
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropDefaultShardingStrategyStatement.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropDefaultShardingStrategyStatement.java
index 00aee9658db..f67eb98a019 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropDefaultShardingStrategyStatement.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropDefaultShardingStrategyStatement.java
@@ -28,8 +28,8 @@ public final class DropDefaultShardingStrategyStatement extends DropRuleStatemen
private final String defaultType;
- public DropDefaultShardingStrategyStatement(final boolean ifExist, final String defaultType) {
- super(ifExist);
+ public DropDefaultShardingStrategyStatement(final boolean ifExists, final String defaultType) {
+ super(ifExists);
this.defaultType = defaultType;
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropShardingAlgorithmStatement.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropShardingAlgorithmStatement.java
index abd4a9001d3..9548f198841 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropShardingAlgorithmStatement.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropShardingAlgorithmStatement.java
@@ -30,8 +30,8 @@ public final class DropShardingAlgorithmStatement extends DropRuleStatement {
private final Collection<String> algorithmNames;
- public DropShardingAlgorithmStatement(final boolean ifExist, final Collection<String> algorithmNames) {
- super(ifExist);
+ public DropShardingAlgorithmStatement(final boolean ifExists, final Collection<String> algorithmNames) {
+ super(ifExists);
this.algorithmNames = algorithmNames;
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropShardingBindingTableRulesStatement.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropShardingBindingTableRulesStatement.java
index a856e266fd8..a2ec3375e1a 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropShardingBindingTableRulesStatement.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropShardingBindingTableRulesStatement.java
@@ -32,8 +32,8 @@ public final class DropShardingBindingTableRulesStatement extends DropRuleStatem
private final Collection<BindingTableRuleSegment> rules;
- public DropShardingBindingTableRulesStatement(final boolean ifExist, final Collection<BindingTableRuleSegment> rules) {
- super(ifExist);
+ public DropShardingBindingTableRulesStatement(final boolean ifExists, final Collection<BindingTableRuleSegment> rules) {
+ super(ifExists);
this.rules = rules;
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropShardingBroadcastTableRulesStatement.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropShardingBroadcastTableRulesStatement.java
index 74228ae7024..3c5ee8ccf3a 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropShardingBroadcastTableRulesStatement.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropShardingBroadcastTableRulesStatement.java
@@ -30,8 +30,8 @@ public final class DropShardingBroadcastTableRulesStatement extends DropRuleStat
private final Collection<String> rules;
- public DropShardingBroadcastTableRulesStatement(final boolean ifExist, final Collection<String> rules) {
- super(ifExist);
+ public DropShardingBroadcastTableRulesStatement(final boolean ifExists, final Collection<String> rules) {
+ super(ifExists);
this.rules = rules;
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropShardingKeyGeneratorStatement.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropShardingKeyGeneratorStatement.java
index fde2a79c27d..6b23fe60ccf 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropShardingKeyGeneratorStatement.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropShardingKeyGeneratorStatement.java
@@ -30,8 +30,8 @@ public final class DropShardingKeyGeneratorStatement extends DropRuleStatement {
private final Collection<String> keyGeneratorNames;
- public DropShardingKeyGeneratorStatement(final boolean ifExist, final Collection<String> keyGeneratorNames) {
- super(ifExist);
+ public DropShardingKeyGeneratorStatement(final boolean ifExists, final Collection<String> keyGeneratorNames) {
+ super(ifExists);
this.keyGeneratorNames = keyGeneratorNames;
}
}
diff --git a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropShardingTableRuleStatement.java b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropShardingTableRuleStatement.java
index 81f1f039de1..4f80f766537 100644
--- a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropShardingTableRuleStatement.java
+++ b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/DropShardingTableRuleStatement.java
@@ -37,8 +37,8 @@ public final class DropShardingTableRuleStatement extends DropRuleStatement {
@Setter
private boolean dropUnusedAlgorithms;
- public DropShardingTableRuleStatement(final boolean containsExistsClause, final Collection<TableNameSegment> tableNames) {
- super(containsExistsClause);
+ public DropShardingTableRuleStatement(final boolean ifExists, final Collection<TableNameSegment> tableNames) {
+ super(ifExists);
this.tableNames = tableNames;
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/database/CreateDatabaseBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/database/CreateDatabaseBackendHandler.java
index 212cf5fbcc0..918bb8b2ed9 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/database/CreateDatabaseBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/database/CreateDatabaseBackendHandler.java
@@ -43,7 +43,7 @@ public final class CreateDatabaseBackendHandler implements TextProtocolBackendHa
}
private void check(final CreateDatabaseStatement sqlStatement) {
- if (!sqlStatement.isIfNotExist() && ProxyContext.getInstance().getAllDatabaseNames().contains(sqlStatement.getDatabaseName())) {
+ if (!sqlStatement.isIfNotExists() && ProxyContext.getInstance().getAllDatabaseNames().contains(sqlStatement.getDatabaseName())) {
throw new DBCreateExistsException(sqlStatement.getDatabaseName());
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/database/DropDatabaseBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/database/DropDatabaseBackendHandler.java
index b17aa8c0898..ffe99c02ae9 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/database/DropDatabaseBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/database/DropDatabaseBackendHandler.java
@@ -60,7 +60,7 @@ public final class DropDatabaseBackendHandler implements TextProtocolBackendHand
if (!SQLCheckEngine.check(databaseName, getRules(databaseName), grantee)) {
throw new UnknownDatabaseException(databaseName);
}
- if (!sqlStatement.isIfExist() && !ProxyContext.getInstance().getAllDatabaseNames().contains(databaseName)) {
+ if (!sqlStatement.isIfExists() && !ProxyContext.getInstance().getAllDatabaseNames().contains(databaseName)) {
throw new DBDropNotExistsException(databaseName);
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/DropTrafficRuleHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/DropTrafficRuleHandler.java
index 84443da17eb..119f48fea6a 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/DropTrafficRuleHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/DropTrafficRuleHandler.java
@@ -52,7 +52,7 @@ public final class DropTrafficRuleHandler extends UpdatableRALBackendHandler<Dro
}
private void checkRuleNames() throws DistSQLException {
- if (getSqlStatement().isIfExist()) {
+ if (getSqlStatement().isIfExists()) {
return;
}
TrafficRule rule = ProxyContext.getInstance().getContextManager().getMetaDataContexts().getMetaData().getGlobalRuleMetaData().getSingleRule(TrafficRule.class);
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/DropResourceBackendHandler.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/DropResourceBackendHandler.java
index e871c03b0c1..c7341accb53 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/DropResourceBackendHandler.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/resource/DropResourceBackendHandler.java
@@ -52,7 +52,7 @@ public final class DropResourceBackendHandler extends DatabaseRequiredBackendHan
@Override
public ResponseHeader execute(final String databaseName, final DropResourceStatement sqlStatement) throws DistSQLException {
Collection<String> toBeDroppedResourceNames = sqlStatement.getNames();
- check(databaseName, toBeDroppedResourceNames, sqlStatement.isIgnoreSingleTables(), sqlStatement.isIfExist());
+ check(databaseName, toBeDroppedResourceNames, sqlStatement.isIgnoreSingleTables(), sqlStatement.isIfExists());
ProxyContext.getInstance().getContextManager().dropResource(databaseName, toBeDroppedResourceNames);
return new UpdateResponseHeader(sqlStatement);
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/DropDefaultSingleTableRuleStatementUpdater.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/DropDefaultSingleTableRuleStatementUpdater.java
index 42d08a24a38..b07ffd60ec7 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/DropDefaultSingleTableRuleStatementUpdater.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/main/java/org/apache/shardingsphere/proxy/backend/text/distsql/rdl/rule/DropDefaultSingleTableRuleStatementUpdater.java
@@ -37,7 +37,7 @@ public final class DropDefaultSingleTableRuleStatementUpdater implements RuleDef
private void checkCurrentRuleConfiguration(final String databaseName,
final DropDefaultSingleTableRuleStatement sqlStatement, final SingleTableRuleConfiguration currentRuleConfig) throws DistSQLException {
- if (!sqlStatement.isIfExist()) {
+ if (!sqlStatement.isIfExists()) {
DistSQLException.predictionThrow(null != currentRuleConfig && currentRuleConfig.getDefaultDataSource().isPresent(), () -> new RequiredRuleMissedException("single table", databaseName));
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/database/CreateDatabaseBackendHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/database/CreateDatabaseBackendHandlerTest.java
index ce50e6c9e58..a7feaa529dd 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/database/CreateDatabaseBackendHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/database/CreateDatabaseBackendHandlerTest.java
@@ -76,7 +76,7 @@ public final class CreateDatabaseBackendHandlerTest extends ProxyContextRestorer
@Test
public void assertExecuteCreateExistDatabaseWithIfNotExists() {
when(statement.getDatabaseName()).thenReturn("test_db");
- when(statement.isIfNotExist()).thenReturn(true);
+ when(statement.isIfNotExists()).thenReturn(true);
assertThat(handler.execute(), instanceOf(UpdateResponseHeader.class));
}
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/database/DropDatabaseBackendHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/database/DropDatabaseBackendHandlerTest.java
index 82852fcc719..6517433a258 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/database/DropDatabaseBackendHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/database/DropDatabaseBackendHandlerTest.java
@@ -84,7 +84,7 @@ public final class DropDatabaseBackendHandlerTest extends ProxyContextRestorer {
@Test
public void assertExecuteDropNotExistDatabaseWithIfExists() {
when(sqlStatement.getDatabaseName()).thenReturn("test_not_exist_db");
- when(sqlStatement.isIfExist()).thenReturn(true);
+ when(sqlStatement.isIfExists()).thenReturn(true);
handler.execute();
}
diff --git a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/DropTrafficRuleHandlerTest.java b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/DropTrafficRuleHandlerTest.java
index 6509ad31764..e3d527508d9 100644
--- a/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/DropTrafficRuleHandlerTest.java
+++ b/shardingsphere-proxy/shardingsphere-proxy-backend/src/test/java/org/apache/shardingsphere/proxy/backend/text/distsql/ral/common/updatable/DropTrafficRuleHandlerTest.java
@@ -49,7 +49,7 @@ public final class DropTrafficRuleHandlerTest extends ProxyContextRestorer {
public void assertExecuteForNotExistedRuleWithoutIfExists() throws SQLException {
mockContextManager();
DropTrafficRuleHandler handler = new DropTrafficRuleHandler();
- handler.init(new DropTrafficRuleStatement(Collections.singleton("not_existed_rule"), false), null);
+ handler.init(new DropTrafficRuleStatement(false, Collections.singleton("not_existed_rule")), null);
handler.execute();
}
@@ -57,7 +57,7 @@ public final class DropTrafficRuleHandlerTest extends ProxyContextRestorer {
public void assertExecuteForNotExistedRuleWithIfExists() throws SQLException {
ContextManager contextManager = mockContextManager();
DropTrafficRuleHandler handler = new DropTrafficRuleHandler();
- handler.init(new DropTrafficRuleStatement(Collections.singleton("rule_name_3"), true), null);
+ handler.init(new DropTrafficRuleStatement(true, Collections.singleton("rule_name_3")), null);
handler.execute();
TrafficRuleConfiguration updatedConfig = contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().getSingleRule(TrafficRule.class).getConfiguration();
assertThat(updatedConfig.getTrafficStrategies().size(), is(2));
@@ -69,7 +69,7 @@ public final class DropTrafficRuleHandlerTest extends ProxyContextRestorer {
public void assertExecute() throws SQLException {
ContextManager contextManager = mockContextManager();
DropTrafficRuleHandler handler = new DropTrafficRuleHandler();
- handler.init(new DropTrafficRuleStatement(Collections.singleton("rule_name_1"), false), null);
+ handler.init(new DropTrafficRuleStatement(false, Collections.singleton("rule_name_1")), null);
handler.execute();
TrafficRuleConfiguration updatedConfig = contextManager.getMetaDataContexts().getMetaData().getGlobalRuleMetaData().getSingleRule(TrafficRule.class).getConfiguration();
assertThat(updatedConfig.getTrafficStrategies().size(), is(1));
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/BaseRule.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/BaseRule.g4
index cbd6b27b8ec..9a149b1f297 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/BaseRule.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/BaseRule.g4
@@ -1261,11 +1261,11 @@ fieldOrVarSpec
: LP_ (identifier (COMMA_ identifier)*)? RP_
;
-notExistClause
+ifNotExists
: IF NOT EXISTS
;
-existClause
+ifExists
: IF EXISTS
;
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/DALStatement.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/DALStatement.g4
index 697c2d68eea..3148e959052 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/DALStatement.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/DALStatement.g4
@@ -103,7 +103,7 @@ showColumns
;
showCreateDatabase
- : SHOW CREATE (DATABASE | SCHEMA) notExistClause? schemaName
+ : SHOW CREATE (DATABASE | SCHEMA) ifNotExists? schemaName
;
showCreateEvent
@@ -401,7 +401,7 @@ resetOption
;
resetPersist
- : RESET PERSIST (existClause? identifier)?
+ : RESET PERSIST (ifExists? identifier)?
;
restart
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/DCLStatement.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/DCLStatement.g4
index 070e31ef6a2..8cc1d6d44d4 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/DCLStatement.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/DCLStatement.g4
@@ -91,7 +91,7 @@ grantIdentifier
;
createUser
- : CREATE USER (IF NOT EXISTS)? createUserList defaultRoleClause? requireClause? connectOptions? accountLockPasswordExpireOptions?
+ : CREATE USER ifNotExists? createUserList defaultRoleClause? requireClause? connectOptions? accountLockPasswordExpireOptions?
;
createUserEntry
@@ -135,9 +135,9 @@ accountLockPasswordExpireOption
;
alterUser
- : ALTER USER existClause? alterUserList requireClause? connectOptions? accountLockPasswordExpireOptions?
- | ALTER USER existClause? USER LP_ RP_ userFuncAuthOption
- | ALTER USER existClause? username DEFAULT ROLE (NONE | ALL | roleName (COMMA_ roleName)*)
+ : ALTER USER ifExists? alterUserList requireClause? connectOptions? accountLockPasswordExpireOptions?
+ | ALTER USER ifExists? USER LP_ RP_ userFuncAuthOption
+ | ALTER USER ifExists? username DEFAULT ROLE (NONE | ALL | roleName (COMMA_ roleName)*)
;
alterUserEntry
@@ -149,15 +149,15 @@ alterUserList
;
dropUser
- : DROP USER existClause? username (COMMA_ username)*
+ : DROP USER ifExists? username (COMMA_ username)*
;
createRole
- : CREATE ROLE notExistClause? roleName (COMMA_ roleName)*
+ : CREATE ROLE ifNotExists? roleName (COMMA_ roleName)*
;
dropRole
- : DROP ROLE existClause? roleName (COMMA_ roleName)*
+ : DROP ROLE ifExists? roleName (COMMA_ roleName)*
;
renameUser
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/DDLStatement.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/DDLStatement.g4
index be3496a4dc1..62807d1ae45 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/DDLStatement.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql/DDLStatement.g4
@@ -32,7 +32,7 @@ alterStatement
;
createTable
- : CREATE TEMPORARY? TABLE notExistClause? tableName (createDefinitionClause? createTableOptions? partitionClause? duplicateAsQueryExpression? | createLikeClause)
+ : CREATE TEMPORARY? TABLE ifNotExists? tableName (createDefinitionClause? createTableOptions? partitionClause? duplicateAsQueryExpression? | createLikeClause)
;
partitionClause
@@ -181,7 +181,7 @@ fulltextIndexOption
;
dropTable
- : DROP TEMPORARY? tableOrTables existClause? tableList restrict?
+ : DROP TEMPORARY? tableOrTables ifExists? tableList restrict?
;
dropIndex
@@ -207,7 +207,7 @@ createIndex
;
createDatabase
- : CREATE (DATABASE | SCHEMA) notExistClause? schemaName createDatabaseSpecification_*
+ : CREATE (DATABASE | SCHEMA) ifNotExists? schemaName createDatabaseSpecification_*
;
alterDatabase
@@ -226,7 +226,7 @@ alterDatabaseSpecification_
;
dropDatabase
- : DROP (DATABASE | SCHEMA) existClause? schemaName
+ : DROP (DATABASE | SCHEMA) ifExists? schemaName
;
alterInstance
@@ -245,7 +245,7 @@ channel
;
createEvent
- : CREATE ownerStatement? EVENT notExistClause? eventName
+ : CREATE ownerStatement? EVENT ifNotExists? eventName
ON SCHEDULE scheduleExpression
(ON COMPLETION NOT? PRESERVE)?
(ENABLE | DISABLE | DISABLE ON SLAVE)?
@@ -263,7 +263,7 @@ alterEvent
;
dropEvent
- : DROP EVENT existClause? eventName
+ : DROP EVENT ifExists? eventName
;
createFunction
@@ -279,7 +279,7 @@ alterFunction
;
dropFunction
- : DROP FUNCTION existClause? functionName
+ : DROP FUNCTION ifExists? functionName
;
createProcedure
@@ -294,7 +294,7 @@ alterProcedure
;
dropProcedure
- : DROP PROCEDURE existClause? functionName
+ : DROP PROCEDURE ifExists? functionName
;
createServer
@@ -309,7 +309,7 @@ alterServer
;
dropServer
- : DROP SERVER existClause? serverName
+ : DROP SERVER ifExists? serverName
;
createView
@@ -332,7 +332,7 @@ alterView
;
dropView
- : DROP VIEW existClause? viewNames restrict?
+ : DROP VIEW ifExists? viewNames restrict?
;
createTablespace
@@ -413,7 +413,7 @@ createTrigger
;
dropTrigger
- : DROP TRIGGER existClause? (schemaName DOT_)? triggerName
+ : DROP TRIGGER ifExists? (schemaName DOT_)? triggerName
;
renameTable
@@ -557,11 +557,11 @@ createTableOption
createSRSStatement
: CREATE OR REPLACE SPATIAL REFERENCE SYSTEM NUMBER_ srsAttribute*
- | CREATE SPATIAL REFERENCE SYSTEM notExistClause? NUMBER_ srsAttribute*
+ | CREATE SPATIAL REFERENCE SYSTEM ifNotExists? NUMBER_ srsAttribute*
;
dropSRSStatement
- : DROP SPATIAL REFERENCE SYSTEM notExistClause? NUMBER_
+ : DROP SPATIAL REFERENCE SYSTEM ifNotExists? NUMBER_
;
srsAttribute
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
index 76c52f7063a..861064bf608 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
@@ -354,7 +354,7 @@ public final class MySQLDALStatementSQLVisitor extends MySQLStatementSQLVisitor
@Override
public ASTNode visitResetPersist(final ResetPersistContext ctx) {
- return new MySQLResetPersistStatement(null != ctx.existClause(), null == ctx.identifier() ? null : new IdentifierValue(ctx.identifier().getText()));
+ return new MySQLResetPersistStatement(null != ctx.ifExists(), null == ctx.identifier() ? null : new IdentifierValue(ctx.identifier().getText()));
}
@Override
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDDLStatementSQLVisitor.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDDLStatementSQLVisitor.java
index 1ea113dc3f0..7ff2f696850 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDDLStatementSQLVisitor.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDDLStatementSQLVisitor.java
@@ -214,7 +214,7 @@ public final class MySQLDDLStatementSQLVisitor extends MySQLStatementSQLVisitor
public ASTNode visitCreateDatabase(final CreateDatabaseContext ctx) {
MySQLCreateDatabaseStatement result = new MySQLCreateDatabaseStatement();
result.setDatabaseName(new IdentifierValue(ctx.schemaName().getText()).getValue());
- result.setIfNotExist(null != ctx.notExistClause());
+ result.setIfNotExists(null != ctx.ifNotExists());
return result;
}
@@ -227,14 +227,14 @@ public final class MySQLDDLStatementSQLVisitor extends MySQLStatementSQLVisitor
public ASTNode visitDropDatabase(final DropDatabaseContext ctx) {
MySQLDropDatabaseStatement result = new MySQLDropDatabaseStatement();
result.setDatabaseName(new IdentifierValue(ctx.schemaName().getText()).getValue());
- result.setIfExist(null != ctx.existClause());
+ result.setIfExists(null != ctx.ifExists());
return result;
}
@SuppressWarnings("unchecked")
@Override
public ASTNode visitCreateTable(final CreateTableContext ctx) {
- MySQLCreateTableStatement result = new MySQLCreateTableStatement(null != ctx.notExistClause());
+ MySQLCreateTableStatement result = new MySQLCreateTableStatement(null != ctx.ifNotExists());
result.setTable((SimpleTableSegment) visit(ctx.tableName()));
if (null != ctx.createDefinitionClause()) {
CollectionValue<CreateDefinitionSegment> createDefinitions = (CollectionValue<CreateDefinitionSegment>) visit(ctx.createDefinitionClause());
@@ -531,7 +531,7 @@ public final class MySQLDDLStatementSQLVisitor extends MySQLStatementSQLVisitor
@SuppressWarnings("unchecked")
@Override
public ASTNode visitDropTable(final DropTableContext ctx) {
- MySQLDropTableStatement result = new MySQLDropTableStatement(null != ctx.existClause());
+ MySQLDropTableStatement result = new MySQLDropTableStatement(null != ctx.ifExists());
result.getTables().addAll(((CollectionValue<SimpleTableSegment>) visit(ctx.tableList())).getValue());
return result;
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/BaseRule.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/BaseRule.g4
index bbc76935a71..95ba5f42b6c 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/BaseRule.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/BaseRule.g4
@@ -1864,10 +1864,10 @@ typeNameList
: typeName (COMMA_ typeName)*
;
-notExistClause
+ifNotExists
: IF NOT EXISTS
;
-existClause
+ifExists
: IF EXISTS
;
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/DCLStatement.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/DCLStatement.g4
index 9452bd3b719..af386c9e186 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/DCLStatement.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/DCLStatement.g4
@@ -57,7 +57,7 @@ alterOptRoleElem
;
dropUser
- : DROP USER existClause? roleList
+ : DROP USER ifExists? roleList
;
alterUser
@@ -80,7 +80,7 @@ createRole
;
dropRole
- : DROP ROLE existClause? roleList
+ : DROP ROLE ifExists? roleList
;
alterRole
@@ -92,7 +92,7 @@ createGroup
;
dropDroup
- : DROP GROUP existClause? roleList
+ : DROP GROUP ifExists? roleList
;
reassignOwned
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/DDLStatement.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/DDLStatement.g4
index 9487f2c472a..ca3a90d1aad 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/DDLStatement.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/antlr4/imports/opengauss/DDLStatement.g4
@@ -20,7 +20,7 @@ grammar DDLStatement;
import DMLStatement;
createTable
- : CREATE createTableSpecification TABLE notExistClause? tableName
+ : CREATE createTableSpecification TABLE ifNotExists? tableName
(createDefinitionClause | (OF anyName (LP_ typedTableElementList RP_)?) | (PARTITION OF qualifiedName (LP_ typedTableElementList RP_)? partitionBoundSpec))
inheritClause partitionSpec? tableAccessMethodClause? withOption? onCommitOption? tableSpace?
(AS select withData?)?
@@ -88,7 +88,7 @@ accessMethod
;
createIndex
- : CREATE createIndexSpecification INDEX concurrentlyClause (notExistClause? indexName)? ON onlyClause tableName
+ : CREATE createIndexSpecification INDEX concurrentlyClause (ifNotExists? indexName)? ON onlyClause tableName
accessMethodClause? LP_ indexParams RP_ include? (WITH reloptions)? tableSpace? whereClause?
;
@@ -125,11 +125,11 @@ columnElem
;
dropDatabase
- : DROP DATABASE existClause? name
+ : DROP DATABASE ifExists? name
;
dropDirectory
- : DROP DIRECTORY existClause? directoryName
+ : DROP DIRECTORY ifExists? directoryName
;
createDatabaseSpecification
@@ -148,16 +148,16 @@ createdbOptName
alterTable
: ALTER TABLE
- ( existClause? onlyClause tableNameClause alterDefinitionClause
+ ( ifExists? onlyClause tableNameClause alterDefinitionClause
| ALL IN TABLESPACE tableNameClause (OWNED BY roleList)? SET TABLESPACE name NOWAIT?)
;
alterIndex
- : ALTER INDEX (existClause? | ALL IN TABLESPACE) qualifiedName alterIndexDefinitionClause
+ : ALTER INDEX (ifExists? | ALL IN TABLESPACE) qualifiedName alterIndexDefinitionClause
;
dropTable
- : DROP TABLE existClause? tableNames dropTableOpt?
+ : DROP TABLE ifExists? tableNames dropTableOpt?
;
dropTableOpt
@@ -165,7 +165,7 @@ dropTableOpt
;
dropIndex
- : DROP INDEX concurrentlyClause existClause? qualifiedNameList dropIndexOpt?
+ : DROP INDEX concurrentlyClause ifExists? qualifiedNameList dropIndexOpt?
;
dropIndexOpt
@@ -402,11 +402,11 @@ alterTableAction
;
addColumnSpecification
- : ADD COLUMN? notExistClause? columnDefinition
+ : ADD COLUMN? ifNotExists? columnDefinition
;
dropColumnSpecification
- : DROP COLUMN? existClause? columnName (RESTRICT | CASCADE)?
+ : DROP COLUMN? ifExists? columnName (RESTRICT | CASCADE)?
;
modifyColumnSpecification
@@ -416,7 +416,7 @@ modifyColumnSpecification
| modifyColumn (SET | DROP) NOT NULL
| modifyColumn ADD GENERATED (ALWAYS | (BY DEFAULT)) AS IDENTITY (LP_ sequenceOptions RP_)?
| modifyColumn alterColumnSetOption alterColumnSetOption*
- | modifyColumn DROP IDENTITY existClause?
+ | modifyColumn DROP IDENTITY ifExists?
| modifyColumn SET STATISTICS NUMBER_
| modifyColumn SET LP_ attributeOptions RP_
| modifyColumn RESET LP_ attributeOptions RP_
@@ -456,7 +456,7 @@ validateConstraintSpecification
;
dropConstraintSpecification
- : DROP CONSTRAINT existClause? constraintName (RESTRICT | CASCADE)?
+ : DROP CONSTRAINT ifExists? constraintName (RESTRICT | CASCADE)?
;
storageParameterWithValue
@@ -510,7 +510,7 @@ alterTableCmds
;
alterTableCmd
- : ADD COLUMN? notExistClause? columnDef
+ : ADD COLUMN? ifNotExists? columnDef
| ALTER COLUMN? colId alterColumnDefault
| ALTER COLUMN? colId DROP NOT NULL
| ALTER COLUMN? colId SET NOT NULL
@@ -522,15 +522,15 @@ alterTableCmd
| ALTER COLUMN? colId ADD GENERATED generatedWhen AS IDENTITY parenthesizedSeqOptList?
| ALTER COLUMN? colId alterIdentityColumnOptionList
| ALTER COLUMN? colId DROP IDENTITY
- | ALTER COLUMN? colId DROP IDENTITY existClause
- | DROP COLUMN? existClause colId dropBehavior?
+ | ALTER COLUMN? colId DROP IDENTITY ifExists
+ | DROP COLUMN? ifExists colId dropBehavior?
| DROP COLUMN? colId dropBehavior?
| ALTER COLUMN? colId setData? TYPE typeName collateClause? alterUsing?
| ALTER COLUMN? colId alterGenericOptions
| ADD tableConstraint (NOT VALID)?
| ALTER CONSTRAINT name constraintAttributeSpec
| VALIDATE CONSTRAINT name
- | DROP CONSTRAINT existClause name dropBehavior?
+ | DROP CONSTRAINT ifExists name dropBehavior?
| DROP CONSTRAINT name dropBehavior?
| SET WITHOUT OIDS
| CLUSTER ON name
@@ -816,7 +816,7 @@ alterDomain
alterDomainClause
: anyName (SET | DROP) NOT NULL
| anyName ADD tableConstraint (NOT VALID)?
- | anyName DROP CONSTRAINT existClause? name dropBehavior?
+ | anyName DROP CONSTRAINT ifExists? name dropBehavior?
| anyName VALIDATE CONSTRAINT name
| anyName RENAME CONSTRAINT constraintName TO constraintName
| anyName OWNER TO roleSpec
@@ -960,11 +960,11 @@ alterMaterializedView
;
alterMaterializedViewClauses
- : existClause? qualifiedName alterTableCmds
+ : ifExists? qualifiedName alterTableCmds
| qualifiedName DEPENDS ON EXTENSION name
- | existClause? qualifiedName RENAME COLUMN? columnName TO columnName
- | existClause? qualifiedName RENAME TO qualifiedName
- | existClause? qualifiedName SET SCHEMA schemaName
+ | ifExists? qualifiedName RENAME COLUMN? columnName TO columnName
+ | ifExists? qualifiedName RENAME TO qualifiedName
+ | ifExists? qualifiedName SET SCHEMA schemaName
| ALL IN TABLESPACE name (OWNED BY roleList) SET TABLESPACE name NOWAIT?
;
@@ -990,7 +990,7 @@ executeStmt
;
createMaterializedView
- : CREATE UNLOGGED? MATERIALIZED VIEW notExistClause? createMvTarget AS select (WITH DATA | WITH NO DATA)?
+ : CREATE UNLOGGED? MATERIALIZED VIEW ifNotExists? createMvTarget AS select (WITH DATA | WITH NO DATA)?
;
createMvTarget
@@ -1002,7 +1002,7 @@ refreshMatViewStmt
;
alterPolicy
- : ALTER POLICY existClause? name ON qualifiedName alterPolicyClauses
+ : ALTER POLICY ifExists? name ON qualifiedName alterPolicyClauses
;
alterPolicyClauses
@@ -1055,7 +1055,7 @@ alterRule
;
alterSequence
- : ALTER SEQUENCE existClause? qualifiedName alterSequenceClauses
+ : ALTER SEQUENCE ifExists? qualifiedName alterSequenceClauses
;
alterSequenceClauses
@@ -1077,7 +1077,7 @@ foreignServerVersion
alterStatistics
: ALTER STATISTICS
- ( existClause? anyName SET STATISTICS signedIconst
+ ( ifExists? anyName SET STATISTICS signedIconst
| anyName RENAME TO name
| anyName SET SCHEMA name
| anyName OWNER TO roleSpec)
@@ -1123,7 +1123,7 @@ alterTextSearchConfigurationClauses
| OWNER TO roleSpec
| (ADD | ALTER) MAPPING FOR nameList WITH? anyNameList
| ALTER MAPPING (FOR nameList)? REPLACE anyName WITH anyName
- | DROP MAPPING existClause? FOR nameList
+ | DROP MAPPING ifExists? FOR nameList
;
anyNameList
@@ -1156,7 +1156,7 @@ alterType
alterTypeClauses
: alterTypeCmds
- | ADD VALUE notExistClause? STRING_ ((BEFORE | AFTER) STRING_)?
+ | ADD VALUE ifNotExists? STRING_ ((BEFORE | AFTER) STRING_)?
| RENAME VALUE STRING_ TO STRING_
| RENAME TO name
| RENAME ATTRIBUTE name TO name dropBehavior?
@@ -1170,7 +1170,7 @@ alterTypeCmds
alterTypeCmd
: ADD ATTRIBUTE tableFuncElement dropBehavior?
- | DROP ATTRIBUTE existClause? colId dropBehavior?
+ | DROP ATTRIBUTE ifExists? colId dropBehavior?
| ALTER ATTRIBUTE colId setData? TYPE typeName collateClause? dropBehavior?
;
@@ -1183,7 +1183,7 @@ authIdent
;
alterView
- : ALTER VIEW existClause? qualifiedName alterViewClauses
+ : ALTER VIEW ifExists? qualifiedName alterViewClauses
;
alterViewClauses
@@ -1306,7 +1306,7 @@ castContext
;
createCollation
- : CREATE COLLATION notExistClause? (anyName definition | anyName FROM anyName)
+ : CREATE COLLATION ifNotExists? (anyName definition | anyName FROM anyName)
;
createConversion
@@ -1334,7 +1334,7 @@ eventTriggerValueList
;
createExtension
- : CREATE EXTENSION notExistClause? name WITH? createExtensionOptList
+ : CREATE EXTENSION ifNotExists? name WITH? createExtensionOptList
;
createExtensionOptList
@@ -1357,9 +1357,9 @@ createForeignTable
;
createForeignTableClauses
- : notExistClause? qualifiedName LP_ tableElementList? RP_
+ : ifNotExists? qualifiedName LP_ tableElementList? RP_
(INHERITS LP_ qualifiedNameList RP_)? SERVER name createGenericOptions?
- | notExistClause? qualifiedName PARTITION OF qualifiedName (LP_ typedTableElementList RP_)? partitionBoundSpec
+ | ifNotExists? qualifiedName PARTITION OF qualifiedName (LP_ typedTableElementList RP_)? partitionBoundSpec
SERVER name createGenericOptions?
;
@@ -1566,7 +1566,7 @@ transitionOldOrNew
;
createSequence
- : CREATE tempOption? SEQUENCE notExistClause? qualifiedName seqOptList?
+ : CREATE tempOption? SEQUENCE ifNotExists? qualifiedName seqOptList?
;
tempOption
@@ -1574,11 +1574,11 @@ tempOption
;
createServer
- : CREATE SERVER notExistClause? name (TYPE STRING_)? foreignServerVersion? FOREIGN DATA WRAPPER name createGenericOptions
+ : CREATE SERVER ifNotExists? name (TYPE STRING_)? foreignServerVersion? FOREIGN DATA WRAPPER name createGenericOptions
;
createStatistics
- : CREATE STATISTICS notExistClause? anyName optNameList ON exprList FROM fromList
+ : CREATE STATISTICS ifNotExists? anyName optNameList ON exprList FROM fromList
;
createSubscription
@@ -1613,7 +1613,7 @@ enumValList
;
createUserMapping
- : CREATE USER MAPPING notExistClause? FOR authIdent SERVER name createGenericOptions
+ : CREATE USER MAPPING ifNotExists? FOR authIdent SERVER name createGenericOptions
;
discard
@@ -1621,11 +1621,11 @@ discard
;
dropAccessMethod
- : DROP ACCESS METHOD existClause? name dropBehavior?
+ : DROP ACCESS METHOD ifExists? name dropBehavior?
;
dropAggregate
- : DROP AGGREGATE existClause? aggregateWithArgtypesList dropBehavior?
+ : DROP AGGREGATE ifExists? aggregateWithArgtypesList dropBehavior?
;
aggregateWithArgtypesList
@@ -1633,39 +1633,39 @@ aggregateWithArgtypesList
;
dropCast
- : DROP CAST existClause? LP_ typeName AS typeName RP_ dropBehavior?
+ : DROP CAST ifExists? LP_ typeName AS typeName RP_ dropBehavior?
;
dropCollation
- : DROP COLLATION existClause? name dropBehavior?
+ : DROP COLLATION ifExists? name dropBehavior?
;
dropConversion
- : DROP CONVERSION existClause? name dropBehavior?
+ : DROP CONVERSION ifExists? name dropBehavior?
;
dropDomain
- : DROP DOMAIN existClause? nameList dropBehavior?
+ : DROP DOMAIN ifExists? nameList dropBehavior?
;
dropEventTrigger
- : DROP EVENT TRIGGER existClause? nameList dropBehavior?
+ : DROP EVENT TRIGGER ifExists? nameList dropBehavior?
;
dropExtension
- : DROP EXTENSION existClause? nameList dropBehavior?
+ : DROP EXTENSION ifExists? nameList dropBehavior?
;
dropForeignDataWrapper
- : DROP FOREIGN DATA WRAPPER existClause? nameList dropBehavior?
+ : DROP FOREIGN DATA WRAPPER ifExists? nameList dropBehavior?
;
dropForeignTable
- : DROP FOREIGN TABLE existClause? tableName (COMMA_ tableName)* dropBehavior?
+ : DROP FOREIGN TABLE ifExists? tableName (COMMA_ tableName)* dropBehavior?
;
dropFunction
- : DROP FUNCTION existClause? functionWithArgtypesList dropBehavior?
+ : DROP FUNCTION ifExists? functionWithArgtypesList dropBehavior?
;
functionWithArgtypesList
@@ -1673,15 +1673,15 @@ functionWithArgtypesList
;
dropLanguage
- : DROP PROCEDURAL? LANGUAGE existClause? name dropBehavior?
+ : DROP PROCEDURAL? LANGUAGE ifExists? name dropBehavior?
;
dropMaterializedView
- : DROP MATERIALIZED VIEW existClause? anyNameList dropBehavior?
+ : DROP MATERIALIZED VIEW ifExists? anyNameList dropBehavior?
;
dropOperator
- : DROP OPERATOR existClause? operatorWithArgtypesList dropBehavior?
+ : DROP OPERATOR ifExists? operatorWithArgtypesList dropBehavior?
;
operatorWithArgtypesList
@@ -1689,11 +1689,11 @@ operatorWithArgtypesList
;
dropOperatorClass
- : DROP OPERATOR CLASS existClause? anyName USING name dropBehavior?
+ : DROP OPERATOR CLASS ifExists? anyName USING name dropBehavior?
;
dropOperatorFamily
- : DROP OPERATOR FAMILY existClause? anyName USING name dropBehavior?
+ : DROP OPERATOR FAMILY ifExists? anyName USING name dropBehavior?
;
dropOwned
@@ -1701,71 +1701,71 @@ dropOwned
;
dropPolicy
- : DROP POLICY existClause? name ON tableName dropBehavior?
+ : DROP POLICY ifExists? name ON tableName dropBehavior?
;
dropProcedure
- : DROP PROCEDURE existClause? functionWithArgtypesList dropBehavior?
+ : DROP PROCEDURE ifExists? functionWithArgtypesList dropBehavior?
;
dropPublication
- : DROP PUBLICATION existClause? name dropBehavior?
+ : DROP PUBLICATION ifExists? name dropBehavior?
;
dropRoutine
- : DROP ROUTINE existClause? functionWithArgtypesList dropBehavior?
+ : DROP ROUTINE ifExists? functionWithArgtypesList dropBehavior?
;
dropRule
- : DROP RULE existClause? name ON tableName dropBehavior?
+ : DROP RULE ifExists? name ON tableName dropBehavior?
;
dropSequence
- : DROP SEQUENCE existClause? qualifiedNameList dropBehavior?
+ : DROP SEQUENCE ifExists? qualifiedNameList dropBehavior?
;
dropSynonym
- : DROP SYNONYM existClause? synonymName dropBehavior?
+ : DROP SYNONYM ifExists? synonymName dropBehavior?
;
dropServer
- : DROP SERVER existClause? qualifiedNameList dropBehavior?
+ : DROP SERVER ifExists? qualifiedNameList dropBehavior?
;
dropStatistics
- : DROP STATISTICS existClause? qualifiedNameList
+ : DROP STATISTICS ifExists? qualifiedNameList
;
dropSubscription
- : DROP SUBSCRIPTION existClause? qualifiedName dropBehavior?
+ : DROP SUBSCRIPTION ifExists? qualifiedName dropBehavior?
;
dropTablespace
- : DROP TABLESPACE existClause? qualifiedName
+ : DROP TABLESPACE ifExists? qualifiedName
;
dropTextSearch
- : DROP TEXT SEARCH (CONFIGURATION | DICTIONARY | PARSER | TEMPLATE) existClause? qualifiedName dropBehavior?
+ : DROP TEXT SEARCH (CONFIGURATION | DICTIONARY | PARSER | TEMPLATE) ifExists? qualifiedName dropBehavior?
;
dropTransform
- : DROP TRANSFORM existClause? FOR typeName LANGUAGE name dropBehavior?
+ : DROP TRANSFORM ifExists? FOR typeName LANGUAGE name dropBehavior?
;
dropTrigger
- : DROP TRIGGER existClause? qualifiedName ON tableName dropBehavior?
+ : DROP TRIGGER ifExists? qualifiedName ON tableName dropBehavior?
;
dropType
- : DROP TYPE existClause? anyNameList dropBehavior?
+ : DROP TYPE ifExists? anyNameList dropBehavior?
;
dropUserMapping
- : DROP USER MAPPING existClause? FOR authIdent SERVER name
+ : DROP USER MAPPING ifExists? FOR authIdent SERVER name
;
dropView
- : DROP VIEW existClause? qualifiedNameList dropBehavior?
+ : DROP VIEW ifExists? qualifiedNameList dropBehavior?
;
importForeignSchema
@@ -1832,7 +1832,7 @@ reindexTargetType
;
alterForeignTable
- : ALTER FOREIGN TABLE existClause? relationExpr alterForeignTableClauses
+ : ALTER FOREIGN TABLE ifExists? relationExpr alterForeignTableClauses
;
alterForeignTableClauses
@@ -1876,7 +1876,7 @@ unlisten
;
createSchema
- : CREATE SCHEMA notExistClause? createSchemaClauses
+ : CREATE SCHEMA ifNotExists? createSchemaClauses
;
createSchemaClauses
@@ -1968,7 +1968,7 @@ alterSchema
;
dropSchema
- : DROP SCHEMA existClause? nameList dropBehavior?
+ : DROP SCHEMA ifExists? nameList dropBehavior?
;
fetch
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussDDLStatementSQLVisitor.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussDDLStatementSQLVisitor.java
index 90cdd16782e..d33f621911b 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussDDLStatementSQLVisitor.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussDDLStatementSQLVisitor.java
@@ -259,7 +259,7 @@ public final class OpenGaussDDLStatementSQLVisitor extends OpenGaussStatementSQL
@SuppressWarnings("unchecked")
@Override
public ASTNode visitCreateTable(final CreateTableContext ctx) {
- OpenGaussCreateTableStatement result = new OpenGaussCreateTableStatement(null != ctx.notExistClause());
+ OpenGaussCreateTableStatement result = new OpenGaussCreateTableStatement(null != ctx.ifNotExists());
result.setTable((SimpleTableSegment) visit(ctx.tableName()));
if (null != ctx.createDefinitionClause()) {
CollectionValue<CreateDefinitionSegment> createDefinitions = (CollectionValue<CreateDefinitionSegment>) visit(ctx.createDefinitionClause());
@@ -488,7 +488,7 @@ public final class OpenGaussDDLStatementSQLVisitor extends OpenGaussStatementSQL
@SuppressWarnings("unchecked")
@Override
public ASTNode visitDropTable(final DropTableContext ctx) {
- OpenGaussDropTableStatement result = new OpenGaussDropTableStatement(null != ctx.existClause());
+ OpenGaussDropTableStatement result = new OpenGaussDropTableStatement(null != ctx.ifExists());
result.getTables().addAll(((CollectionValue<SimpleTableSegment>) visit(ctx.tableNames())).getValue());
return result;
}
@@ -546,7 +546,7 @@ public final class OpenGaussDDLStatementSQLVisitor extends OpenGaussStatementSQL
@SuppressWarnings("unchecked")
@Override
public ASTNode visitDropIndex(final DropIndexContext ctx) {
- OpenGaussDropIndexStatement result = new OpenGaussDropIndexStatement(null != ctx.existClause());
+ OpenGaussDropIndexStatement result = new OpenGaussDropIndexStatement(null != ctx.ifExists());
result.getIndexes().addAll(createIndexSegments(((CollectionValue<SimpleTableSegment>) visit(ctx.qualifiedNameList())).getValue()));
return result;
}
@@ -641,7 +641,7 @@ public final class OpenGaussDDLStatementSQLVisitor extends OpenGaussStatementSQL
public ASTNode visitDropDatabase(final DropDatabaseContext ctx) {
OpenGaussDropDatabaseStatement result = new OpenGaussDropDatabaseStatement();
result.setDatabaseName(((IdentifierValue) visit(ctx.name())).getValue());
- result.setIfExist(null != ctx.existClause());
+ result.setIfExists(null != ctx.ifExists());
return result;
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
index d5cf3842cc6..fdbbf3cacf3 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/BaseRule.g4
@@ -1849,12 +1849,12 @@ event
typeNameList
: typeName (COMMA_ typeName)*
;
-
-notExistClause
+
+ifNotExists
: IF NOT EXISTS
;
-
-existClause
+
+ifExists
: IF EXISTS
;
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DCLStatement.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DCLStatement.g4
index 8d5830ccd40..a7cfea5aabc 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DCLStatement.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DCLStatement.g4
@@ -59,7 +59,7 @@ alterOptRoleElem
;
dropUser
- : DROP USER existClause? roleList
+ : DROP USER ifExists? roleList
;
alterUser
@@ -82,7 +82,7 @@ createRole
;
dropRole
- : DROP ROLE existClause? roleList
+ : DROP ROLE ifExists? roleList
;
alterRole
@@ -94,7 +94,7 @@ createGroup
;
dropDroup
- : DROP GROUP existClause? roleList
+ : DROP GROUP ifExists? roleList
;
reassignOwned
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4
index 50ec724e105..24013968a6b 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/antlr4/imports/postgresql/DDLStatement.g4
@@ -22,7 +22,7 @@ import DMLStatement;
options {tokenVocab = ModeLexer;}
createTable
- : CREATE createTableSpecification TABLE notExistClause? tableName
+ : CREATE createTableSpecification TABLE ifNotExists? tableName
(createDefinitionClause | (OF anyName (LP_ typedTableElementList RP_)?) | (PARTITION OF qualifiedName (LP_ typedTableElementList RP_)? partitionBoundSpec))
inheritClause partitionSpec? tableAccessMethodClause? withOption? onCommitOption? tableSpace?
(AS select withData?)?
@@ -90,7 +90,7 @@ accessMethod
;
createIndex
- : CREATE createIndexSpecification INDEX concurrentlyClause (notExistClause? indexName)? ON onlyClause tableName
+ : CREATE createIndexSpecification INDEX concurrentlyClause (ifNotExists? indexName)? ON onlyClause tableName
accessMethodClause? LP_ indexParams RP_ include? (WITH reloptions)? tableSpace? whereClause?
;
@@ -127,11 +127,11 @@ columnElem
;
dropDatabase
- : DROP DATABASE existClause? name
+ : DROP DATABASE ifExists? name
;
dropGroup
- : DROP GROUP existClause? name (COMMA_ name)*
+ : DROP GROUP ifExists? name (COMMA_ name)*
;
createDatabaseSpecification
@@ -150,16 +150,16 @@ createdbOptName
alterTable
: ALTER TABLE
- ( existClause? onlyClause tableNameClause alterDefinitionClause
+ ( ifExists? onlyClause tableNameClause alterDefinitionClause
| ALL IN TABLESPACE tableNameClause (OWNED BY roleList)? SET TABLESPACE name NOWAIT?)
;
alterIndex
- : ALTER INDEX (existClause? | ALL IN TABLESPACE) qualifiedName alterIndexDefinitionClause
+ : ALTER INDEX (ifExists? | ALL IN TABLESPACE) qualifiedName alterIndexDefinitionClause
;
dropTable
- : DROP TABLE existClause? tableNames dropTableOpt?
+ : DROP TABLE ifExists? tableNames dropTableOpt?
;
dropTableOpt
@@ -167,7 +167,7 @@ dropTableOpt
;
dropIndex
- : DROP INDEX concurrentlyClause existClause? qualifiedNameList dropIndexOpt?
+ : DROP INDEX concurrentlyClause ifExists? qualifiedNameList dropIndexOpt?
;
dropIndexOpt
@@ -404,11 +404,11 @@ alterTableAction
;
addColumnSpecification
- : ADD COLUMN? notExistClause? columnDefinition
+ : ADD COLUMN? ifNotExists? columnDefinition
;
dropColumnSpecification
- : DROP COLUMN? existClause? columnName (RESTRICT | CASCADE)?
+ : DROP COLUMN? ifExists? columnName (RESTRICT | CASCADE)?
;
modifyColumnSpecification
@@ -418,7 +418,7 @@ modifyColumnSpecification
| modifyColumn (SET | DROP) NOT NULL
| modifyColumn ADD GENERATED (ALWAYS | (BY DEFAULT)) AS IDENTITY (LP_ sequenceOptions RP_)?
| modifyColumn alterColumnSetOption alterColumnSetOption*
- | modifyColumn DROP IDENTITY existClause?
+ | modifyColumn DROP IDENTITY ifExists?
| modifyColumn SET STATISTICS NUMBER_
| modifyColumn SET LP_ attributeOptions RP_
| modifyColumn RESET LP_ attributeOptions RP_
@@ -458,7 +458,7 @@ validateConstraintSpecification
;
dropConstraintSpecification
- : DROP CONSTRAINT existClause? constraintName (RESTRICT | CASCADE)?
+ : DROP CONSTRAINT ifExists? constraintName (RESTRICT | CASCADE)?
;
storageParameterWithValue
@@ -512,7 +512,7 @@ alterTableCmds
;
alterTableCmd
- : ADD COLUMN? notExistClause? columnDef
+ : ADD COLUMN? ifNotExists? columnDef
| ALTER COLUMN? colId alterColumnDefault
| ALTER COLUMN? colId DROP NOT NULL
| ALTER COLUMN? colId SET NOT NULL
@@ -525,15 +525,15 @@ alterTableCmd
| ALTER COLUMN? colId ADD GENERATED generatedWhen AS IDENTITY parenthesizedSeqOptList?
| ALTER COLUMN? colId alterIdentityColumnOptionList
| ALTER COLUMN? colId DROP IDENTITY
- | ALTER COLUMN? colId DROP IDENTITY existClause
- | DROP COLUMN? existClause colId dropBehavior?
+ | ALTER COLUMN? colId DROP IDENTITY ifExists
+ | DROP COLUMN? ifExists colId dropBehavior?
| DROP COLUMN? colId dropBehavior?
| ALTER COLUMN? colId setData? TYPE typeName collateClause? alterUsing?
| ALTER COLUMN? colId alterGenericOptions
| ADD tableConstraint (NOT VALID)?
| ALTER CONSTRAINT name constraintAttributeSpec
| VALIDATE CONSTRAINT name
- | DROP CONSTRAINT existClause name dropBehavior?
+ | DROP CONSTRAINT ifExists name dropBehavior?
| DROP CONSTRAINT name dropBehavior?
| SET WITHOUT OIDS
| CLUSTER ON name
@@ -816,7 +816,7 @@ alterDomain
alterDomainClause
: anyName (SET | DROP) NOT NULL
| anyName ADD tableConstraint (NOT VALID)?
- | anyName DROP CONSTRAINT existClause? name dropBehavior?
+ | anyName DROP CONSTRAINT ifExists? name dropBehavior?
| anyName VALIDATE CONSTRAINT name
| anyName RENAME CONSTRAINT constraintName TO constraintName
| anyName OWNER TO roleSpec
@@ -956,11 +956,11 @@ alterMaterializedView
;
alterMaterializedViewClauses
- : existClause? qualifiedName alterTableCmds
+ : ifExists? qualifiedName alterTableCmds
| qualifiedName DEPENDS ON EXTENSION name
- | existClause? qualifiedName RENAME COLUMN? columnName TO columnName
- | existClause? qualifiedName RENAME TO qualifiedName
- | existClause? qualifiedName SET SCHEMA schemaName
+ | ifExists? qualifiedName RENAME COLUMN? columnName TO columnName
+ | ifExists? qualifiedName RENAME TO qualifiedName
+ | ifExists? qualifiedName SET SCHEMA schemaName
| ALL IN TABLESPACE name (OWNED BY roleList) SET TABLESPACE name NOWAIT?
;
@@ -969,7 +969,7 @@ executeStmt
;
createMaterializedView
- : CREATE UNLOGGED? MATERIALIZED VIEW notExistClause? createMvTarget AS select (WITH DATA | WITH NO DATA)?
+ : CREATE UNLOGGED? MATERIALIZED VIEW ifNotExists? createMvTarget AS select (WITH DATA | WITH NO DATA)?
;
createMvTarget
@@ -1034,7 +1034,7 @@ alterRule
;
alterSequence
- : ALTER SEQUENCE existClause? qualifiedName alterSequenceClauses
+ : ALTER SEQUENCE ifExists? qualifiedName alterSequenceClauses
;
alterSequenceClauses
@@ -1056,7 +1056,7 @@ foreignServerVersion
alterStatistics
: ALTER STATISTICS
- ( existClause? anyName SET STATISTICS signedIconst
+ ( ifExists? anyName SET STATISTICS signedIconst
| anyName RENAME TO name
| anyName SET SCHEMA name
| anyName OWNER TO roleSpec)
@@ -1102,7 +1102,7 @@ alterTextSearchConfigurationClauses
| OWNER TO roleSpec
| (ADD | ALTER) MAPPING FOR nameList WITH? anyNameList
| ALTER MAPPING (FOR nameList)? REPLACE anyName WITH anyName
- | DROP MAPPING existClause? FOR nameList
+ | DROP MAPPING ifExists? FOR nameList
;
anyNameList
@@ -1135,7 +1135,7 @@ alterType
alterTypeClauses
: alterTypeCmds
- | ADD VALUE notExistClause? STRING_ ((BEFORE | AFTER) STRING_)?
+ | ADD VALUE ifNotExists? STRING_ ((BEFORE | AFTER) STRING_)?
| RENAME VALUE STRING_ TO STRING_
| RENAME TO name
| RENAME ATTRIBUTE name TO name dropBehavior?
@@ -1150,7 +1150,7 @@ alterTypeCmds
alterTypeCmd
: ADD ATTRIBUTE tableFuncElement dropBehavior?
- | DROP ATTRIBUTE existClause colId dropBehavior?
+ | DROP ATTRIBUTE ifExists colId dropBehavior?
| DROP ATTRIBUTE colId dropBehavior?
| ALTER ATTRIBUTE colId setData? TYPE typeName collateClause? dropBehavior?
;
@@ -1164,7 +1164,7 @@ authIdent
;
alterView
- : ALTER VIEW existClause? qualifiedName alterViewClauses
+ : ALTER VIEW ifExists? qualifiedName alterViewClauses
;
alterViewClauses
@@ -1297,7 +1297,7 @@ castContext
;
createCollation
- : CREATE COLLATION notExistClause? (anyName definition | anyName FROM anyName)
+ : CREATE COLLATION ifNotExists? (anyName definition | anyName FROM anyName)
;
createConversion
@@ -1325,7 +1325,7 @@ eventTriggerValueList
;
createExtension
- : CREATE EXTENSION notExistClause? name WITH? createExtensionOptList
+ : CREATE EXTENSION ifNotExists? name WITH? createExtensionOptList
;
createExtensionOptList
@@ -1348,9 +1348,9 @@ createForeignTable
;
createForeignTableClauses
- : notExistClause? qualifiedName LP_ tableElementList? RP_
+ : ifNotExists? qualifiedName LP_ tableElementList? RP_
(INHERITS LP_ qualifiedNameList RP_)? SERVER name createGenericOptions?
- | notExistClause? qualifiedName PARTITION OF qualifiedName (LP_ typedTableElementList RP_)? partitionBoundSpec
+ | ifNotExists? qualifiedName PARTITION OF qualifiedName (LP_ typedTableElementList RP_)? partitionBoundSpec
SERVER name createGenericOptions?
;
@@ -1557,7 +1557,7 @@ transitionOldOrNew
;
createSequence
- : CREATE tempOption? SEQUENCE notExistClause? qualifiedName seqOptList?
+ : CREATE tempOption? SEQUENCE ifNotExists? qualifiedName seqOptList?
;
tempOption
@@ -1565,11 +1565,11 @@ tempOption
;
createServer
- : CREATE SERVER notExistClause? name (TYPE STRING_)? foreignServerVersion? FOREIGN DATA WRAPPER name createGenericOptions
+ : CREATE SERVER ifNotExists? name (TYPE STRING_)? foreignServerVersion? FOREIGN DATA WRAPPER name createGenericOptions
;
createStatistics
- : CREATE STATISTICS notExistClause? anyName optNameList ON exprList FROM fromList
+ : CREATE STATISTICS ifNotExists? anyName optNameList ON exprList FROM fromList
;
createSubscription
@@ -1604,7 +1604,7 @@ enumValList
;
createUserMapping
- : CREATE USER MAPPING notExistClause? FOR authIdent SERVER name createGenericOptions
+ : CREATE USER MAPPING ifNotExists? FOR authIdent SERVER name createGenericOptions
;
discard
@@ -1612,11 +1612,11 @@ discard
;
dropAccessMethod
- : DROP ACCESS METHOD existClause? name dropBehavior?
+ : DROP ACCESS METHOD ifExists? name dropBehavior?
;
dropAggregate
- : DROP AGGREGATE existClause? aggregateWithArgtypesList dropBehavior?
+ : DROP AGGREGATE ifExists? aggregateWithArgtypesList dropBehavior?
;
aggregateWithArgtypesList
@@ -1624,39 +1624,39 @@ aggregateWithArgtypesList
;
dropCast
- : DROP CAST existClause? LP_ typeName AS typeName RP_ dropBehavior?
+ : DROP CAST ifExists? LP_ typeName AS typeName RP_ dropBehavior?
;
dropCollation
- : DROP COLLATION existClause? name dropBehavior?
+ : DROP COLLATION ifExists? name dropBehavior?
;
dropConversion
- : DROP CONVERSION existClause? name dropBehavior?
+ : DROP CONVERSION ifExists? name dropBehavior?
;
dropDomain
- : DROP DOMAIN existClause? nameList dropBehavior?
+ : DROP DOMAIN ifExists? nameList dropBehavior?
;
dropEventTrigger
- : DROP EVENT TRIGGER existClause? nameList dropBehavior?
+ : DROP EVENT TRIGGER ifExists? nameList dropBehavior?
;
dropExtension
- : DROP EXTENSION existClause? nameList dropBehavior?
+ : DROP EXTENSION ifExists? nameList dropBehavior?
;
dropForeignDataWrapper
- : DROP FOREIGN DATA WRAPPER existClause? nameList dropBehavior?
+ : DROP FOREIGN DATA WRAPPER ifExists? nameList dropBehavior?
;
dropForeignTable
- : DROP FOREIGN TABLE existClause? tableName (COMMA_ tableName)* dropBehavior?
+ : DROP FOREIGN TABLE ifExists? tableName (COMMA_ tableName)* dropBehavior?
;
dropFunction
- : DROP FUNCTION existClause? functionWithArgtypesList dropBehavior?
+ : DROP FUNCTION ifExists? functionWithArgtypesList dropBehavior?
;
functionWithArgtypesList
@@ -1664,15 +1664,15 @@ functionWithArgtypesList
;
dropLanguage
- : DROP PROCEDURAL? LANGUAGE existClause? name dropBehavior?
+ : DROP PROCEDURAL? LANGUAGE ifExists? name dropBehavior?
;
dropMaterializedView
- : DROP MATERIALIZED VIEW existClause? anyNameList dropBehavior?
+ : DROP MATERIALIZED VIEW ifExists? anyNameList dropBehavior?
;
dropOperator
- : DROP OPERATOR existClause? operatorWithArgtypesList dropBehavior?
+ : DROP OPERATOR ifExists? operatorWithArgtypesList dropBehavior?
;
operatorWithArgtypesList
@@ -1680,11 +1680,11 @@ operatorWithArgtypesList
;
dropOperatorClass
- : DROP OPERATOR CLASS existClause? anyName USING name dropBehavior?
+ : DROP OPERATOR CLASS ifExists? anyName USING name dropBehavior?
;
dropOperatorFamily
- : DROP OPERATOR FAMILY existClause? anyName USING name dropBehavior?
+ : DROP OPERATOR FAMILY ifExists? anyName USING name dropBehavior?
;
dropOwned
@@ -1692,67 +1692,67 @@ dropOwned
;
dropPolicy
- : DROP POLICY existClause? name ON tableName dropBehavior?
+ : DROP POLICY ifExists? name ON tableName dropBehavior?
;
dropProcedure
- : DROP PROCEDURE existClause? functionWithArgtypesList dropBehavior?
+ : DROP PROCEDURE ifExists? functionWithArgtypesList dropBehavior?
;
dropPublication
- : DROP PUBLICATION existClause? anyNameList dropBehavior?
+ : DROP PUBLICATION ifExists? anyNameList dropBehavior?
;
dropRoutine
- : DROP ROUTINE existClause? functionWithArgtypesList dropBehavior?
+ : DROP ROUTINE ifExists? functionWithArgtypesList dropBehavior?
;
dropRule
- : DROP RULE existClause? name ON tableName dropBehavior?
+ : DROP RULE ifExists? name ON tableName dropBehavior?
;
dropSequence
- : DROP SEQUENCE existClause? qualifiedNameList dropBehavior?
+ : DROP SEQUENCE ifExists? qualifiedNameList dropBehavior?
;
dropServer
- : DROP SERVER existClause? qualifiedNameList dropBehavior?
+ : DROP SERVER ifExists? qualifiedNameList dropBehavior?
;
dropStatistics
- : DROP STATISTICS existClause? qualifiedNameList dropBehavior?
+ : DROP STATISTICS ifExists? qualifiedNameList dropBehavior?
;
dropSubscription
- : DROP SUBSCRIPTION existClause? qualifiedName dropBehavior?
+ : DROP SUBSCRIPTION ifExists? qualifiedName dropBehavior?
;
dropTablespace
- : DROP TABLESPACE existClause? qualifiedName
+ : DROP TABLESPACE ifExists? qualifiedName
;
dropTextSearch
- : DROP TEXT SEARCH (CONFIGURATION | DICTIONARY | PARSER | TEMPLATE) existClause? qualifiedName dropBehavior?
+ : DROP TEXT SEARCH (CONFIGURATION | DICTIONARY | PARSER | TEMPLATE) ifExists? qualifiedName dropBehavior?
;
dropTransform
- : DROP TRANSFORM existClause? FOR typeName LANGUAGE name dropBehavior?
+ : DROP TRANSFORM ifExists? FOR typeName LANGUAGE name dropBehavior?
;
dropTrigger
- : DROP TRIGGER existClause? qualifiedName ON tableName dropBehavior?
+ : DROP TRIGGER ifExists? qualifiedName ON tableName dropBehavior?
;
dropType
- : DROP TYPE existClause? anyNameList dropBehavior?
+ : DROP TYPE ifExists? anyNameList dropBehavior?
;
dropUserMapping
- : DROP USER MAPPING existClause? FOR authIdent SERVER name
+ : DROP USER MAPPING ifExists? FOR authIdent SERVER name
;
dropView
- : DROP VIEW existClause? qualifiedNameList dropBehavior?
+ : DROP VIEW ifExists? qualifiedNameList dropBehavior?
;
importForeignSchema
@@ -1855,7 +1855,7 @@ reindexTargetType
;
alterForeignTable
- : ALTER FOREIGN TABLE existClause? relationExpr alterForeignTableClauses
+ : ALTER FOREIGN TABLE ifExists? relationExpr alterForeignTableClauses
;
alterForeignTableClauses
@@ -1899,7 +1899,7 @@ unlisten
;
createSchema
- : CREATE SCHEMA notExistClause? createSchemaClauses
+ : CREATE SCHEMA ifNotExists? createSchemaClauses
;
createSchemaClauses
@@ -1987,5 +1987,5 @@ alterSchema
;
dropSchema
- : DROP SCHEMA existClause? nameList dropBehavior?
+ : DROP SCHEMA ifExists? nameList dropBehavior?
;
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLDDLStatementSQLVisitor.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLDDLStatementSQLVisitor.java
index ede50027119..5479b917162 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLDDLStatementSQLVisitor.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLDDLStatementSQLVisitor.java
@@ -291,7 +291,7 @@ public final class PostgreSQLDDLStatementSQLVisitor extends PostgreSQLStatementS
@SuppressWarnings("unchecked")
@Override
public ASTNode visitCreateTable(final CreateTableContext ctx) {
- PostgreSQLCreateTableStatement result = new PostgreSQLCreateTableStatement(null != ctx.notExistClause());
+ PostgreSQLCreateTableStatement result = new PostgreSQLCreateTableStatement(null != ctx.ifNotExists());
result.setTable((SimpleTableSegment) visit(ctx.tableName()));
if (null != ctx.createDefinitionClause()) {
CollectionValue<CreateDefinitionSegment> createDefinitions = (CollectionValue<CreateDefinitionSegment>) visit(ctx.createDefinitionClause());
@@ -550,7 +550,7 @@ public final class PostgreSQLDDLStatementSQLVisitor extends PostgreSQLStatementS
@SuppressWarnings("unchecked")
@Override
public ASTNode visitDropTable(final DropTableContext ctx) {
- PostgreSQLDropTableStatement result = new PostgreSQLDropTableStatement(null != ctx.existClause());
+ PostgreSQLDropTableStatement result = new PostgreSQLDropTableStatement(null != ctx.ifExists());
result.getTables().addAll(((CollectionValue<SimpleTableSegment>) visit(ctx.tableNames())).getValue());
return result;
}
@@ -633,7 +633,7 @@ public final class PostgreSQLDDLStatementSQLVisitor extends PostgreSQLStatementS
@SuppressWarnings("unchecked")
@Override
public ASTNode visitDropIndex(final DropIndexContext ctx) {
- PostgreSQLDropIndexStatement result = new PostgreSQLDropIndexStatement(null != ctx.existClause());
+ PostgreSQLDropIndexStatement result = new PostgreSQLDropIndexStatement(null != ctx.ifExists());
result.getIndexes().addAll(createIndexSegments(((CollectionValue<SimpleTableSegment>) visit(ctx.qualifiedNameList())).getValue()));
return result;
}
@@ -733,7 +733,7 @@ public final class PostgreSQLDDLStatementSQLVisitor extends PostgreSQLStatementS
public ASTNode visitDropDatabase(final DropDatabaseContext ctx) {
PostgreSQLDropDatabaseStatement result = new PostgreSQLDropDatabaseStatement();
result.setDatabaseName(((IdentifierValue) visit(ctx.name())).getValue());
- result.setIfExist(null != ctx.existClause());
+ result.setIfExists(null != ctx.ifExists());
return result;
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/BaseRule.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/BaseRule.g4
index 30dc08f6660..9687962fa65 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/BaseRule.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/BaseRule.g4
@@ -510,3 +510,7 @@ savepointVariableName
entityType
: OBJECT | TYPE
;
+
+ifExists
+ : IF EXISTS
+ ;
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/DCLStatement.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/DCLStatement.g4
index c101c6cc49e..103d7405cb2 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/DCLStatement.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/DCLStatement.g4
@@ -334,7 +334,7 @@ ignoredNameIdentifier
;
dropUser
- : DROP USER (IF EXISTS)? userName
+ : DROP USER ifExists? userName
;
alterUser
@@ -355,7 +355,7 @@ createRole
;
dropRole
- : DROP ROLE (IF EXISTS)? name
+ : DROP ROLE ifExists? name
;
alterRole
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/DDLStatement.g4 b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/DDLStatement.g4
index 1c73707fd1c..75df70ed362 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/DDLStatement.g4
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/antlr4/imports/sqlserver/DDLStatement.g4
@@ -104,35 +104,35 @@ alterSchema
;
dropTable
- : DROP TABLE ifExist? tableNames
+ : DROP TABLE ifExists? tableNames
;
dropIndex
- : DROP INDEX ifExist? indexName ON tableName
+ : DROP INDEX ifExists? indexName ON tableName
;
dropDatabase
- : DROP DATABASE ifExist? databaseName (COMMA_ databaseName)*
+ : DROP DATABASE ifExists? databaseName (COMMA_ databaseName)*
;
dropFunction
- : DROP FUNCTION ifExist? functionName (COMMA_ functionName)*
+ : DROP FUNCTION ifExists? functionName (COMMA_ functionName)*
;
dropProcedure
- : DROP (PROC | PROCEDURE) ifExist? procedureName (COMMA_ procedureName)*
+ : DROP (PROC | PROCEDURE) ifExists? procedureName (COMMA_ procedureName)*
;
dropView
- : DROP VIEW ifExist? viewName (COMMA_ viewName)*
+ : DROP VIEW ifExists? viewName (COMMA_ viewName)*
;
dropTrigger
- : DROP TRIGGER ifExist? triggerName (COMMA_ triggerName)* (ON (DATABASE | ALL SERVER))?
+ : DROP TRIGGER ifExists? triggerName (COMMA_ triggerName)* (ON (DATABASE | ALL SERVER))?
;
dropSequence
- : DROP SEQUENCE ifExist? sequenceName (COMMA_ sequenceName)*
+ : DROP SEQUENCE ifExists? sequenceName (COMMA_ sequenceName)*
;
dropService
@@ -140,7 +140,7 @@ dropService
;
dropSchema
- : DROP SCHEMA (IF EXISTS)? schemaName
+ : DROP SCHEMA ifExists? schemaName
;
truncateTable
@@ -450,7 +450,7 @@ alterDrop
;
alterTableDropConstraint
- : CONSTRAINT? ifExist? dropConstraintName (COMMA_ dropConstraintName)*
+ : CONSTRAINT? ifExists? dropConstraintName (COMMA_ dropConstraintName)*
;
dropConstraintName
@@ -470,11 +470,11 @@ onOffOption
;
dropColumnSpecification
- : COLUMN ifExist? columnName (COMMA_ columnName)*
+ : COLUMN ifExists? columnName (COMMA_ columnName)*
;
dropIndexSpecification
- : INDEX ifExist? indexName (COMMA_ indexName)*
+ : INDEX ifExists? indexName (COMMA_ indexName)*
;
alterCheckConstraint
@@ -548,7 +548,7 @@ onHistoryTableClause
: LP_ HISTORY_TABLE EQ_ tableName (COMMA_ DATA_CONSISTENCY_CHECK EQ_ onOffOption)? RP_
;
-ifExist
+ifExists
: IF EXISTS
;
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerDDLStatementSQLVisitor.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerDDLStatementSQLVisitor.java
index d55d5379b39..cc16295a9e5 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerDDLStatementSQLVisitor.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-sqlserver/src/main/java/org/apache/shardingsphere/sql/parser/sqlserver/visitor/statement/impl/SQLServerDDLStatementSQLVisitor.java
@@ -310,7 +310,7 @@ public final class SQLServerDDLStatementSQLVisitor extends SQLServerStatementSQL
@SuppressWarnings("unchecked")
@Override
public ASTNode visitDropTable(final DropTableContext ctx) {
- SQLServerDropTableStatement result = new SQLServerDropTableStatement(null != ctx.ifExist());
+ SQLServerDropTableStatement result = new SQLServerDropTableStatement(null != ctx.ifExists());
result.getTables().addAll(((CollectionValue<SimpleTableSegment>) visit(ctx.tableNames())).getValue());
return result;
}
@@ -357,7 +357,7 @@ public final class SQLServerDDLStatementSQLVisitor extends SQLServerStatementSQL
@Override
public ASTNode visitDropIndex(final DropIndexContext ctx) {
- SQLServerDropIndexStatement result = new SQLServerDropIndexStatement(null != ctx.ifExist());
+ SQLServerDropIndexStatement result = new SQLServerDropIndexStatement(null != ctx.ifExists());
result.getIndexes().add((IndexSegment) visit(ctx.indexName()));
result.setTable((SimpleTableSegment) visit(ctx.tableName()));
return result;
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/extractor/TableExtractor.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/extractor/TableExtractor.java
index 153f5519775..0ff5735c2fc 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/extractor/TableExtractor.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/extractor/TableExtractor.java
@@ -318,7 +318,7 @@ public final class TableExtractor {
Collection<SimpleTableSegment> result = new LinkedList<>();
for (ValidStatementSegment each : routineBody.getValidStatements()) {
Optional<CreateTableStatement> createTable = each.getCreateTable();
- if (createTable.isPresent() && !CreateTableStatementHandler.containsNotExistClause(createTable.get())) {
+ if (createTable.isPresent() && !CreateTableStatementHandler.ifNotExists(createTable.get())) {
result.add(createTable.get().getTable());
}
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/CreateDatabaseStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/CreateDatabaseStatement.java
index 7c43259ef0e..c49d8d2aac0 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/CreateDatabaseStatement.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/CreateDatabaseStatement.java
@@ -32,5 +32,5 @@ public abstract class CreateDatabaseStatement extends AbstractSQLStatement imple
private String databaseName;
- private boolean ifNotExist;
+ private boolean ifNotExists;
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/DropDatabaseStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/DropDatabaseStatement.java
index 21d20521e46..58d2417e131 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/DropDatabaseStatement.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/ddl/DropDatabaseStatement.java
@@ -30,7 +30,7 @@ import org.apache.shardingsphere.sql.parser.sql.common.statement.AbstractSQLStat
@ToString
public abstract class DropDatabaseStatement extends AbstractSQLStatement implements DDLStatement {
- private boolean ifExist;
+ private boolean ifExists;
private String databaseName;
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/CreateTableStatementHandler.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/CreateTableStatementHandler.java
index 420e129d17a..fc194421782 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/CreateTableStatementHandler.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/CreateTableStatementHandler.java
@@ -43,20 +43,20 @@ import java.util.Optional;
public final class CreateTableStatementHandler implements SQLStatementHandler {
/**
- * Judge whether contains not exist clause or not.
+ * Judge whether if not exists.
*
* @param createTableStatement create table statement
- * @return whether contains not exist clause or not
+ * @return if not exists or not
*/
- public static boolean containsNotExistClause(final CreateTableStatement createTableStatement) {
+ public static boolean ifNotExists(final CreateTableStatement createTableStatement) {
if (createTableStatement instanceof MySQLStatement) {
- return ((MySQLCreateTableStatement) createTableStatement).isIfNotExist();
+ return ((MySQLCreateTableStatement) createTableStatement).isIfNotExists();
}
if (createTableStatement instanceof PostgreSQLStatement) {
- return ((PostgreSQLCreateTableStatement) createTableStatement).isIfNotExist();
+ return ((PostgreSQLCreateTableStatement) createTableStatement).isIfNotExists();
}
if (createTableStatement instanceof OpenGaussStatement) {
- return ((OpenGaussCreateTableStatement) createTableStatement).isIfNotExist();
+ return ((OpenGaussCreateTableStatement) createTableStatement).isIfNotExists();
}
return false;
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/DropIndexStatementHandler.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/DropIndexStatementHandler.java
index 9ec3ab9adb8..348bd4ddb2f 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/DropIndexStatementHandler.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/DropIndexStatementHandler.java
@@ -61,15 +61,15 @@ public final class DropIndexStatementHandler implements SQLStatementHandler {
* @param dropIndexStatement drop index statement
* @return whether contains exist clause or not
*/
- public static boolean containsExistClause(final DropIndexStatement dropIndexStatement) {
+ public static boolean ifExists(final DropIndexStatement dropIndexStatement) {
if (dropIndexStatement instanceof PostgreSQLStatement) {
- return ((PostgreSQLDropIndexStatement) dropIndexStatement).isIfExist();
+ return ((PostgreSQLDropIndexStatement) dropIndexStatement).isIfExists();
}
if (dropIndexStatement instanceof SQLServerStatement) {
- return ((SQLServerDropIndexStatement) dropIndexStatement).isIfExist();
+ return ((SQLServerDropIndexStatement) dropIndexStatement).isIfExists();
}
if (dropIndexStatement instanceof OpenGaussStatement) {
- return ((OpenGaussDropIndexStatement) dropIndexStatement).isIfExist();
+ return ((OpenGaussDropIndexStatement) dropIndexStatement).isIfExists();
}
return false;
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/DropTableStatementHandler.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/DropTableStatementHandler.java
index 11e3c5051a9..a9ece13ee0d 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/DropTableStatementHandler.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/DropTableStatementHandler.java
@@ -37,23 +37,23 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.ddl.
public final class DropTableStatementHandler implements SQLStatementHandler {
/**
- * Judge whether contains exist clause or not.
+ * Judge whether contains if exists.
*
* @param dropTableStatement drop table statement
- * @return whether contains exist clause or not
+ * @return contains contains if exists or not
*/
- public static boolean containsExistClause(final DropTableStatement dropTableStatement) {
+ public static boolean ifExists(final DropTableStatement dropTableStatement) {
if (dropTableStatement instanceof MySQLStatement) {
- return ((MySQLDropTableStatement) dropTableStatement).isIfExist();
+ return ((MySQLDropTableStatement) dropTableStatement).isIfExists();
}
if (dropTableStatement instanceof PostgreSQLStatement) {
- return ((PostgreSQLDropTableStatement) dropTableStatement).isIfExist();
+ return ((PostgreSQLDropTableStatement) dropTableStatement).isIfExists();
}
if (dropTableStatement instanceof SQLServerStatement) {
- return ((SQLServerDropTableStatement) dropTableStatement).isIfExist();
+ return ((SQLServerDropTableStatement) dropTableStatement).isIfExists();
}
if (dropTableStatement instanceof OpenGaussStatement) {
- return ((OpenGaussDropTableStatement) dropTableStatement).isIfExist();
+ return ((OpenGaussDropTableStatement) dropTableStatement).isIfExists();
}
return false;
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dal/MySQLResetPersistStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dal/MySQLResetPersistStatement.java
index 2c3ac1b6996..45eae796dd2 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dal/MySQLResetPersistStatement.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/dal/MySQLResetPersistStatement.java
@@ -33,7 +33,7 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.MySQLSta
@ToString
public final class MySQLResetPersistStatement extends AbstractSQLStatement implements DALStatement, MySQLStatement {
- private final boolean ifExist;
+ private final boolean ifExists;
private final IdentifierValue identifier;
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/ddl/MySQLCreateTableStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/ddl/MySQLCreateTableStatement.java
index a1d0575995e..0a14ca792b6 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/ddl/MySQLCreateTableStatement.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/ddl/MySQLCreateTableStatement.java
@@ -31,5 +31,5 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.MySQLSta
@ToString
public final class MySQLCreateTableStatement extends CreateTableStatement implements MySQLStatement {
- private final boolean ifNotExist;
+ private final boolean ifNotExists;
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/ddl/MySQLDropTableStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/ddl/MySQLDropTableStatement.java
index 5da48312b65..bbbeea51b3a 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/ddl/MySQLDropTableStatement.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/mysql/ddl/MySQLDropTableStatement.java
@@ -31,5 +31,5 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.mysql.MySQLSta
@ToString
public final class MySQLDropTableStatement extends DropTableStatement implements MySQLStatement {
- private final boolean ifExist;
+ private final boolean ifExists;
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussCreateTableStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussCreateTableStatement.java
index 61684f69011..376ff8547e9 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussCreateTableStatement.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussCreateTableStatement.java
@@ -31,5 +31,5 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.Open
@ToString
public final class OpenGaussCreateTableStatement extends CreateTableStatement implements OpenGaussStatement {
- private final boolean ifNotExist;
+ private final boolean ifNotExists;
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussDropIndexStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussDropIndexStatement.java
index ad2d26d7e82..ed6a76ee7e8 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussDropIndexStatement.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussDropIndexStatement.java
@@ -31,5 +31,5 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.Open
@ToString
public final class OpenGaussDropIndexStatement extends DropIndexStatement implements OpenGaussStatement {
- private final boolean ifExist;
+ private final boolean ifExists;
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussDropTableStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussDropTableStatement.java
index c54d528e840..d6ae916d3c9 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussDropTableStatement.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/opengauss/ddl/OpenGaussDropTableStatement.java
@@ -31,5 +31,5 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.opengauss.Open
@ToString
public final class OpenGaussDropTableStatement extends DropTableStatement implements OpenGaussStatement {
- private final boolean ifExist;
+ private final boolean ifExists;
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLCreateTableStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLCreateTableStatement.java
index 2dca925c125..9c54bd085f6 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLCreateTableStatement.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLCreateTableStatement.java
@@ -31,5 +31,5 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.Pos
@ToString
public final class PostgreSQLCreateTableStatement extends CreateTableStatement implements PostgreSQLStatement {
- private final boolean ifNotExist;
+ private final boolean ifNotExists;
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLDropIndexStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLDropIndexStatement.java
index a4dd0ed2853..28915814b57 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLDropIndexStatement.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLDropIndexStatement.java
@@ -31,5 +31,5 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.Pos
@ToString
public final class PostgreSQLDropIndexStatement extends DropIndexStatement implements PostgreSQLStatement {
- private final boolean ifExist;
+ private final boolean ifExists;
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLDropTableStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLDropTableStatement.java
index 0f68a48b392..70eb05bfda5 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLDropTableStatement.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/postgresql/ddl/PostgreSQLDropTableStatement.java
@@ -31,5 +31,5 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.postgresql.Pos
@ToString
public final class PostgreSQLDropTableStatement extends DropTableStatement implements PostgreSQLStatement {
- private final boolean ifExist;
+ private final boolean ifExists;
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/ddl/SQLServerDropIndexStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/ddl/SQLServerDropIndexStatement.java
index 326a33d950b..36d0ec3c559 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/ddl/SQLServerDropIndexStatement.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/ddl/SQLServerDropIndexStatement.java
@@ -36,7 +36,7 @@ import java.util.Optional;
@ToString
public final class SQLServerDropIndexStatement extends DropIndexStatement implements SQLServerStatement {
- private final boolean ifExist;
+ private final boolean ifExists;
private SimpleTableSegment table;
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/ddl/SQLServerDropTableStatement.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/ddl/SQLServerDropTableStatement.java
index c10810a4fef..c9f3126b118 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/ddl/SQLServerDropTableStatement.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/statement/sqlserver/ddl/SQLServerDropTableStatement.java
@@ -31,5 +31,5 @@ import org.apache.shardingsphere.sql.parser.sql.dialect.statement.sqlserver.SQLS
@ToString
public final class SQLServerDropTableStatement extends DropTableStatement implements SQLServerStatement {
- private final boolean ifExist;
+ private final boolean ifExists;
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/CreateTableStatementHandlerTest.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/CreateTableStatementHandlerTest.java
index 17c30fd4d07..653d7bc0fbd 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/CreateTableStatementHandlerTest.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/CreateTableStatementHandlerTest.java
@@ -30,37 +30,37 @@ import static org.junit.Assert.assertTrue;
public final class CreateTableStatementHandlerTest {
@Test
- public void assertContainsIfNotExistClauseForMySQL() {
- assertTrue(CreateTableStatementHandler.containsNotExistClause(new MySQLCreateTableStatement(true)));
+ public void assertContainsIfNotExistsForMySQL() {
+ assertTrue(CreateTableStatementHandler.ifNotExists(new MySQLCreateTableStatement(true)));
}
@Test
- public void assertContainsIfNotExistClauseForPostgreSQL() {
- assertTrue(CreateTableStatementHandler.containsNotExistClause(new PostgreSQLCreateTableStatement(true)));
+ public void assertContainsIfNotExistsForPostgreSQL() {
+ assertTrue(CreateTableStatementHandler.ifNotExists(new PostgreSQLCreateTableStatement(true)));
}
@Test
- public void assertNotContainsIfNotExistClauseForMySQL() {
- assertFalse(CreateTableStatementHandler.containsNotExistClause(new MySQLCreateTableStatement(false)));
+ public void assertNotContainsIfNotExistsForMySQL() {
+ assertFalse(CreateTableStatementHandler.ifNotExists(new MySQLCreateTableStatement(false)));
}
@Test
- public void assertNotContainsIfNotExistClauseForOracle() {
- assertFalse(CreateTableStatementHandler.containsNotExistClause(new OracleCreateTableStatement()));
+ public void assertNotContainsIfNotExistsForOracle() {
+ assertFalse(CreateTableStatementHandler.ifNotExists(new OracleCreateTableStatement()));
}
@Test
- public void assertNotContainsIfNotExistClauseForPostgreSQL() {
- assertFalse(CreateTableStatementHandler.containsNotExistClause(new PostgreSQLCreateTableStatement(false)));
+ public void assertNotContainsIfNotExistsForPostgreSQL() {
+ assertFalse(CreateTableStatementHandler.ifNotExists(new PostgreSQLCreateTableStatement(false)));
}
@Test
- public void assertNotContainsNotExistClauseForSQL92() {
- assertFalse(CreateTableStatementHandler.containsNotExistClause(new SQL92CreateTableStatement()));
+ public void assertNotContainsIfNotExistsForSQL92() {
+ assertFalse(CreateTableStatementHandler.ifNotExists(new SQL92CreateTableStatement()));
}
@Test
- public void assertNotContainsIfNotExistClauseForSQLServer() {
- assertFalse(CreateTableStatementHandler.containsNotExistClause(new SQLServerCreateTableStatement()));
+ public void assertNotContainsIfNotExistsForSQLServer() {
+ assertFalse(CreateTableStatementHandler.ifNotExists(new SQLServerCreateTableStatement()));
}
}
diff --git a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/DropTableStatementHandlerTest.java b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/DropTableStatementHandlerTest.java
index 74180436c96..ee371d31c57 100644
--- a/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/DropTableStatementHandlerTest.java
+++ b/shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/test/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/ddl/DropTableStatementHandlerTest.java
@@ -30,42 +30,42 @@ import static org.junit.Assert.assertTrue;
public final class DropTableStatementHandlerTest {
@Test
- public void assertContainsIfExistClauseForMySQL() {
- assertTrue(DropTableStatementHandler.containsExistClause(new MySQLDropTableStatement(true)));
+ public void assertContainsIfExistsForMySQL() {
+ assertTrue(DropTableStatementHandler.ifExists(new MySQLDropTableStatement(true)));
}
@Test
- public void assertContainsIfExistClauseForPostgreSQL() {
- assertTrue(DropTableStatementHandler.containsExistClause(new PostgreSQLDropTableStatement(true)));
+ public void assertContainsIfExistsForPostgreSQL() {
+ assertTrue(DropTableStatementHandler.ifExists(new PostgreSQLDropTableStatement(true)));
}
@Test
- public void assertContainsIfExistClauseForSQLServer() {
- assertTrue(DropTableStatementHandler.containsExistClause(new SQLServerDropTableStatement(true)));
+ public void assertContainsIfExistsForSQLServer() {
+ assertTrue(DropTableStatementHandler.ifExists(new SQLServerDropTableStatement(true)));
}
@Test
- public void assertNotContainsIfExistClauseForMySQL() {
- assertFalse(DropTableStatementHandler.containsExistClause(new MySQLDropTableStatement(false)));
+ public void assertNotContainsIfExistsForMySQL() {
+ assertFalse(DropTableStatementHandler.ifExists(new MySQLDropTableStatement(false)));
}
@Test
- public void assertNotContainsIfExistClauseForOracle() {
- assertFalse(DropTableStatementHandler.containsExistClause(new OracleDropTableStatement()));
+ public void assertNotContainsIfExistsForOracle() {
+ assertFalse(DropTableStatementHandler.ifExists(new OracleDropTableStatement()));
}
@Test
- public void assertNotContainsIfExistClauseForPostgreSQL() {
- assertFalse(DropTableStatementHandler.containsExistClause(new PostgreSQLDropTableStatement(false)));
+ public void assertNotContainsIfExistsForPostgreSQL() {
+ assertFalse(DropTableStatementHandler.ifExists(new PostgreSQLDropTableStatement(false)));
}
@Test
- public void assertNotContainsIfExistClauseForSQL92() {
- assertFalse(DropTableStatementHandler.containsExistClause(new SQL92DropTableStatement()));
+ public void assertNotContainsIfExistsForSQL92() {
+ assertFalse(DropTableStatementHandler.ifExists(new SQL92DropTableStatement()));
}
@Test
- public void assertNotContainsIfExistClauseForSQLServer() {
- assertFalse(DropTableStatementHandler.containsExistClause(new SQLServerDropTableStatement(false)));
+ public void assertNotContainsIfExistsForSQLServer() {
+ assertFalse(DropTableStatementHandler.ifExists(new SQLServerDropTableStatement(false)));
}
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/MySQLResetPersistStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/MySQLResetPersistStatementAssert.java
index 10cd2d3d39b..d6942b4462c 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/MySQLResetPersistStatementAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dal/impl/MySQLResetPersistStatementAssert.java
@@ -40,7 +40,7 @@ public final class MySQLResetPersistStatementAssert {
* @param expected expected reset persist statement test case
*/
public static void assertIs(final SQLCaseAssertContext assertContext, final MySQLResetPersistStatement actual, final ResetPersistStatementTestCase expected) {
- assertThat(assertContext.getText("Actual reset persist exist clause does not match: "), actual.isIfExist(), is(expected.isContainsExistClause()));
+ assertThat(assertContext.getText("Actual reset persist exist clause does not match: "), actual.isIfExists(), is(expected.isIfExists()));
if (null != expected.getIdentifier()) {
assertThat(assertContext.getText("Actual reset persist identifier does not match: "), actual.getIdentifier().getValue(), is(expected.getIdentifier()));
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/DropResourceStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/DropResourceStatementAssert.java
index 17efea6be0a..87b9ec9c919 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/DropResourceStatementAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/DropResourceStatementAssert.java
@@ -46,7 +46,7 @@ public final class DropResourceStatementAssert {
} else {
assertThat(assertContext.getText("resource assertion error: "), actual.getNames(), is(expected.getDataSources()));
assertThat(assertContext.getText("resource assertion error: "), actual.isIgnoreSingleTables(), is(expected.getIgnoreSingleTables().iterator().next()));
- assertThat(assertContext.getText("resource assertion error: "), actual.isIfExist(), is(expected.isContainsExistClause()));
+ assertThat(assertContext.getText("resource assertion error: "), actual.isIfExists(), is(expected.isIfExists()));
}
}
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropDatabaseDiscoveryHeartbeatStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropDatabaseDiscoveryHeartbeatStatementAssert.java
index 1bceee1b623..39a47f9ef04 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropDatabaseDiscoveryHeartbeatStatementAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropDatabaseDiscoveryHeartbeatStatementAssert.java
@@ -47,7 +47,7 @@ public final class DropDatabaseDiscoveryHeartbeatStatementAssert {
} else {
assertNotNull(assertContext.getText("Actual statement should exist."), actual);
assertThat(assertContext.getText("database discovery heartbeat assertion error: "), actual.getHeartbeatNames(), is(expected.getHeartbeats()));
- assertThat(assertContext.getText("database discovery heartbeat assertion error: "), actual.isIfExist(), is(expected.isContainsExistClause()));
+ assertThat(assertContext.getText("database discovery heartbeat assertion error: "), actual.isIfExists(), is(expected.isIfExists()));
}
}
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropDatabaseDiscoveryTypeStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropDatabaseDiscoveryTypeStatementAssert.java
index d5e26859fcf..54179742e3c 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropDatabaseDiscoveryTypeStatementAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropDatabaseDiscoveryTypeStatementAssert.java
@@ -47,7 +47,7 @@ public final class DropDatabaseDiscoveryTypeStatementAssert {
} else {
assertNotNull(assertContext.getText("Actual statement should exist."), actual);
assertThat(assertContext.getText("database discovery type assertion error: "), actual.getTypes(), is(expected.getTypes()));
- assertThat(assertContext.getText("database discovery type assertion error: "), actual.isIfExist(), is(expected.isContainsExistClause()));
+ assertThat(assertContext.getText("database discovery type assertion error: "), actual.isIfExists(), is(expected.isIfExists()));
}
}
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropDefaultShardingStrategyStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropDefaultShardingStrategyStatementAssert.java
index 7522273e051..b78ce05806d 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropDefaultShardingStrategyStatementAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropDefaultShardingStrategyStatementAssert.java
@@ -47,7 +47,7 @@ public final class DropDefaultShardingStrategyStatementAssert {
} else {
assertNotNull(assertContext.getText("Actual statement should exist."), actual);
assertThat(assertContext.getText("default sharding strategy assertion error: "), actual.getDefaultType(), is(expected.getDefaultType()));
- assertThat(assertContext.getText("default sharding strategy assertion error: "), actual.isIfExist(), is(expected.isContainsExistClause()));
+ assertThat(assertContext.getText("default sharding strategy assertion error: "), actual.isIfExists(), is(expected.isIfExists()));
}
}
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropDefaultSingleTableRuleAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropDefaultSingleTableRuleAssert.java
index ce76c5942bd..06333d22074 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropDefaultSingleTableRuleAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropDefaultSingleTableRuleAssert.java
@@ -47,7 +47,7 @@ public final class DropDefaultSingleTableRuleAssert {
assertNull(assertContext.getText("Actual statement should not exist."), actual);
} else {
assertNotNull(assertContext.getText("Actual statement should exist."), actual);
- assertThat(assertContext.getText("Actual statement should exist."), actual.isIfExist(), is(expected.isContainsExistClause()));
+ assertThat(assertContext.getText("Actual statement should exist."), actual.isIfExists(), is(expected.isIfExists()));
}
}
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropReadwriteSplittingRuleStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropReadwriteSplittingRuleStatementAssert.java
index 5a64da527d8..14c288c32ff 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropReadwriteSplittingRuleStatementAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropReadwriteSplittingRuleStatementAssert.java
@@ -47,7 +47,7 @@ public final class DropReadwriteSplittingRuleStatementAssert {
} else {
assertNotNull(assertContext.getText("Actual statement should exist."), actual);
assertThat(assertContext.getText("readwrite splitting assertion error: "), actual.getRuleNames(), is(expected.getRules()));
- assertThat(assertContext.getText("readwrite splitting assertion error: "), actual.isIfExist(), is(expected.isContainsExistClause()));
+ assertThat(assertContext.getText("readwrite splitting assertion error: "), actual.isIfExists(), is(expected.isIfExists()));
}
}
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShadowAlgorithmStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShadowAlgorithmStatementAssert.java
index cb388611562..ef123dcd8b7 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShadowAlgorithmStatementAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShadowAlgorithmStatementAssert.java
@@ -47,7 +47,7 @@ public final class DropShadowAlgorithmStatementAssert {
} else {
assertNotNull(assertContext.getText("Actual statement should exist."), actual);
assertThat(assertContext.getText("Shadow rule assertion error: "), actual.getAlgorithmNames(), is(expected.getRuleName()));
- assertThat(assertContext.getText("Shadow rule assertion error: "), actual.isIfExist(), is(expected.isContainsExistClause()));
+ assertThat(assertContext.getText("Shadow rule assertion error: "), actual.isIfExists(), is(expected.isIfExists()));
}
}
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShadowRuleStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShadowRuleStatementAssert.java
index 06c77b942d5..2584a92df87 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShadowRuleStatementAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShadowRuleStatementAssert.java
@@ -47,7 +47,7 @@ public final class DropShadowRuleStatementAssert {
} else {
assertNotNull(assertContext.getText("Actual statement should exist."), actual);
assertThat(assertContext.getText("Shadow rule assertion error: "), actual.getRuleNames(), is(expected.getRuleName()));
- assertThat(assertContext.getText("Shadow rule assertion error: "), actual.isIfExist(), is(expected.isContainsExistClause()));
+ assertThat(assertContext.getText("Shadow rule assertion error: "), actual.isIfExists(), is(expected.isIfExists()));
}
}
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingAlgorithmStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingAlgorithmStatementAssert.java
index 389a8e244d4..50f50e2812a 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingAlgorithmStatementAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingAlgorithmStatementAssert.java
@@ -45,7 +45,7 @@ public final class DropShardingAlgorithmStatementAssert {
assertNull(assertContext.getText("Actual algorithm should not exist."), actual);
} else {
assertThat(assertContext.getText("Algorithm names assertion error: "), actual.getAlgorithmNames(), is(expected.getAlgorithms()));
- assertThat(assertContext.getText("Contains exist clause assertion error: "), actual.isIfExist(), is(expected.isContainsExistClause()));
+ assertThat(assertContext.getText("Contains exist clause assertion error: "), actual.isIfExists(), is(expected.isIfExists()));
}
}
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingBindingTableRulesStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingBindingTableRulesStatementAssert.java
index 59654f12e8f..1ffc53120ee 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingBindingTableRulesStatementAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingBindingTableRulesStatementAssert.java
@@ -43,6 +43,6 @@ public final class DropShardingBindingTableRulesStatementAssert {
public static void assertIs(final SQLCaseAssertContext assertContext, final DropShardingBindingTableRulesStatement actual, final DropShardingBindingTableRulesStatementTestCase expected) {
assertNotNull(assertContext.getText("Actual statement should exist."), actual);
assertThat(assertContext.getText("Binding table rule assertion error: "), actual.getBindingGroups(), is(expected.getRules()));
- assertThat(assertContext.getText("Binding table rule assertion error: "), actual.isIfExist(), is(expected.isContainsExistClause()));
+ assertThat(assertContext.getText("Binding table rule assertion error: "), actual.isIfExists(), is(expected.isIfExists()));
}
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingBroadcastTableRulesStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingBroadcastTableRulesStatementAssert.java
index 1f9222ff084..d4cc8650f5a 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingBroadcastTableRulesStatementAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingBroadcastTableRulesStatementAssert.java
@@ -47,7 +47,7 @@ public final class DropShardingBroadcastTableRulesStatementAssert {
} else {
assertNotNull(assertContext.getText("Actual statement should exist."), actual);
assertThat(assertContext.getText("readwrite splitting assertion error: "), actual.getRules(), is(expected.getTableName()));
- assertThat(assertContext.getText("readwrite splitting assertion error: "), actual.isIfExist(), is(expected.isContainsExistClause()));
+ assertThat(assertContext.getText("readwrite splitting assertion error: "), actual.isIfExists(), is(expected.isIfExists()));
}
}
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingKeyGeneratorStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingKeyGeneratorStatementAssert.java
index 8e475b79821..5c8749c07d3 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingKeyGeneratorStatementAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingKeyGeneratorStatementAssert.java
@@ -45,7 +45,7 @@ public final class DropShardingKeyGeneratorStatementAssert {
assertNull(assertContext.getText("Actual key generator name should not exist."), actual);
} else {
assertThat(assertContext.getText("Key generator names assertion error: "), actual.getKeyGeneratorNames(), is(expected.getKeyGeneratorName()));
- assertThat(assertContext.getText("Contains exist clause assertion error: "), actual.isIfExist(), is(expected.isContainsExistClause()));
+ assertThat(assertContext.getText("Contains exist clause assertion error: "), actual.isIfExists(), is(expected.isIfExists()));
}
}
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingScalingRuleStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingScalingRuleStatementAssert.java
index 1ec257ac72e..704c86ab6f4 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingScalingRuleStatementAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingScalingRuleStatementAssert.java
@@ -48,7 +48,7 @@ public final class DropShardingScalingRuleStatementAssert {
assertNotNull(assertContext.getText("Actual statement should exist."), actual);
assertThat(assertContext.getText(String.format("`%s`'s scaling name assertion error: ", actual.getClass().getSimpleName())),
actual.getScalingName(), is(expected.getScalingName()));
- assertThat(assertContext.getText("Contains exist clause assertion error: "), actual.isIfExist(), is(expected.isContainsExistClause()));
+ assertThat(assertContext.getText("Contains exist clause assertion error: "), actual.isIfExists(), is(expected.isIfExists()));
}
}
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingTableRuleStatementAssert.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingTableRuleStatementAssert.java
index e5f510b968f..4b813aa2791 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingTableRuleStatementAssert.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/drop/impl/DropShardingTableRuleStatementAssert.java
@@ -50,7 +50,7 @@ public final class DropShardingTableRuleStatementAssert {
assertNotNull(assertContext.getText("Actual statement should exist."), actual);
assertThat(assertContext.getText("Sharding table rule assertion error: "), actual.getTableNames().stream().map(each -> each.getIdentifier().getValue()).collect(Collectors.toList()),
is(expected.getTables()));
- assertThat(assertContext.getText("Sharding table rule assertion error: "), actual.isIfExist(), is(expected.isContainsExistClause()));
+ assertThat(assertContext.getText("Sharding table rule assertion error: "), actual.isIfExists(), is(expected.isIfExists()));
}
}
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/DropRuleStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/DropRuleStatementTestCase.java
index ef4df5c6e0e..794eefa5a6f 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/DropRuleStatementTestCase.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/DropRuleStatementTestCase.java
@@ -28,6 +28,6 @@ import javax.xml.bind.annotation.XmlType;
@XmlType(name = "distsql")
public abstract class DropRuleStatementTestCase extends SQLParserTestCase {
- @XmlAttribute(name = "contains-exists-clause")
- private boolean containsExistClause;
+ @XmlAttribute(name = "if-exists")
+ private boolean ifExists;
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ResetPersistStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ResetPersistStatementTestCase.java
index 5822157136f..fe05ffc385e 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ResetPersistStatementTestCase.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/dal/ResetPersistStatementTestCase.java
@@ -30,9 +30,9 @@ import javax.xml.bind.annotation.XmlAttribute;
@Setter
public final class ResetPersistStatementTestCase extends SQLParserTestCase {
- @XmlAttribute(name = "exist-clause")
- private boolean containsExistClause;
+ @XmlAttribute(name = "if-exists")
+ private boolean ifExists;
- @XmlAttribute(name = "exist-clause")
+ @XmlAttribute
private String identifier;
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropDataBaseDiscoveryHeartbeatStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropDataBaseDiscoveryHeartbeatStatementTestCase.java
index 7c6ad6ce47f..a55113008b1 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropDataBaseDiscoveryHeartbeatStatementTestCase.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropDataBaseDiscoveryHeartbeatStatementTestCase.java
@@ -36,6 +36,6 @@ public final class DropDataBaseDiscoveryHeartbeatStatementTestCase extends SQLPa
@XmlElement(name = "heartbeat")
private final List<String> heartbeats = new LinkedList<>();
- @XmlAttribute(name = "contains-exist-clause")
- private boolean containsExistClause;
+ @XmlAttribute(name = "if-exists")
+ private boolean ifExists;
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropDataBaseDiscoveryRuleStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropDataBaseDiscoveryRuleStatementTestCase.java
index 4420e30b666..dcf0ba11bfb 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropDataBaseDiscoveryRuleStatementTestCase.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropDataBaseDiscoveryRuleStatementTestCase.java
@@ -36,6 +36,6 @@ public final class DropDataBaseDiscoveryRuleStatementTestCase extends SQLParserT
@XmlElement(name = "rule")
private final List<String> rules = new LinkedList<>();
- @XmlAttribute(name = "contains-exist-clause")
- private boolean containsExistClause;
+ @XmlAttribute(name = "if-exists")
+ private boolean ifExists;
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropDataBaseDiscoveryTypeStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropDataBaseDiscoveryTypeStatementTestCase.java
index 690243d032e..a13780fa7d7 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropDataBaseDiscoveryTypeStatementTestCase.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropDataBaseDiscoveryTypeStatementTestCase.java
@@ -36,6 +36,6 @@ public final class DropDataBaseDiscoveryTypeStatementTestCase extends SQLParserT
@XmlElement(name = "type")
private final List<String> types = new LinkedList<>();
- @XmlAttribute(name = "contains-exist-clause")
- private boolean containsExistClause;
+ @XmlAttribute(name = "if-exists")
+ private boolean ifExists;
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropDefaultSingleTableRuleStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropDefaultSingleTableRuleStatementTestCase.java
index 82819fd2cba..a3b5b5d7335 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropDefaultSingleTableRuleStatementTestCase.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropDefaultSingleTableRuleStatementTestCase.java
@@ -30,7 +30,7 @@ import javax.xml.bind.annotation.XmlAttribute;
@Setter
public final class DropDefaultSingleTableRuleStatementTestCase extends SQLParserTestCase {
- @XmlAttribute(name = "contains-exist-clause")
- private boolean containsExistClause;
+ @XmlAttribute(name = "if-exists")
+ private boolean ifExists;
}
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropEncryptRuleStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropEncryptRuleStatementTestCase.java
index 15b5a755195..bbad840f10c 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropEncryptRuleStatementTestCase.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropEncryptRuleStatementTestCase.java
@@ -33,8 +33,8 @@ import java.util.List;
@Setter
public final class DropEncryptRuleStatementTestCase extends SQLParserTestCase {
- @XmlAttribute(name = "contains-exist-clause")
- private boolean containsExistClause;
+ @XmlAttribute(name = "if-exists")
+ private boolean ifExists;
@XmlElement(name = "table")
private final List<String> tables = new LinkedList<>();
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropResourceStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropResourceStatementTestCase.java
index cbd7a571286..3c931f2ba79 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropResourceStatementTestCase.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropResourceStatementTestCase.java
@@ -33,8 +33,8 @@ import java.util.List;
@Setter
public final class DropResourceStatementTestCase extends SQLParserTestCase {
- @XmlAttribute(name = "contains-exist-clause")
- private boolean containsExistClause;
+ @XmlAttribute(name = "if-exists")
+ private boolean ifExists;
@XmlElement(name = "data-source")
private final List<String> dataSources = new LinkedList<>();
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropShadowAlgorithmStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropShadowAlgorithmStatementTestCase.java
index 207a131bddb..45e890da4d6 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropShadowAlgorithmStatementTestCase.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropShadowAlgorithmStatementTestCase.java
@@ -33,8 +33,8 @@ import java.util.List;
@Setter
public final class DropShadowAlgorithmStatementTestCase extends SQLParserTestCase {
- @XmlAttribute(name = "contains-exist-clause")
- private boolean containsExistClause;
+ @XmlAttribute(name = "if-exists")
+ private boolean ifExists;
@XmlElement(name = "rule")
private final List<String> ruleName = new LinkedList<>();
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropShadowRuleStatementTestCase.java b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropShadowRuleStatementTestCase.java
index ce809dde1e4..d23c2655dd5 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropShadowRuleStatementTestCase.java
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/drop/DropShadowRuleStatementTestCase.java
@@ -33,8 +33,8 @@ import java.util.List;
@Setter
public final class DropShadowRuleStatementTestCase extends SQLParserTestCase {
- @XmlAttribute(name = "contains-exist-clause")
- private boolean containsExistClause;
+ @XmlAttribute(name = "if-exists")
+ private boolean ifExists;
@XmlElement(name = "rule")
private final List<String> ruleName = new LinkedList<>();
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dal/reset.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dal/reset.xml
index b89af4d2488..b86a59eccdc 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dal/reset.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/dal/reset.xml
@@ -45,5 +45,5 @@
<reset sql-case-id="reset_replica" />
<reset-persist sql-case-id="reset_persist" />
<reset-persist sql-case-id="reset_persist_identifier" identifier="TEST_ID" />
- <reset-persist sql-case-id="reset_persist_exist_identifier" exist-clause="true" identifier="TEST_ID" />
+ <reset-persist sql-case-id="reset_persist_exist_identifier" if-exists="true" identifier="TEST_ID" />
</sql-parser-test-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/rdl/drop.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/rdl/drop.xml
index 0cb9f9615d2..3673e7d426a 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/rdl/drop.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case/rdl/drop.xml
@@ -23,7 +23,7 @@
<ignore-single-tables>false</ignore-single-tables>
</drop-resource>
- <drop-resource sql-case-id="drop-resource-if-exists" contains-exist-clause="true">
+ <drop-resource sql-case-id="drop-resource-if-exists" if-exists="true">
<data-source>ds_0</data-source>
<data-source>ds_1</data-source>
<ignore-single-tables>false</ignore-single-tables>
@@ -40,7 +40,7 @@
<table>t_order_item</table>
</drop-sharding-table-rule>
- <drop-sharding-table-rule sql-case-id="drop-sharding-table-rule-if-exists" contains-exists-clause="true">
+ <drop-sharding-table-rule sql-case-id="drop-sharding-table-rule-if-exists" if-exists="true">
<table>t_order</table>
<table>t_order_item</table>
</drop-sharding-table-rule>
@@ -51,7 +51,7 @@
<rule>t_1,t_2</rule>
</drop-sharding-binding-table-rules>
- <drop-sharding-binding-table-rules sql-case-id="drop-sharding-binding-table-specified-rules-if-exists" contains-exists-clause="true">
+ <drop-sharding-binding-table-rules sql-case-id="drop-sharding-binding-table-specified-rules-if-exists" if-exists="true">
<rule>t_1,t_2</rule>
</drop-sharding-binding-table-rules>
@@ -61,7 +61,7 @@
<table>t_order</table>
</drop-sharding-broadcast-table-rules>
- <drop-sharding-broadcast-table-rules sql-case-id="drop-sharding-broadcast-table-specified-table-if-exist" contains-exists-clause="true">
+ <drop-sharding-broadcast-table-rules sql-case-id="drop-sharding-broadcast-table-specified-table-if-exists" if-exists="true">
<table>t_order</table>
</drop-sharding-broadcast-table-rules>
@@ -70,7 +70,7 @@
<rule>ms_group_1</rule>
</drop-readwrite-splitting-rule>
- <drop-readwrite-splitting-rule sql-case-id="drop-readwrite-splitting-rule-if-exists" contains-exists-clause="true">
+ <drop-readwrite-splitting-rule sql-case-id="drop-readwrite-splitting-rule-if-exists" if-exists="true">
<rule>ms_group_0</rule>
<rule>ms_group_1</rule>
</drop-readwrite-splitting-rule>
@@ -80,7 +80,7 @@
<rule>ha_group_1</rule>
</drop-database-discovery-rule>
- <drop-database-discovery-rule sql-case-id="drop-database-discovery-rule-if-exists" contains-exist-clause="true">
+ <drop-database-discovery-rule sql-case-id="drop-database-discovery-rule-if-exists" if-exists="true">
<rule>ha_group_0</rule>
<rule>ha_group_1</rule>
</drop-database-discovery-rule>
@@ -90,7 +90,7 @@
<type>type_name_1</type>
</drop-database-discovery-type>
- <drop-database-discovery-type sql-case-id="drop-database-discovery-type-if-exists" contains-exist-clause="true">
+ <drop-database-discovery-type sql-case-id="drop-database-discovery-type-if-exists" if-exists="true">
<type>type_name_0</type>
<type>type_name_1</type>
</drop-database-discovery-type>
@@ -100,7 +100,7 @@
<heartbeat>heartbeat_name_1</heartbeat>
</drop-database-discovery-heartbeat>
- <drop-database-discovery-heartbeat sql-case-id="drop-database-discovery-heartbeat-if-exists" contains-exist-clause="true">
+ <drop-database-discovery-heartbeat sql-case-id="drop-database-discovery-heartbeat-if-exists" if-exists="true">
<heartbeat>heartbeat_name_0</heartbeat>
<heartbeat>heartbeat_name_1</heartbeat>
</drop-database-discovery-heartbeat>
@@ -110,7 +110,7 @@
<table>t_encrypt_order</table>
</drop-encrypt-rule>
- <drop-encrypt-rule sql-case-id="drop-encrypt-rule-if-exists" contains-exist-clause="true">
+ <drop-encrypt-rule sql-case-id="drop-encrypt-rule-if-exists" if-exists="true">
<table>t_encrypt</table>
<table>t_encrypt_order</table>
</drop-encrypt-rule>
@@ -120,7 +120,7 @@
<rule>shadow_rule_2</rule>
</drop-shadow-rule>
- <drop-shadow-rule sql-case-id="drop-shadow-rule-if-exists" contains-exist-clause="true">
+ <drop-shadow-rule sql-case-id="drop-shadow-rule-if-exists" if-exists="true">
<rule>shadow_rule_1</rule>
<rule>shadow_rule_2</rule>
</drop-shadow-rule>
@@ -130,34 +130,34 @@
<rule>shadow_algorithm_2</rule>
</drop-shadow-algorithm>
- <drop-shadow-algorithm sql-case-id="drop-shadow-algorithm-if-exists" contains-exist-clause="true">
+ <drop-shadow-algorithm sql-case-id="drop-shadow-algorithm-if-exists" if-exists="true">
<rule>shadow_algorithm_1</rule>
<rule>shadow_algorithm_2</rule>
</drop-shadow-algorithm>
- <drop-shadow-algorithm sql-case-id="drop-default-shadow-algorithm-if-exists" contains-exist-clause="true"/>
+ <drop-shadow-algorithm sql-case-id="drop-default-shadow-algorithm-if-exists" if-exists="true"/>
<drop-default-single-table sql-case-id="drop-default-single-table" />
- <drop-default-single-table sql-case-id="drop-default-single-table-if-exists" contains-exist-clause="true"/>
+ <drop-default-single-table sql-case-id="drop-default-single-table-if-exists" if-exists="true"/>
<drop-sharding-key-generator sql-case-id="drop-sharding-key-generator" >
<key-generator>uuid_key_generator</key-generator>
</drop-sharding-key-generator>
- <drop-sharding-key-generator sql-case-id="drop-sharding-key-generator-if-exists" contains-exists-clause="true">
+ <drop-sharding-key-generator sql-case-id="drop-sharding-key-generator-if-exists" if-exists="true">
<key-generator>uuid_key_generator</key-generator>
</drop-sharding-key-generator>
<drop-default-sharding-strategy sql-case-id="drop-default-sharding-strategy" type="table"/>
- <drop-default-sharding-strategy sql-case-id="drop-default-sharding-strategy-if-exists" type="table" contains-exists-clause="true"/>
+ <drop-default-sharding-strategy sql-case-id="drop-default-sharding-strategy-if-exists" type="table" if-exists="true"/>
<drop-sharding-scaling-rule sql-case-id="drop-sharding-scaling-rule" scaling-name="default_scaling"/>
- <drop-sharding-scaling-rule sql-case-id="drop-sharding-scaling-rule-if-exists" scaling-name="default_scaling" contains-exists-clause="true"/>
+ <drop-sharding-scaling-rule sql-case-id="drop-sharding-scaling-rule-if-exists" scaling-name="default_scaling" if-exists="true"/>
- <drop-sharding-algorithm sql-case-id="drop-sharding-algorithm" contains-exists-clause="true">
+ <drop-sharding-algorithm sql-case-id="drop-sharding-algorithm" if-exists="true">
<algorithm>t_order_hash_mod</algorithm>
</drop-sharding-algorithm>
</sql-parser-test-cases>
diff --git a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rdl/drop.xml b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rdl/drop.xml
index 1191a05dd8b..b01f143fab6 100644
--- a/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rdl/drop.xml
+++ b/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported/rdl/drop.xml
@@ -27,7 +27,7 @@
<distsql-case id="drop-sharding-binding-table-specified-rules-if-exists" value="DROP SHARDING BINDING TABLE RULES IF EXISTS (t_1,t_2)" />
<distsql-case id="drop-sharding-broadcast-table-rules" value="DROP SHARDING BROADCAST TABLE RULES" />
<distsql-case id="drop-sharding-broadcast-table-specified-table" value="DROP SHARDING BROADCAST TABLE RULES t_order" />
- <distsql-case id="drop-sharding-broadcast-table-specified-table-if-exist" value="DROP SHARDING BROADCAST TABLE RULES IF EXISTS t_order" />
+ <distsql-case id="drop-sharding-broadcast-table-specified-table-if-exists" value="DROP SHARDING BROADCAST TABLE RULES IF EXISTS t_order" />
<distsql-case id="drop-readwrite-splitting-rule" value="DROP READWRITE_SPLITTING RULE ms_group_0,ms_group_1" />
<distsql-case id="drop-readwrite-splitting-rule-if-exists" value="DROP READWRITE_SPLITTING RULE IF EXISTS ms_group_0,ms_group_1" />
<distsql-case id="drop-database-discovery-rule" value="DROP DB_DISCOVERY RULE ha_group_0,ha_group_1" />