You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by ji...@apache.org on 2022/10/28 02:26:00 UTC
[shardingsphere] branch master updated: Revise DistSQL SHARDING RULE document & Remove invalid classes (#21806)
This is an automated email from the ASF dual-hosted git repository.
jianglongtao 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 46071bb3dff Revise DistSQL SHARDING RULE document & Remove invalid classes (#21806)
46071bb3dff is described below
commit 46071bb3dff2286a2eba7c18201db609a253200a
Author: ChenJiaHao <37...@users.noreply.github.com>
AuthorDate: Fri Oct 28 10:25:53 2022 +0800
Revise DistSQL SHARDING RULE document & Remove invalid classes (#21806)
* Remove invalid DistSQL statement & test cases & document
* Revise sharding rule document
---
.../syntax/rdl/rule-definition/sharding.cn.md | 58 +++---------
.../syntax/rdl/rule-definition/sharding.en.md | 58 +++---------
.../AlterShardingAlgorithmStatementUpdater.java | 92 -------------------
.../AlterShardingKeyGeneratorStatementUpdater.java | 93 -------------------
.../CreateShardingAlgorithmStatementUpdater.java | 101 ---------------------
...CreateShardingKeyGeneratorStatementUpdater.java | 101 ---------------------
...here.infra.distsql.update.RuleDefinitionUpdater | 4 -
...AlterShardingAlgorithmStatementUpdaterTest.java | 99 --------------------
...erShardingKeyGeneratorStatementUpdaterTest.java | 98 --------------------
...reateShardingAlgorithmStatementUpdaterTest.java | 93 -------------------
...teShardingKeyGeneratorStatementUpdaterTest.java | 78 ----------------
.../parser/segment/ShardingAlgorithmSegment.java | 35 -------
.../segment/ShardingKeyGeneratorSegment.java | 35 -------
.../statement/AlterShardingAlgorithmStatement.java | 35 -------
.../AlterShardingKeyGeneratorStatement.java | 35 -------
.../CreateShardingAlgorithmStatement.java | 35 -------
.../CreateShardingKeyGeneratorStatement.java | 35 -------
.../distsql/rdl/ShardingKeyGeneratorAssert.java | 49 ----------
.../rdl/alter/AlterRuleStatementAssert.java | 5 -
.../AlterShardingKeyGeneratorStatementAssert.java | 69 --------------
.../rdl/create/CreateRuleStatementAssert.java | 18 +---
.../CreateShardingAlgorithmStatementAssert.java | 75 ---------------
.../CreateShardingKeyGeneratorStatementAssert.java | 69 --------------
.../distsql/rdl/ExpectedShardingAlgorithm.java | 40 --------
.../distsql/rdl/ExpectedShardingKeyGenerator.java | 36 --------
.../AlterShardingAlgorithmStatementTestCase.java | 36 --------
...AlterShardingKeyGeneratorStatementTestCase.java | 36 --------
.../CreateShardingAlgorithmStatementTestCase.java | 38 --------
...reateShardingKeyGeneratorStatementTestCase.java | 38 --------
test/parser/src/main/resources/case/rdl/alter.xml | 10 +-
test/parser/src/main/resources/case/rdl/create.xml | 44 ++++-----
.../src/main/resources/sql/supported/rdl/alter.xml | 4 +-
.../main/resources/sql/supported/rdl/create.xml | 15 ++-
33 files changed, 54 insertions(+), 1613 deletions(-)
diff --git a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding.cn.md b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding.cn.md
index 61f0c196f5b..f7dea36e921 100644
--- a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding.cn.md
+++ b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding.cn.md
@@ -20,16 +20,8 @@ ALTER DEFAULT SHARDING shardingScope STRATEGY (shardingStrategy)
DROP DEFAULT SHARDING shardingScope STRATEGY;
-CREATE SHARDING ALGORITHM shardingAlgorithmDefinition [, shardingAlgorithmDefinition] ...
-
-ALTER SHARDING ALGORITHM shardingAlgorithmDefinition [, shardingAlgorithmDefinition] ...
-
DROP SHARDING ALGORITHM algorithmName [, algorithmName] ...
-CREATE SHARDING KEY GENERATOR keyGeneratorDefinition [, keyGeneratorDefinition] ...
-
-ALTER SHARDING KEY GENERATOR keyGeneratorDefinition [, keyGeneratorDefinition] ...
-
DROP SHARDING KEY GENERATOR [IF EXISTS] keyGeneratorName [, keyGeneratorName] ...
CREATE SHARDING AUDITOR auditorDefinition [, auditorDefinition] ...
@@ -42,10 +34,10 @@ shardingTableRuleDefinition:
shardingAutoTableRule | shardingTableRule
shardingAutoTableRule:
- tableName(storageUnits, shardingColumn, algorithmDefinition [, keyGenerateDeclaration] [, auditDeclaration])
+ tableName(storageUnits, shardingColumn, algorithmDefinition [, keyGenerateDefinition] [, auditDeclaration])
shardingTableRule:
- tableName(dataNodes [, databaseStrategy] [, tableStrategy] [, keyGenerateDeclaration] [, auditDeclaration])
+ tableName(dataNodes [, databaseStrategy] [, tableStrategy] [, keyGenerateDefinition] [, auditDeclaration])
storageUnits:
STORAGE_UNITS(storageUnit [, storageUnit] ...)
@@ -65,9 +57,6 @@ shardingColumn:
algorithmDefinition:
TYPE(NAME=shardingAlgorithmType [, PROPERTIES([algorithmProperties])])
-keyGenerateDeclaration:
- keyGenerateDefinition | keyGenerateConstruction
-
keyGenerateDefinition:
KEY_GENERATE_STRATEGY(COLUMN=columnName, strategyDefinition)
@@ -92,19 +81,10 @@ databaseStrategy:
tableStrategy:
TABLE_STRATEGY(shardingStrategy)
-keyGenerateConstruction
- KEY_GENERATE_STRATEGY(COLUMN=columnName, KEY_GENERATOR=keyGenerateAlgorithmName)
-
shardingStrategy:
TYPE=strategyType, shardingColumn, shardingAlgorithm
shardingAlgorithm:
- existingAlgorithm | autoCreativeAlgorithm
-
-existingAlgorithm:
- SHARDING_ALGORITHM=shardingAlgorithmName
-
-autoCreativeAlgorithm:
SHARDING_ALGORITHM(algorithmDefinition)
strategyDefinition:
@@ -137,7 +117,8 @@ auditorAlgorithmDefinition:
- 如需移除 `shardingAlgorithm`,请执行 `DROP SHARDING ALGORITHM`;
- `strategyType` 指定分片策略,请参考[分片策略](/cn/features/sharding/concept/sharding/#%E5%88%86%E7%89%87%E7%AD%96%E7%95%A5);
- `Sharding Table Rule` 同时支持 `Auto Table` 和 `Table` 两种类型,两者在语法上有所差异,对应配置文件请参考 [数据分片](/cn/user-manual/shardingsphere-jdbc/yaml-config/rules/sharding/) ;
-- 使用 `autoCreativeAlgorithm` 方式指定 `shardingStrategy` 时,将会自动创建新的分片算法,算法命名规则为 `tableName_strategyType_shardingAlgorithmType`,如 `t_order_database_inline`。
+- 执行 `CREATE SHARDING TABLE RULE` 时,将会自动创建新的分片算法,算法命名规则为 `tableName_scope_shardingAlgorithmType`,如 `t_order_database_inline`。
+- 执行 `CREATE DEFAULT SHARDING STRATEGY` 时,同样会自动创建新的分片算法,算法命名规则为 `default_scope_shardingAlgorithmType`,如 `default_database_inline`。
### Sharding Table Reference Rule
@@ -168,14 +149,6 @@ DROP BROADCAST TABLE RULES tableName [, tableName] ...
*Key Generator*
```sql
-CREATE SHARDING KEY GENERATOR snowflake_key_generator (
-TYPE(NAME="SNOWFLAKE")
-);
-
-ALTER SHARDING KEY GENERATOR snowflake_key_generator (
-TYPE(NAME="SNOWFLAKE")
-);
-
DROP SHARDING KEY GENERATOR snowflake_key_generator;
```
@@ -217,29 +190,20 @@ DROP SHARDING ALGORITHM t_order_hash_mod;
*Table*
```sql
-CREATE SHARDING ALGORITHM table_inline (
-TYPE(NAME="inline",PROPERTIES("algorithm-expression"="t_order_item_${order_id % 2}"))
-);
CREATE SHARDING TABLE RULE t_order_item (
DATANODES("ds_${0..1}.t_order_item_${0..1}"),
DATABASE_STRATEGY(TYPE="standard",SHARDING_COLUMN=user_id,SHARDING_ALGORITHM(TYPE(NAME="inline",PROPERTIES("algorithm-expression"="ds_${user_id % 2}")))),
-TABLE_STRATEGY(TYPE="standard",SHARDING_COLUMN=order_id,SHARDING_ALGORITHM=table_inline),
-KEY_GENERATE_STRATEGY(COLUMN=another_id,KEY_GENERATOR=snowflake_key_generator),
+TABLE_STRATEGY(TYPE="standard",SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME="inline",PROPERTIES("algorithm-expression"="t_order_item_${order_id % 2}")))),
+KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME="snowflake")),
AUDIT_STRATEGY(AUDITORS=[auditor1,auditor2],ALLOW_HINT_DISABLE=true)
);
-ALTER SHARDING ALGORITHM database_inline (
-TYPE(NAME="inline",PROPERTIES("algorithm-expression"="ds_${user_id % 4}"))
-),table_inline (
-TYPE(NAME="inline",PROPERTIES("algorithm-expression"="t_order_item_${order_id % 4}"))
-);
-
ALTER SHARDING TABLE RULE t_order_item (
DATANODES("ds_${0..3}.t_order_item${0..3}"),
-DATABASE_STRATEGY(TYPE="standard",SHARDING_COLUMN=user_id,SHARDING_ALGORITHM=database_inline),
-TABLE_STRATEGY(TYPE="standard",SHARDING_COLUMN=order_id,SHARDING_ALGORITHM=table_inline),
-KEY_GENERATE_STRATEGY(COLUMN=another_id,KEY_GENERATOR=snowflake_key_generator),
+DATABASE_STRATEGY(TYPE="standard",SHARDING_COLUMN=user_id,SHARDING_ALGORITHM(TYPE(NAME="inline",PROPERTIES("algorithm-expression"="ds_${user_id % 4}")))),
+TABLE_STRATEGY(TYPE="standard",SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME="inline",PROPERTIES("algorithm-expression"="t_order_item_${order_id % 4}")))),
+KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME="snowflake")),
AUDIT_STRATEGY(AUDITORS=[auditor1,auditor2],ALLOW_HINT_DISABLE=true)
);
@@ -248,11 +212,11 @@ DROP SHARDING TABLE RULE t_order_item;
DROP SHARDING ALGORITHM database_inline;
CREATE DEFAULT SHARDING DATABASE STRATEGY (
-TYPE="standard",SHARDING_COLUMN=order_id,SHARDING_ALGORITHM=database_inline
+TYPE="standard",SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME="inline",PROPERTIES("algorithm-expression"="ds_${order_id % 2}")))
);
ALTER DEFAULT SHARDING DATABASE STRATEGY (
-TYPE="standard",SHARDING_COLUMN=another_id,SHARDING_ALGORITHM=database_inline
+TYPE="standard",SHARDING_COLUMN=another_id,SHARDING_ALGORITHM(TYPE(NAME="inline",PROPERTIES("algorithm-expression"="ds_${another_id % 2}")))
);
DROP DEFAULT SHARDING DATABASE STRATEGY;
diff --git a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding.en.md b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding.en.md
index d9b09fa9075..000034b664f 100644
--- a/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding.en.md
+++ b/docs/document/content/user-manual/shardingsphere-proxy/distsql/syntax/rdl/rule-definition/sharding.en.md
@@ -20,16 +20,8 @@ ALTER DEFAULT SHARDING shardingScope STRATEGY (shardingStrategy)
DROP DEFAULT SHARDING shardingScope STRATEGY;
-CREATE SHARDING ALGORITHM shardingAlgorithmDefinition [, shardingAlgorithmDefinition] ...
-
-ALTER SHARDING ALGORITHM shardingAlgorithmDefinition [, shardingAlgorithmDefinition] ...
-
DROP SHARDING ALGORITHM algorithmName [, algorithmName] ...
-CREATE SHARDING KEY GENERATOR keyGeneratorDefinition [, keyGeneratorDefinition] ...
-
-ALTER SHARDING KEY GENERATOR keyGeneratorDefinition [, keyGeneratorDefinition] ...
-
DROP SHARDING KEY GENERATOR [IF EXISTS] keyGeneratorName [, keyGeneratorName] ...
CREATE SHARDING AUDITOR auditorDefinition [, auditorDefinition] ...
@@ -42,10 +34,10 @@ shardingTableRuleDefinition:
shardingAutoTableRule | shardingTableRule
shardingAutoTableRule:
- tableName(storageUnits, shardingColumn, algorithmDefinition [, keyGenerateDeclaration] [, auditDeclaration])
+ tableName(storageUnits, shardingColumn, algorithmDefinition [, keyGenerateDefinition] [, auditDeclaration])
shardingTableRule:
- tableName(dataNodes [, databaseStrategy] [, tableStrategy] [, keyGenerateDeclaration] [, auditDeclaration])
+ tableName(dataNodes [, databaseStrategy] [, tableStrategy] [, keyGenerateDefinition] [, auditDeclaration])
storageUnits:
STORAGE_UNITS(storageUnit [, storageUnit] ...)
@@ -65,9 +57,6 @@ shardingColumn:
algorithmDefinition:
TYPE(NAME=shardingAlgorithmType [, PROPERTIES([algorithmProperties])])
-keyGenerateDeclaration:
- keyGenerateDefinition | keyGenerateConstruction
-
keyGenerateDefinition:
KEY_GENERATE_STRATEGY(COLUMN=columnName, strategyDefinition)
@@ -92,19 +81,10 @@ databaseStrategy:
tableStrategy:
TABLE_STRATEGY(shardingStrategy)
-keyGenerateConstruction
- KEY_GENERATE_STRATEGY(COLUMN=columnName, KEY_GENERATOR=keyGenerateAlgorithmName)
-
shardingStrategy:
TYPE=strategyType, shardingColumn, shardingAlgorithm
shardingAlgorithm:
- existingAlgorithm | autoCreativeAlgorithm
-
-existingAlgorithm:
- SHARDING_ALGORITHM=shardingAlgorithmName
-
-autoCreativeAlgorithm:
SHARDING_ALGORITHM(algorithmDefinition)
strategyDefinition:
@@ -138,6 +118,8 @@ auditorAlgorithmDefinition:
- `strategyType` specifies the sharding strategy, please refer to[Sharding Strategy](/en/features/sharding/concept/sharding/#sharding-strategy)
- `Sharding Table Rule` supports both `Auto Table` and `Table` at the same time. The two types are different in syntax. For the corresponding configuration file, please refer to [Sharding](/en/user-manual/shardingsphere-jdbc/yaml-config/rules/sharding/)
- When using the `autoCreativeAlgorithm` way to specify `shardingStrategy`, a new sharding algorithm will be created automatically. The algorithm naming rule is `tableName_strategyType_shardingAlgorithmType`, such as `t_order_database_inline`
+- executing `CREATE SHARDING TABLE RULE`,a new sharding algorithm will be created automatically. The algorithm naming rule is `tableName_scope_shardingAlgorithmType`,such as `t_order_database_inline`
+- executing `CREATE DEFAULT SHARDING STRATEGY`,a new sharding algorithm is also created automatically,The algorithm naming rule is `default_scope_shardingAlgorithmType`,such as `default_database_inline`
### Sharding Table Reference Rule
@@ -168,14 +150,6 @@ DROP BROADCAST TABLE RULE tableName [, tableName] ...
*Key Generator*
```sql
-CREATE SHARDING KEY GENERATOR snowflake_key_generator (
-TYPE(NAME="SNOWFLAKE")
-);
-
-ALTER SHARDING KEY GENERATOR snowflake_key_generator (
-TYPE(NAME="SNOWFLAKE"))
-);
-
DROP SHARDING KEY GENERATOR snowflake_key_generator;
```
@@ -217,29 +191,19 @@ DROP SHARDING ALGORITHM t_order_hash_mod;
*Table*
```sql
-CREATE SHARDING ALGORITHM table_inline (
-TYPE(NAME="inline",PROPERTIES("algorithm-expression"="t_order_item_${order_id % 2}"))
-);
-
CREATE SHARDING TABLE RULE t_order_item (
DATANODES("ds_${0..1}.t_order_item_${0..1}"),
DATABASE_STRATEGY(TYPE="standard",SHARDING_COLUMN=user_id,SHARDING_ALGORITHM(TYPE(NAME="inline",PROPERTIES("algorithm-expression"="ds_${user_id % 2}")))),
-TABLE_STRATEGY(TYPE="standard",SHARDING_COLUMN=order_id,SHARDING_ALGORITHM=table_inline),
-KEY_GENERATE_STRATEGY(COLUMN=another_id,KEY_GENERATOR=snowflake_key_generator),
+TABLE_STRATEGY(TYPE="standard",SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME="inline",PROPERTIES("algorithm-expression"="t_order_item_${order_id % 2}")))),
+KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME="snowflake")),
AUDIT_STRATEGY(AUDITORS=[auditor1,auditor2],ALLOW_HINT_DISABLE=true)
);
-ALTER SHARDING ALGORITHM database_inline (
-TYPE(NAME="inline",PROPERTIES("algorithm-expression"="ds_${user_id % 4}"))
-),table_inline (
-TYPE(NAME="inline",PROPERTIES("algorithm-expression"="t_order_item_${order_id % 4}"))
-);
-
ALTER SHARDING TABLE RULE t_order_item (
DATANODES("ds_${0..3}.t_order_item${0..3}"),
-DATABASE_STRATEGY(TYPE="standard",SHARDING_COLUMN=user_id,SHARDING_ALGORITHM=database_inline),
-TABLE_STRATEGY(TYPE="standard",SHARDING_COLUMN=order_id,SHARDING_ALGORITHM=table_inline),
-KEY_GENERATE_STRATEGY(COLUMN=another_id,KEY_GENERATOR=snowflake_key_generator),
+DATABASE_STRATEGY(TYPE="standard",SHARDING_COLUMN=user_id,SHARDING_ALGORITHM(TYPE(NAME="inline",PROPERTIES("algorithm-expression"="ds_${user_id % 4}")))),
+TABLE_STRATEGY(TYPE="standard",SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME="inline",PROPERTIES("algorithm-expression"="t_order_item_${order_id % 4}")))),
+KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME="snowflake")),
AUDIT_STRATEGY(AUDITORS=[auditor1,auditor2],ALLOW_HINT_DISABLE=true)
);
@@ -248,11 +212,11 @@ DROP SHARDING TABLE RULE t_order_item;
DROP SHARDING ALGORITHM database_inline;
CREATE DEFAULT SHARDING DATABASE STRATEGY (
-TYPE="standard",SHARDING_COLUMN=order_id,SHARDING_ALGORITHM=database_inline
+TYPE="standard",SHARDING_COLUMN=order_id,SHARDING_ALGORITHM(TYPE(NAME="inline",PROPERTIES("algorithm-expression"="ds_${order_id % 2}")))
);
ALTER DEFAULT SHARDING DATABASE STRATEGY (
-TYPE="standard",SHARDING_COLUMN=another_id,SHARDING_ALGORITHM=database_inline
+TYPE="standard",SHARDING_COLUMN=another_id,SHARDING_ALGORITHM(TYPE(NAME="inline",PROPERTIES("algorithm-expression"="ds_${another_id % 2}")))
);
DROP DEFAULT SHARDING DATABASE STRATEGY;
diff --git a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingAlgorithmStatementUpdater.java b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingAlgorithmStatementUpdater.java
deleted file mode 100644
index 89f0e1d37aa..00000000000
--- a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingAlgorithmStatementUpdater.java
+++ /dev/null
@@ -1,92 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.distsql.handler.update;
-
-import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
-import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
-import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
-import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
-import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionAlterUpdater;
-import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
-import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import org.apache.shardingsphere.sharding.distsql.handler.converter.ShardingTableRuleStatementConverter;
-import org.apache.shardingsphere.sharding.distsql.parser.segment.ShardingAlgorithmSegment;
-import org.apache.shardingsphere.sharding.distsql.parser.statement.AlterShardingAlgorithmStatement;
-import org.apache.shardingsphere.sharding.factory.ShardingAlgorithmFactory;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * Alter sharding algorithm statement updater.
- */
-public final class AlterShardingAlgorithmStatementUpdater implements RuleDefinitionAlterUpdater<AlterShardingAlgorithmStatement, ShardingRuleConfiguration> {
-
- @Override
- public void checkSQLStatement(final ShardingSphereDatabase database,
- final AlterShardingAlgorithmStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
- Collection<String> requireNames = sqlStatement.getAlgorithmSegments().stream().map(ShardingAlgorithmSegment::getShardingAlgorithmName).collect(Collectors.toList());
- checkDuplicate(database.getName(), requireNames);
- checkExist(requireNames, currentRuleConfig);
- checkAlgorithmType(sqlStatement);
- }
-
- private void checkDuplicate(final String databaseName, final Collection<String> requireNames) {
- Collection<String> duplicateRequire = requireNames.stream().collect(Collectors.groupingBy(each -> each, Collectors.counting())).entrySet().stream()
- .filter(each -> each.getValue() > 1).map(Map.Entry::getKey).collect(Collectors.toSet());
- ShardingSpherePreconditions.checkState(duplicateRequire.isEmpty(), () -> new DuplicateRuleException("sharding", databaseName, duplicateRequire));
- }
-
- private void checkExist(final Collection<String> requireNames, final ShardingRuleConfiguration currentRuleConfig) {
- Collection<String> notExistAlgorithms = requireNames.stream().filter(each -> !currentRuleConfig.getShardingAlgorithms().containsKey(each)).collect(Collectors.toList());
- ShardingSpherePreconditions.checkState(notExistAlgorithms.isEmpty(), () -> new MissingRequiredAlgorithmException("sharding", notExistAlgorithms));
- }
-
- private void checkAlgorithmType(final AlterShardingAlgorithmStatement sqlStatement) {
- Collection<String> requireNames = sqlStatement.getAlgorithmSegments().stream().map(ShardingAlgorithmSegment::getAlgorithmSegment).map(AlgorithmSegment::getName).collect(Collectors.toList());
- Collection<String> invalidAlgorithmNames = requireNames.stream().filter(each -> !ShardingAlgorithmFactory.contains(each)).collect(Collectors.toList());
- ShardingSpherePreconditions.checkState(invalidAlgorithmNames.isEmpty(), () -> new InvalidAlgorithmConfigurationException("sharding", invalidAlgorithmNames));
- }
-
- @Override
- public ShardingRuleConfiguration buildToBeAlteredRuleConfiguration(final AlterShardingAlgorithmStatement sqlStatement) {
- ShardingRuleConfiguration result = new ShardingRuleConfiguration();
- Map<String, AlgorithmConfiguration> algorithmConfigMap = sqlStatement.getAlgorithmSegments().stream()
- .collect(Collectors.toMap(ShardingAlgorithmSegment::getShardingAlgorithmName, each -> ShardingTableRuleStatementConverter.createAlgorithmConfiguration(each.getAlgorithmSegment())));
- result.setShardingAlgorithms(algorithmConfigMap);
- return result;
- }
-
- @Override
- public void updateCurrentRuleConfiguration(final ShardingRuleConfiguration currentRuleConfig, final ShardingRuleConfiguration toBeAlteredRuleConfig) {
- currentRuleConfig.getShardingAlgorithms().putAll(toBeAlteredRuleConfig.getShardingAlgorithms());
- }
-
- @Override
- public Class<ShardingRuleConfiguration> getRuleConfigurationClass() {
- return ShardingRuleConfiguration.class;
- }
-
- @Override
- public String getType() {
- return AlterShardingAlgorithmStatement.class.getName();
- }
-}
diff --git a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingKeyGeneratorStatementUpdater.java b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingKeyGeneratorStatementUpdater.java
deleted file mode 100644
index 90d268af8df..00000000000
--- a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterShardingKeyGeneratorStatementUpdater.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.distsql.handler.update;
-
-import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
-import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
-import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
-import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
-import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionAlterUpdater;
-import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
-import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import org.apache.shardingsphere.sharding.distsql.handler.converter.ShardingTableRuleStatementConverter;
-import org.apache.shardingsphere.sharding.distsql.parser.segment.ShardingKeyGeneratorSegment;
-import org.apache.shardingsphere.sharding.distsql.parser.statement.AlterShardingKeyGeneratorStatement;
-import org.apache.shardingsphere.sharding.factory.KeyGenerateAlgorithmFactory;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-/**
- * Alter sharding key generator statement updater.
- */
-public final class AlterShardingKeyGeneratorStatementUpdater implements RuleDefinitionAlterUpdater<AlterShardingKeyGeneratorStatement, ShardingRuleConfiguration> {
-
- @Override
- public void checkSQLStatement(final ShardingSphereDatabase database, final AlterShardingKeyGeneratorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
- String databaseName = database.getName();
- Collection<String> requireNames = sqlStatement.getKeyGeneratorSegments().stream().map(ShardingKeyGeneratorSegment::getKeyGeneratorName).collect(Collectors.toList());
- checkDuplicate(databaseName, requireNames);
- checkExist(requireNames, currentRuleConfig);
- checkAlgorithmType(sqlStatement);
- }
-
- private void checkDuplicate(final String databaseName, final Collection<String> requireNames) {
- Collection<String> duplicateRequire = requireNames.stream().collect(Collectors.groupingBy(each -> each, Collectors.counting())).entrySet().stream()
- .filter(each -> each.getValue() > 1).map(Map.Entry::getKey).collect(Collectors.toSet());
- ShardingSpherePreconditions.checkState(duplicateRequire.isEmpty(), () -> new DuplicateRuleException("sharding", databaseName, duplicateRequire));
- }
-
- private void checkExist(final Collection<String> requireNames, final ShardingRuleConfiguration currentRuleConfig) {
- Collection<String> notExistAlgorithms = requireNames.stream().filter(each -> !currentRuleConfig.getKeyGenerators().containsKey(each)).collect(Collectors.toList());
- ShardingSpherePreconditions.checkState(notExistAlgorithms.isEmpty(), () -> new MissingRequiredAlgorithmException("sharding", notExistAlgorithms));
- }
-
- private void checkAlgorithmType(final AlterShardingKeyGeneratorStatement sqlStatement) {
- Collection<String> requireNames = sqlStatement.getKeyGeneratorSegments().stream()
- .map(ShardingKeyGeneratorSegment::getAlgorithmSegment).map(AlgorithmSegment::getName).collect(Collectors.toList());
- Collection<String> invalidAlgorithmNames = requireNames.stream().filter(each -> !KeyGenerateAlgorithmFactory.contains(each)).collect(Collectors.toList());
- ShardingSpherePreconditions.checkState(invalidAlgorithmNames.isEmpty(), () -> new InvalidAlgorithmConfigurationException("sharding", invalidAlgorithmNames));
- }
-
- @Override
- public ShardingRuleConfiguration buildToBeAlteredRuleConfiguration(final AlterShardingKeyGeneratorStatement sqlStatement) {
- ShardingRuleConfiguration result = new ShardingRuleConfiguration();
- Map<String, AlgorithmConfiguration> algorithmConfigMap = sqlStatement.getKeyGeneratorSegments().stream()
- .collect(Collectors.toMap(ShardingKeyGeneratorSegment::getKeyGeneratorName, each -> ShardingTableRuleStatementConverter.createAlgorithmConfiguration(each.getAlgorithmSegment())));
- result.setKeyGenerators(algorithmConfigMap);
- return result;
- }
-
- @Override
- public void updateCurrentRuleConfiguration(final ShardingRuleConfiguration currentRuleConfig, final ShardingRuleConfiguration toBeAlteredRuleConfig) {
- currentRuleConfig.getKeyGenerators().putAll(toBeAlteredRuleConfig.getShardingAlgorithms());
- }
-
- @Override
- public Class<ShardingRuleConfiguration> getRuleConfigurationClass() {
- return ShardingRuleConfiguration.class;
- }
-
- @Override
- public String getType() {
- return AlterShardingKeyGeneratorStatement.class.getName();
- }
-}
diff --git a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingAlgorithmStatementUpdater.java b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingAlgorithmStatementUpdater.java
deleted file mode 100644
index 59069e7d976..00000000000
--- a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingAlgorithmStatementUpdater.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.distsql.handler.update;
-
-import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
-import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
-import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
-import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
-import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionCreateUpdater;
-import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
-import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import org.apache.shardingsphere.sharding.distsql.handler.converter.ShardingTableRuleStatementConverter;
-import org.apache.shardingsphere.sharding.distsql.parser.segment.ShardingAlgorithmSegment;
-import org.apache.shardingsphere.sharding.distsql.parser.statement.CreateShardingAlgorithmStatement;
-import org.apache.shardingsphere.sharding.factory.ShardingAlgorithmFactory;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-/**
- * Create sharding algorithm statement updater.
- */
-public final class CreateShardingAlgorithmStatementUpdater implements RuleDefinitionCreateUpdater<CreateShardingAlgorithmStatement, ShardingRuleConfiguration> {
-
- @Override
- public void checkSQLStatement(final ShardingSphereDatabase database, final CreateShardingAlgorithmStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
- String databaseName = database.getName();
- checkDuplicate(databaseName, sqlStatement, currentRuleConfig);
- checkAlgorithm(sqlStatement);
- }
-
- private void checkDuplicate(final String databaseName, final CreateShardingAlgorithmStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
- Collection<String> shardingAlgorithmNames = sqlStatement.getAlgorithmSegments().stream().map(ShardingAlgorithmSegment::getShardingAlgorithmName).collect(Collectors.toList());
- checkDuplicateInput(shardingAlgorithmNames, duplicated -> new DuplicateRuleException("sharding", databaseName, duplicated));
- if (currentRuleConfig != null) {
- checkExist(shardingAlgorithmNames, currentRuleConfig.getShardingAlgorithms().keySet(), duplicated -> new DuplicateRuleException("sharding", databaseName, duplicated));
- }
- }
-
- private void checkDuplicateInput(final Collection<String> rules, final Function<Collection<String>, DistSQLException> thrower) {
- Collection<String> duplicateRequire = rules.stream().collect(Collectors.groupingBy(each -> each, Collectors.counting())).entrySet().stream()
- .filter(each -> each.getValue() > 1).map(Map.Entry::getKey).collect(Collectors.toSet());
- ShardingSpherePreconditions.checkState(duplicateRequire.isEmpty(), () -> thrower.apply(duplicateRequire));
- }
-
- private void checkExist(final Collection<String> requireRules, final Collection<String> currentRules, final Function<Collection<String>, DistSQLException> thrower) {
- Collection<String> identical = requireRules.stream().filter(currentRules::contains).collect(Collectors.toSet());
- ShardingSpherePreconditions.checkState(identical.isEmpty(), () -> thrower.apply(identical));
- }
-
- private void checkAlgorithm(final CreateShardingAlgorithmStatement sqlStatement) {
- Collection<String> notExistedShardingAlgorithms = sqlStatement.getAlgorithmSegments().stream().map(ShardingAlgorithmSegment::getAlgorithmSegment).map(AlgorithmSegment::getName)
- .filter(each -> !ShardingAlgorithmFactory.contains(each)).collect(Collectors.toList());
- ShardingSpherePreconditions.checkState(notExistedShardingAlgorithms.isEmpty(), () -> new InvalidAlgorithmConfigurationException("sharding", notExistedShardingAlgorithms));
- }
-
- @Override
- public ShardingRuleConfiguration buildToBeCreatedRuleConfiguration(final CreateShardingAlgorithmStatement sqlStatement) {
- ShardingRuleConfiguration result = new ShardingRuleConfiguration();
- Map<String, AlgorithmConfiguration> algorithmConfigMap = sqlStatement.getAlgorithmSegments().stream()
- .collect(Collectors.toMap(ShardingAlgorithmSegment::getShardingAlgorithmName, each -> ShardingTableRuleStatementConverter.createAlgorithmConfiguration(each.getAlgorithmSegment())));
- result.setShardingAlgorithms(algorithmConfigMap);
- return result;
- }
-
- @Override
- public void updateCurrentRuleConfiguration(final ShardingRuleConfiguration currentRuleConfig, final ShardingRuleConfiguration toBeCreatedRuleConfig) {
- if (null != currentRuleConfig) {
- currentRuleConfig.getShardingAlgorithms().putAll(toBeCreatedRuleConfig.getShardingAlgorithms());
- }
- }
-
- @Override
- public Class<ShardingRuleConfiguration> getRuleConfigurationClass() {
- return ShardingRuleConfiguration.class;
- }
-
- @Override
- public String getType() {
- return CreateShardingAlgorithmStatement.class.getName();
- }
-}
diff --git a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingKeyGeneratorStatementUpdater.java b/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingKeyGeneratorStatementUpdater.java
deleted file mode 100644
index d54e84ac312..00000000000
--- a/features/sharding/distsql/handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateShardingKeyGeneratorStatementUpdater.java
+++ /dev/null
@@ -1,101 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.distsql.handler.update;
-
-import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
-import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.DistSQLException;
-import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateAlgorithmException;
-import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
-import org.apache.shardingsphere.infra.distsql.update.RuleDefinitionCreateUpdater;
-import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.infra.util.exception.ShardingSpherePreconditions;
-import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import org.apache.shardingsphere.sharding.distsql.handler.converter.ShardingTableRuleStatementConverter;
-import org.apache.shardingsphere.sharding.distsql.parser.segment.ShardingKeyGeneratorSegment;
-import org.apache.shardingsphere.sharding.distsql.parser.statement.CreateShardingKeyGeneratorStatement;
-import org.apache.shardingsphere.sharding.factory.KeyGenerateAlgorithmFactory;
-
-import java.util.Collection;
-import java.util.Map;
-import java.util.function.Function;
-import java.util.stream.Collectors;
-
-/**
- * Create sharding key generator statement updater.
- */
-public final class CreateShardingKeyGeneratorStatementUpdater implements RuleDefinitionCreateUpdater<CreateShardingKeyGeneratorStatement, ShardingRuleConfiguration> {
-
- @Override
- public void checkSQLStatement(final ShardingSphereDatabase database,
- final CreateShardingKeyGeneratorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
- checkDuplicate(database.getName(), sqlStatement, currentRuleConfig);
- checkKeyGeneratorAlgorithm(sqlStatement);
- }
-
- private void checkDuplicate(final String databaseName, final CreateShardingKeyGeneratorStatement sqlStatement, final ShardingRuleConfiguration currentRuleConfig) {
- Collection<String> keyGeneratorNames = sqlStatement.getKeyGeneratorSegments().stream().map(ShardingKeyGeneratorSegment::getKeyGeneratorName).collect(Collectors.toList());
- checkDuplicateInput(keyGeneratorNames, duplicated -> new DuplicateAlgorithmException("Key generator", databaseName, duplicated));
- if (null != currentRuleConfig) {
- checkExist(keyGeneratorNames, currentRuleConfig.getKeyGenerators().keySet(), duplicated -> new DuplicateAlgorithmException("Key generator", databaseName, duplicated));
- }
- }
-
- private void checkDuplicateInput(final Collection<String> rules, final Function<Collection<String>, DistSQLException> thrower) {
- Collection<String> duplicateRequire = rules.stream().collect(Collectors.groupingBy(each -> each, Collectors.counting())).entrySet().stream()
- .filter(each -> each.getValue() > 1).map(Map.Entry::getKey).collect(Collectors.toSet());
- ShardingSpherePreconditions.checkState(duplicateRequire.isEmpty(), () -> thrower.apply(duplicateRequire));
- }
-
- private void checkExist(final Collection<String> requireRules, final Collection<String> currentRules, final Function<Collection<String>, DistSQLException> thrower) {
- Collection<String> identical = requireRules.stream().filter(currentRules::contains).collect(Collectors.toSet());
- ShardingSpherePreconditions.checkState(identical.isEmpty(), () -> thrower.apply(identical));
- }
-
- private void checkKeyGeneratorAlgorithm(final CreateShardingKeyGeneratorStatement sqlStatement) {
- Collection<String> notExistedKeyGeneratorAlgorithms = sqlStatement.getKeyGeneratorSegments().stream().map(ShardingKeyGeneratorSegment::getAlgorithmSegment).map(AlgorithmSegment::getName)
- .filter(each -> !KeyGenerateAlgorithmFactory.contains(each)).collect(Collectors.toList());
- ShardingSpherePreconditions.checkState(notExistedKeyGeneratorAlgorithms.isEmpty(), () -> new InvalidAlgorithmConfigurationException("sharding", notExistedKeyGeneratorAlgorithms));
- }
-
- @Override
- public ShardingRuleConfiguration buildToBeCreatedRuleConfiguration(final CreateShardingKeyGeneratorStatement sqlStatement) {
- ShardingRuleConfiguration result = new ShardingRuleConfiguration();
- Map<String, AlgorithmConfiguration> keyGeneratorConfigurationMap = sqlStatement.getKeyGeneratorSegments().stream()
- .collect(Collectors.toMap(ShardingKeyGeneratorSegment::getKeyGeneratorName, each -> ShardingTableRuleStatementConverter.createAlgorithmConfiguration(each.getAlgorithmSegment())));
- result.setKeyGenerators(keyGeneratorConfigurationMap);
- return result;
- }
-
- @Override
- public void updateCurrentRuleConfiguration(final ShardingRuleConfiguration currentRuleConfig, final ShardingRuleConfiguration toBeCreatedRuleConfig) {
- if (null != currentRuleConfig) {
- currentRuleConfig.getKeyGenerators().putAll(toBeCreatedRuleConfig.getKeyGenerators());
- }
- }
-
- @Override
- public Class<ShardingRuleConfiguration> getRuleConfigurationClass() {
- return ShardingRuleConfiguration.class;
- }
-
- @Override
- public String getType() {
- return CreateShardingKeyGeneratorStatement.class.getName();
- }
-}
diff --git a/features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RuleDefinitionUpdater b/features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RuleDefinitionUpdater
index 161a00d46e5..92788339b8e 100644
--- a/features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RuleDefinitionUpdater
+++ b/features/sharding/distsql/handler/src/main/resources/META-INF/services/org.apache.shardingsphere.infra.distsql.update.RuleDefinitionUpdater
@@ -16,7 +16,6 @@
#
org.apache.shardingsphere.sharding.distsql.handler.update.CreateShardingTableRuleStatementUpdater
-org.apache.shardingsphere.sharding.distsql.handler.update.CreateShardingAlgorithmStatementUpdater
org.apache.shardingsphere.sharding.distsql.handler.update.AlterShardingTableRuleStatementUpdater
org.apache.shardingsphere.sharding.distsql.handler.update.DropShardingTableRuleStatementUpdater
org.apache.shardingsphere.sharding.distsql.handler.update.DropShardingAlgorithmStatementUpdater
@@ -26,9 +25,6 @@ org.apache.shardingsphere.sharding.distsql.handler.update.DropShardingTableRefer
org.apache.shardingsphere.sharding.distsql.handler.update.CreateBroadcastTableRuleStatementUpdater
org.apache.shardingsphere.sharding.distsql.handler.update.DropBroadcastTableRuleStatementUpdater
org.apache.shardingsphere.sharding.distsql.handler.update.CreateDefaultShardingStrategyStatementUpdater
-org.apache.shardingsphere.sharding.distsql.handler.update.AlterShardingAlgorithmStatementUpdater
-org.apache.shardingsphere.sharding.distsql.handler.update.CreateShardingKeyGeneratorStatementUpdater
-org.apache.shardingsphere.sharding.distsql.handler.update.AlterShardingKeyGeneratorStatementUpdater
org.apache.shardingsphere.sharding.distsql.handler.update.DropShardingKeyGeneratorStatementUpdater
org.apache.shardingsphere.sharding.distsql.handler.update.DropShardingAuditorStatementUpdater
org.apache.shardingsphere.sharding.distsql.handler.update.CreateShardingAuditorStatementUpdater
diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingAlgorithmStatementUpdaterTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingAlgorithmStatementUpdaterTest.java
deleted file mode 100644
index 5c033b8f30e..00000000000
--- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingAlgorithmStatementUpdaterTest.java
+++ /dev/null
@@ -1,99 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.distsql.update;
-
-import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
-import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
-import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
-import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
-import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import org.apache.shardingsphere.sharding.distsql.handler.update.AlterShardingAlgorithmStatementUpdater;
-import org.apache.shardingsphere.sharding.distsql.parser.segment.ShardingAlgorithmSegment;
-import org.apache.shardingsphere.sharding.distsql.parser.statement.AlterShardingAlgorithmStatement;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Answers;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-
-import java.util.Arrays;
-import java.util.Properties;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.mockito.Mockito.when;
-
-@RunWith(MockitoJUnitRunner.class)
-public final class AlterShardingAlgorithmStatementUpdaterTest {
-
- private final AlterShardingAlgorithmStatementUpdater updater = new AlterShardingAlgorithmStatementUpdater();
-
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- private ShardingSphereDatabase database;
-
- @Before
- public void before() {
- when(database.getName()).thenReturn("test");
- }
-
- @Test(expected = DuplicateRuleException.class)
- public void assertExecuteWithDuplicate() {
- Properties props = new Properties();
- props.put("input_key", "input_value");
- ShardingAlgorithmSegment algorithmSegment = new ShardingAlgorithmSegment("input_algorithm_name", new AlgorithmSegment("input_algorithm_name", props));
- updater.checkSQLStatement(database, createSQLStatement(algorithmSegment, algorithmSegment), null);
- }
-
- @Test(expected = MissingRequiredAlgorithmException.class)
- public void assertExecuteWithNotExist() {
- Properties props = new Properties();
- props.put("input_key", "input_value");
- ShardingAlgorithmSegment algorithmSegment = new ShardingAlgorithmSegment("not_exist_algorithm_name", new AlgorithmSegment("input_algorithm_name", props));
- ShardingRuleConfiguration shardingRuleConfig = new ShardingRuleConfiguration();
- shardingRuleConfig.getShardingAlgorithms().put("exist_algorithm_name", new AlgorithmConfiguration("hash_mod", props));
- updater.checkSQLStatement(database, createSQLStatement(algorithmSegment), shardingRuleConfig);
- }
-
- @Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertExecuteWithInvalidAlgorithm() {
- Properties props = new Properties();
- props.put("input_key", "input_value");
- ShardingAlgorithmSegment algorithmSegment = new ShardingAlgorithmSegment("exist_algorithm_name", new AlgorithmSegment("input_algorithm_name", props));
- ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
- ruleConfig.getShardingAlgorithms().put("exist_algorithm_name", new AlgorithmConfiguration("invalid_algorithm", props));
- updater.checkSQLStatement(database, createSQLStatement(algorithmSegment), ruleConfig);
- }
-
- @Test
- public void assertUpdate() {
- Properties props = new Properties();
- ShardingAlgorithmSegment algorithmSegment = new ShardingAlgorithmSegment("exist_algorithm_name", new AlgorithmSegment("mod", props));
- ShardingRuleConfiguration currentRuleConfig = new ShardingRuleConfiguration();
- currentRuleConfig.getShardingAlgorithms().put("exist_algorithm_name", new AlgorithmConfiguration("hash_mod", props));
- ShardingRuleConfiguration toBeAlteredRuleConfiguration = updater.buildToBeAlteredRuleConfiguration(createSQLStatement(algorithmSegment));
- updater.updateCurrentRuleConfiguration(currentRuleConfig, toBeAlteredRuleConfiguration);
- assertThat(currentRuleConfig.getShardingAlgorithms().get("exist_algorithm_name").getType(), is("mod"));
- }
-
- private AlterShardingAlgorithmStatement createSQLStatement(final ShardingAlgorithmSegment... ruleSegments) {
- return new AlterShardingAlgorithmStatement(Arrays.asList(ruleSegments));
- }
-}
diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingKeyGeneratorStatementUpdaterTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingKeyGeneratorStatementUpdaterTest.java
deleted file mode 100644
index ff46eb62dde..00000000000
--- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/AlterShardingKeyGeneratorStatementUpdaterTest.java
+++ /dev/null
@@ -1,98 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.distsql.update;
-
-import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
-import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
-import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
-import org.apache.shardingsphere.infra.distsql.exception.rule.MissingRequiredAlgorithmException;
-import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import org.apache.shardingsphere.sharding.distsql.handler.update.AlterShardingKeyGeneratorStatementUpdater;
-import org.apache.shardingsphere.sharding.distsql.parser.segment.ShardingKeyGeneratorSegment;
-import org.apache.shardingsphere.sharding.distsql.parser.statement.AlterShardingKeyGeneratorStatement;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Answers;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-
-import java.util.Arrays;
-import java.util.Collections;
-import java.util.Properties;
-
-import static org.hamcrest.MatcherAssert.assertThat;
-import static org.hamcrest.Matchers.is;
-import static org.mockito.Mockito.when;
-
-@RunWith(MockitoJUnitRunner.class)
-public final class AlterShardingKeyGeneratorStatementUpdaterTest {
-
- private final AlterShardingKeyGeneratorStatementUpdater updater = new AlterShardingKeyGeneratorStatementUpdater();
-
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- private ShardingSphereDatabase database;
-
- @Before
- public void before() {
- when(database.getName()).thenReturn("test");
- }
-
- @Test(expected = DuplicateRuleException.class)
- public void assertExecuteWithDuplicate() {
- ShardingKeyGeneratorSegment keyGeneratorSegment = new ShardingKeyGeneratorSegment("input_key_generator_name", new AlgorithmSegment("snowflake", createProperties()));
- updater.checkSQLStatement(database, new AlterShardingKeyGeneratorStatement(Arrays.asList(keyGeneratorSegment, keyGeneratorSegment)), null);
- }
-
- @Test(expected = MissingRequiredAlgorithmException.class)
- public void assertExecuteWithNotExist() {
- Properties props = createProperties();
- ShardingKeyGeneratorSegment keyGeneratorSegment = new ShardingKeyGeneratorSegment("not_exist_key_generator_name", new AlgorithmSegment("snowflake", props));
- ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
- ruleConfig.getKeyGenerators().put("exist_key_generator_name", new AlgorithmConfiguration("hash_mod", props));
- updater.checkSQLStatement(database, new AlterShardingKeyGeneratorStatement(Collections.singletonList(keyGeneratorSegment)), ruleConfig);
- }
-
- @Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertExecuteWithInvalidAlgorithm() {
- Properties props = createProperties();
- ShardingKeyGeneratorSegment keyGeneratorSegment = new ShardingKeyGeneratorSegment("exist_key_generator_name", new AlgorithmSegment("INVALID_TYPE", props));
- ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
- ruleConfig.getKeyGenerators().put("exist_key_generator_name", new AlgorithmConfiguration("UUID", props));
- updater.checkSQLStatement(database, new AlterShardingKeyGeneratorStatement(Collections.singletonList(keyGeneratorSegment)), ruleConfig);
- }
-
- @Test
- public void assertUpdate() {
- ShardingKeyGeneratorSegment keyGeneratorSegment = new ShardingKeyGeneratorSegment("exist_key_generator_name", new AlgorithmSegment("snowflake", createProperties()));
- ShardingRuleConfiguration currentRuleConfig = new ShardingRuleConfiguration();
- currentRuleConfig.getKeyGenerators().put("exist_key_generator_name", new AlgorithmConfiguration("uuid", createProperties()));
- AlterShardingKeyGeneratorStatement statement = new AlterShardingKeyGeneratorStatement(Collections.singletonList(keyGeneratorSegment));
- ShardingRuleConfiguration toBeAlteredRuleConfiguration = updater.buildToBeAlteredRuleConfiguration(statement);
- updater.updateCurrentRuleConfiguration(currentRuleConfig, toBeAlteredRuleConfiguration);
- assertThat(currentRuleConfig.getKeyGenerators().get("exist_key_generator_name").getType(), is("uuid"));
- }
-
- private Properties createProperties() {
- Properties result = new Properties();
- result.put("key", "value");
- return result;
- }
-}
diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingAlgorithmStatementUpdaterTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingAlgorithmStatementUpdaterTest.java
deleted file mode 100644
index 92b4a5d65be..00000000000
--- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingAlgorithmStatementUpdaterTest.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.distsql.update;
-
-import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
-import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateRuleException;
-import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
-import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import org.apache.shardingsphere.sharding.distsql.handler.update.CreateShardingAlgorithmStatementUpdater;
-import org.apache.shardingsphere.sharding.distsql.parser.segment.ShardingAlgorithmSegment;
-import org.apache.shardingsphere.sharding.distsql.parser.statement.CreateShardingAlgorithmStatement;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Answers;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-
-import java.util.Arrays;
-import java.util.Properties;
-
-import static org.mockito.Mockito.when;
-
-@RunWith(MockitoJUnitRunner.class)
-public final class CreateShardingAlgorithmStatementUpdaterTest {
-
- private final CreateShardingAlgorithmStatementUpdater updater = new CreateShardingAlgorithmStatementUpdater();
-
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- private ShardingSphereDatabase database;
-
- @Before
- public void before() {
- when(database.getName()).thenReturn("test");
- }
-
- @Test(expected = DuplicateRuleException.class)
- public void assertExecuteWithDuplicate() {
- Properties props = new Properties();
- props.put("inputKey", "inputValue");
- ShardingAlgorithmSegment algorithmSegment = new ShardingAlgorithmSegment("inputAlgorithmName", new AlgorithmSegment("inputAlgorithmName", props));
- updater.checkSQLStatement(database, createSQLStatement(algorithmSegment, algorithmSegment), null);
- }
-
- @Test(expected = DuplicateRuleException.class)
- public void assertExecuteWithExist() {
- Properties props = new Properties();
- props.put("inputKey", "inputValue");
- ShardingAlgorithmSegment algorithmSegment = new ShardingAlgorithmSegment("existAlgorithmName", new AlgorithmSegment("inputAlgorithmName", props));
- ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
- ruleConfig.getShardingAlgorithms().put("existAlgorithmName", new AlgorithmConfiguration("hash_mod", props));
- updater.checkSQLStatement(database, createSQLStatement(algorithmSegment), ruleConfig);
- }
-
- @Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertExecuteWithoutRuleConfiguration() {
- Properties props = new Properties();
- props.put("inputKey", "inputValue");
- ShardingAlgorithmSegment algorithmSegment = new ShardingAlgorithmSegment("inputAlgorithmName", new AlgorithmSegment("inputAlgorithmName", props));
- updater.checkSQLStatement(database, createSQLStatement(algorithmSegment), null);
- }
-
- @Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertExecuteWithInvalidAlgorithm() {
- Properties props = new Properties();
- props.put("inputKey", "inputValue");
- ShardingAlgorithmSegment algorithmSegment = new ShardingAlgorithmSegment("inputAlgorithmName", new AlgorithmSegment("inputAlgorithmName", props));
- ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
- ruleConfig.getShardingAlgorithms().put("existAlgorithmName", new AlgorithmConfiguration("InvalidAlgorithm", props));
- updater.checkSQLStatement(database, createSQLStatement(algorithmSegment), ruleConfig);
- }
-
- private CreateShardingAlgorithmStatement createSQLStatement(final ShardingAlgorithmSegment... ruleSegments) {
- return new CreateShardingAlgorithmStatement(Arrays.asList(ruleSegments));
- }
-}
diff --git a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingKeyGeneratorStatementUpdaterTest.java b/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingKeyGeneratorStatementUpdaterTest.java
deleted file mode 100644
index ce19e33c954..00000000000
--- a/features/sharding/distsql/handler/src/test/java/org/apache/shardingsphere/sharding/distsql/update/CreateShardingKeyGeneratorStatementUpdaterTest.java
+++ /dev/null
@@ -1,78 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.distsql.update;
-
-import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
-import org.apache.shardingsphere.infra.config.algorithm.AlgorithmConfiguration;
-import org.apache.shardingsphere.infra.distsql.exception.rule.DuplicateAlgorithmException;
-import org.apache.shardingsphere.infra.distsql.exception.rule.InvalidAlgorithmConfigurationException;
-import org.apache.shardingsphere.infra.metadata.database.ShardingSphereDatabase;
-import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
-import org.apache.shardingsphere.sharding.distsql.handler.update.CreateShardingKeyGeneratorStatementUpdater;
-import org.apache.shardingsphere.sharding.distsql.parser.segment.ShardingKeyGeneratorSegment;
-import org.apache.shardingsphere.sharding.distsql.parser.statement.CreateShardingKeyGeneratorStatement;
-import org.junit.Before;
-import org.junit.Test;
-import org.junit.runner.RunWith;
-import org.mockito.Answers;
-import org.mockito.Mock;
-import org.mockito.junit.MockitoJUnitRunner;
-
-import java.util.Arrays;
-import java.util.Properties;
-
-import static org.mockito.Mockito.when;
-
-@RunWith(MockitoJUnitRunner.class)
-public final class CreateShardingKeyGeneratorStatementUpdaterTest {
-
- private final CreateShardingKeyGeneratorStatementUpdater updater = new CreateShardingKeyGeneratorStatementUpdater();
-
- @Mock(answer = Answers.RETURNS_DEEP_STUBS)
- private ShardingSphereDatabase database;
-
- @Before
- public void before() {
- when(database.getName()).thenReturn("test");
- }
-
- @Test(expected = DuplicateAlgorithmException.class)
- public void assertExecuteWithDuplicate() {
- ShardingKeyGeneratorSegment keyGeneratorSegment = new ShardingKeyGeneratorSegment("uuid_key_generator", new AlgorithmSegment("uuid", new Properties()));
- updater.checkSQLStatement(database, createSQLStatement(keyGeneratorSegment, keyGeneratorSegment), null);
- }
-
- @Test(expected = DuplicateAlgorithmException.class)
- public void assertExecuteWithExist() {
- ShardingKeyGeneratorSegment keyGeneratorSegment = new ShardingKeyGeneratorSegment("uuid_key_generator", new AlgorithmSegment("uuid", new Properties()));
- ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
- ruleConfig.getKeyGenerators().put("uuid_key_generator", new AlgorithmConfiguration("uuid", new Properties()));
- updater.checkSQLStatement(database, createSQLStatement(keyGeneratorSegment), ruleConfig);
- }
-
- @Test(expected = InvalidAlgorithmConfigurationException.class)
- public void assertExecuteWithInvalidAlgorithm() {
- ShardingKeyGeneratorSegment keyGeneratorSegment = new ShardingKeyGeneratorSegment("invalid_key_generator", new AlgorithmSegment("INVALID_ALGORITHM", new Properties()));
- ShardingRuleConfiguration ruleConfig = new ShardingRuleConfiguration();
- updater.checkSQLStatement(database, createSQLStatement(keyGeneratorSegment), ruleConfig);
- }
-
- private CreateShardingKeyGeneratorStatement createSQLStatement(final ShardingKeyGeneratorSegment... ruleSegments) {
- return new CreateShardingKeyGeneratorStatement(Arrays.asList(ruleSegments));
- }
-}
diff --git a/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/segment/ShardingAlgorithmSegment.java b/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/segment/ShardingAlgorithmSegment.java
deleted file mode 100644
index d8d1b2eba6a..00000000000
--- a/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/segment/ShardingAlgorithmSegment.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.distsql.parser.segment;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
-import org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
-
-/**
- * Sharding algorithm segment.
- */
-@RequiredArgsConstructor
-@Getter
-public final class ShardingAlgorithmSegment implements ASTNode {
-
- private final String shardingAlgorithmName;
-
- private final AlgorithmSegment algorithmSegment;
-}
diff --git a/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/segment/ShardingKeyGeneratorSegment.java b/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/segment/ShardingKeyGeneratorSegment.java
deleted file mode 100644
index d0264e4872b..00000000000
--- a/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/segment/ShardingKeyGeneratorSegment.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.distsql.parser.segment;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.distsql.parser.segment.AlgorithmSegment;
-import org.apache.shardingsphere.sql.parser.api.visitor.ASTNode;
-
-/**
- * Sharding key generator segment.
- */
-@RequiredArgsConstructor
-@Getter
-public final class ShardingKeyGeneratorSegment implements ASTNode {
-
- private final String keyGeneratorName;
-
- private final AlgorithmSegment algorithmSegment;
-}
diff --git a/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/AlterShardingAlgorithmStatement.java b/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/AlterShardingAlgorithmStatement.java
deleted file mode 100644
index 11615a33aa2..00000000000
--- a/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/AlterShardingAlgorithmStatement.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.distsql.parser.statement;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.distsql.parser.statement.rdl.alter.AlterRuleStatement;
-import org.apache.shardingsphere.sharding.distsql.parser.segment.ShardingAlgorithmSegment;
-
-import java.util.Collection;
-
-/**
- * Alter sharding algorithm statement.
- */
-@RequiredArgsConstructor
-@Getter
-public final class AlterShardingAlgorithmStatement extends AlterRuleStatement {
-
- private final Collection<ShardingAlgorithmSegment> algorithmSegments;
-}
diff --git a/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/AlterShardingKeyGeneratorStatement.java b/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/AlterShardingKeyGeneratorStatement.java
deleted file mode 100644
index f4f7bac17be..00000000000
--- a/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/AlterShardingKeyGeneratorStatement.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.distsql.parser.statement;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.distsql.parser.statement.rdl.alter.AlterRuleStatement;
-import org.apache.shardingsphere.sharding.distsql.parser.segment.ShardingKeyGeneratorSegment;
-
-import java.util.Collection;
-
-/**
- * Alter sharding key generator statement.
- */
-@RequiredArgsConstructor
-@Getter
-public final class AlterShardingKeyGeneratorStatement extends AlterRuleStatement {
-
- private final Collection<ShardingKeyGeneratorSegment> keyGeneratorSegments;
-}
diff --git a/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/CreateShardingAlgorithmStatement.java b/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/CreateShardingAlgorithmStatement.java
deleted file mode 100644
index e9be4b85dcd..00000000000
--- a/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/CreateShardingAlgorithmStatement.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.distsql.parser.statement;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.distsql.parser.statement.rdl.create.CreateRuleStatement;
-import org.apache.shardingsphere.sharding.distsql.parser.segment.ShardingAlgorithmSegment;
-
-import java.util.Collection;
-
-/**
- * Create sharding algorithm statement.
- */
-@RequiredArgsConstructor
-@Getter
-public final class CreateShardingAlgorithmStatement extends CreateRuleStatement {
-
- private final Collection<ShardingAlgorithmSegment> algorithmSegments;
-}
diff --git a/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/CreateShardingKeyGeneratorStatement.java b/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/CreateShardingKeyGeneratorStatement.java
deleted file mode 100644
index 2bc1cbd7f58..00000000000
--- a/features/sharding/distsql/statement/src/main/java/org/apache/shardingsphere/sharding/distsql/parser/statement/CreateShardingKeyGeneratorStatement.java
+++ /dev/null
@@ -1,35 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.sharding.distsql.parser.statement;
-
-import lombok.Getter;
-import lombok.RequiredArgsConstructor;
-import org.apache.shardingsphere.distsql.parser.statement.rdl.create.CreateRuleStatement;
-import org.apache.shardingsphere.sharding.distsql.parser.segment.ShardingKeyGeneratorSegment;
-
-import java.util.Collection;
-
-/**
- * Create sharding key generator statement.
- */
-@RequiredArgsConstructor
-@Getter
-public final class CreateShardingKeyGeneratorStatement extends CreateRuleStatement {
-
- private final Collection<ShardingKeyGeneratorSegment> keyGeneratorSegments;
-}
diff --git a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/distsql/rdl/ShardingKeyGeneratorAssert.java b/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/distsql/rdl/ShardingKeyGeneratorAssert.java
deleted file mode 100644
index f47027b0ce7..00000000000
--- a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/segment/distsql/rdl/ShardingKeyGeneratorAssert.java
+++ /dev/null
@@ -1,49 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.test.sql.parser.parameterized.asserts.segment.distsql.rdl;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.sharding.distsql.parser.segment.ShardingKeyGeneratorSegment;
-import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
-import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.segment.distsql.AlgorithmAssert;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.distsql.rdl.ExpectedShardingKeyGenerator;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNotNull;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-/**
- * Sharding key generator assert.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class ShardingKeyGeneratorAssert {
-
- /**
- * Assert sharding key generator is correct with expected parser result.
- *
- * @param assertContext assert context
- * @param actual actual sharding key generator
- * @param expected expected sharding key generator test case
- */
- public static void assertIs(final SQLCaseAssertContext assertContext, final ShardingKeyGeneratorSegment actual, final ExpectedShardingKeyGenerator expected) {
- assertNotNull(assertContext.getText("Actual sharding key generator segment should exist."), actual.getAlgorithmSegment());
- assertThat(actual.getAlgorithmSegment().getName(), is(expected.getAlgorithmSegment().getName()));
- AlgorithmAssert.assertIs(assertContext, actual.getAlgorithmSegment(), expected.getAlgorithmSegment());
- }
-}
diff --git a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/alter/AlterRuleStatementAssert.java b/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/alter/AlterRuleStatementAssert.java
index b628b499c85..5e45b09012a 100644
--- a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/alter/AlterRuleStatementAssert.java
+++ b/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/alter/AlterRuleStatementAssert.java
@@ -30,7 +30,6 @@ import org.apache.shardingsphere.shadow.distsql.parser.statement.AlterShadowRule
import org.apache.shardingsphere.sharding.distsql.parser.statement.AlterDefaultShardingStrategyStatement;
import org.apache.shardingsphere.sharding.distsql.parser.statement.AlterShardingAuditorStatement;
import org.apache.shardingsphere.sharding.distsql.parser.statement.AlterShardingTableReferenceRuleStatement;
-import org.apache.shardingsphere.sharding.distsql.parser.statement.AlterShardingKeyGeneratorStatement;
import org.apache.shardingsphere.sharding.distsql.parser.statement.AlterShardingTableRuleStatement;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.alter.impl.AlterDatabaseDiscoveryHeartbeatStatementAssert;
@@ -45,7 +44,6 @@ import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.alter.impl.AlterShadowRuleStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.alter.impl.AlterShardingAuditorStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.alter.impl.AlterShardingTableReferenceRulesStatementAssert;
-import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.alter.impl.AlterShardingKeyGeneratorStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.alter.impl.AlterShardingTableRuleStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.alter.AlterDatabaseDiscoveryHeartbeatStatementTestCase;
@@ -58,7 +56,6 @@ import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.alter.AlterShadowRuleStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.alter.AlterShardingAuditorStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.alter.AlterShardingTableReferenceRulesStatementTestCase;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.alter.AlterShardingKeyGeneratorStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.create.AlterDefaultShadowAlgorithmStatementTestCase;
/**
@@ -97,8 +94,6 @@ public final class AlterRuleStatementAssert {
} else if (actual instanceof AlterDefaultSingleTableRuleStatement) {
AlterDefaultSingleTableRuleStatementAssert.assertIs(assertContext, (AlterDefaultSingleTableRuleStatement) actual,
(AlterDefaultSingleTableRuleStatementTestCase) expected);
- } else if (actual instanceof AlterShardingKeyGeneratorStatement) {
- AlterShardingKeyGeneratorStatementAssert.assertIs(assertContext, (AlterShardingKeyGeneratorStatement) actual, (AlterShardingKeyGeneratorStatementTestCase) expected);
} else if (actual instanceof AlterShardingAuditorStatement) {
AlterShardingAuditorStatementAssert.assertIs(assertContext, (AlterShardingAuditorStatement) actual, (AlterShardingAuditorStatementTestCase) expected);
} else if (actual instanceof AlterDefaultShadowAlgorithmStatement) {
diff --git a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/alter/impl/AlterShardingKeyGeneratorStatementAssert.java b/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/alter/impl/AlterShardingKeyGeneratorStatementAssert.java
deleted file mode 100644
index 346f74722ea..00000000000
--- a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/alter/impl/AlterShardingKeyGeneratorStatementAssert.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.alter.impl;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.sharding.distsql.parser.segment.ShardingKeyGeneratorSegment;
-import org.apache.shardingsphere.sharding.distsql.parser.statement.AlterShardingKeyGeneratorStatement;
-import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
-import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.segment.distsql.rdl.ShardingKeyGeneratorAssert;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.distsql.rdl.ExpectedShardingKeyGenerator;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.alter.AlterShardingKeyGeneratorStatementTestCase;
-
-import java.util.Collection;
-import java.util.List;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-/**
- * Alter sharding key generator statement assert.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class AlterShardingKeyGeneratorStatementAssert {
-
- /**
- * Assert alter sharding key generator statement is correct with expected parser result.
- *
- * @param assertContext assert context
- * @param actual actual alter sharding key generator statement
- * @param expected expected create sharding key generator statement test case
- */
- public static void assertIs(final SQLCaseAssertContext assertContext, final AlterShardingKeyGeneratorStatement actual, final AlterShardingKeyGeneratorStatementTestCase expected) {
- if (null == expected) {
- assertNull(assertContext.getText("Actual sharding key generator statement should not exist."), actual);
- } else {
- assertNotNull(assertContext.getText("Actual sharding key generator statement should exist."), actual);
- assertShardingKeyGenerator(assertContext, actual.getKeyGeneratorSegments(), expected.getShardingKeyGenerators());
- }
- }
-
- private static void assertShardingKeyGenerator(final SQLCaseAssertContext assertContext, final Collection<ShardingKeyGeneratorSegment> actual, final List<ExpectedShardingKeyGenerator> expected) {
- if (null == expected) {
- assertNull(assertContext.getText("Actual sharding key generator segments should not exist."), actual);
- } else {
- assertNotNull(assertContext.getText("Actual sharding key generator segments should exist."), actual);
- int count = 0;
- for (ShardingKeyGeneratorSegment each : actual) {
- ShardingKeyGeneratorAssert.assertIs(assertContext, each, expected.get(count));
- count++;
- }
- }
- }
-}
diff --git a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/create/CreateRuleStatementAssert.java b/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/create/CreateRuleStatementAssert.java
index bc45219071e..124dfd589cd 100644
--- a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/create/CreateRuleStatementAssert.java
+++ b/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/create/CreateRuleStatementAssert.java
@@ -22,21 +22,20 @@ import lombok.NoArgsConstructor;
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.CreateDatabaseDiscoveryHeartbeatStatement;
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.CreateDatabaseDiscoveryRuleStatement;
import org.apache.shardingsphere.dbdiscovery.distsql.parser.statement.CreateDatabaseDiscoveryTypeStatement;
-import org.apache.shardingsphere.distsql.parser.statement.rdl.create.SetDefaultSingleTableStorageUnitStatement;
import org.apache.shardingsphere.distsql.parser.statement.rdl.create.CreateRuleStatement;
+import org.apache.shardingsphere.distsql.parser.statement.rdl.create.SetDefaultSingleTableStorageUnitStatement;
import org.apache.shardingsphere.encrypt.distsql.parser.statement.CreateEncryptRuleStatement;
import org.apache.shardingsphere.readwritesplitting.distsql.parser.statement.CreateReadwriteSplittingRuleStatement;
import org.apache.shardingsphere.shadow.distsql.parser.statement.CreateDefaultShadowAlgorithmStatement;
import org.apache.shardingsphere.shadow.distsql.parser.statement.CreateShadowAlgorithmStatement;
import org.apache.shardingsphere.shadow.distsql.parser.statement.CreateShadowRuleStatement;
+import org.apache.shardingsphere.sharding.distsql.parser.statement.CreateBroadcastTableRuleStatement;
import org.apache.shardingsphere.sharding.distsql.parser.statement.CreateDefaultShardingStrategyStatement;
-import org.apache.shardingsphere.sharding.distsql.parser.statement.CreateShardingAlgorithmStatement;
import org.apache.shardingsphere.sharding.distsql.parser.statement.CreateShardingAuditorStatement;
import org.apache.shardingsphere.sharding.distsql.parser.statement.CreateShardingTableReferenceRuleStatement;
-import org.apache.shardingsphere.sharding.distsql.parser.statement.CreateBroadcastTableRuleStatement;
-import org.apache.shardingsphere.sharding.distsql.parser.statement.CreateShardingKeyGeneratorStatement;
import org.apache.shardingsphere.sharding.distsql.parser.statement.CreateShardingTableRuleStatement;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
+import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.create.impl.CreateBroadcastTableRuleStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.create.impl.CreateDatabaseDiscoveryHeartbeatStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.create.impl.CreateDatabaseDiscoveryRuleStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.create.impl.CreateDatabaseDiscoveryTypeStatementAssert;
@@ -47,13 +46,11 @@ import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.create.impl.CreateReadwriteSplittingRuleStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.create.impl.CreateShadowAlgorithmStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.create.impl.CreateShadowRuleStatementAssert;
-import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.create.impl.CreateShardingAlgorithmStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.create.impl.CreateShardingAuditorStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.create.impl.CreateShardingTableReferenceRuleStatementAssert;
-import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.create.impl.CreateBroadcastTableRuleStatementAssert;
-import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.create.impl.CreateShardingKeyGeneratorStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.create.impl.CreateShardingTableRuleStatementAssert;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
+import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.create.CreateBroadcastTableRuleStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.create.CreateDatabaseDiscoveryHeartbeatStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.create.CreateDatabaseDiscoveryTypeStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.create.CreateDefaultShadowAlgorithmStatementTestCase;
@@ -63,11 +60,8 @@ import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.create.CreateReadwriteSplittingRuleStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.create.CreateShadowAlgorithmStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.create.CreateShadowRuleStatementTestCase;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.create.CreateShardingAlgorithmStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.create.CreateShardingAuditorStatementTestCase;
import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.create.CreateShardingTableReferenceRuleStatementTestCase;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.create.CreateBroadcastTableRuleStatementTestCase;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.create.CreateShardingKeyGeneratorStatementTestCase;
/**
* Create RDL Statement assert.
@@ -104,16 +98,12 @@ public final class CreateRuleStatementAssert {
CreateShadowRuleStatementAssert.assertIs(assertContext, (CreateShadowRuleStatement) actual, (CreateShadowRuleStatementTestCase) expected);
} else if (actual instanceof CreateShadowAlgorithmStatement) {
CreateShadowAlgorithmStatementAssert.assertIs(assertContext, (CreateShadowAlgorithmStatement) actual, (CreateShadowAlgorithmStatementTestCase) expected);
- } else if (actual instanceof CreateShardingAlgorithmStatement) {
- CreateShardingAlgorithmStatementAssert.assertIs(assertContext, (CreateShardingAlgorithmStatement) actual, (CreateShardingAlgorithmStatementTestCase) expected);
} else if (actual instanceof CreateDefaultShardingStrategyStatement) {
CreateDefaultShardingStrategyStatementAssert.assertIs(assertContext, (CreateDefaultShardingStrategyStatement) actual, (CreateDefaultShardingStrategyStatementTestCase) expected);
} else if (actual instanceof CreateDefaultShadowAlgorithmStatement) {
CreateDefaultShadowAlgorithmStatementAssert.assertIs(assertContext, (CreateDefaultShadowAlgorithmStatement) actual, (CreateDefaultShadowAlgorithmStatementTestCase) expected);
} else if (actual instanceof SetDefaultSingleTableStorageUnitStatement) {
CreateDefaultSingleTableRuleStatementAssert.assertIs(assertContext, (SetDefaultSingleTableStorageUnitStatement) actual, (CreateDefaultSingleTableRuleStatementTestCase) expected);
- } else if (actual instanceof CreateShardingKeyGeneratorStatement) {
- CreateShardingKeyGeneratorStatementAssert.assertIs(assertContext, (CreateShardingKeyGeneratorStatement) actual, (CreateShardingKeyGeneratorStatementTestCase) expected);
} else if (actual instanceof CreateShardingAuditorStatement) {
CreateShardingAuditorStatementAssert.assertIs(assertContext, (CreateShardingAuditorStatement) actual, (CreateShardingAuditorStatementTestCase) expected);
}
diff --git a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/create/impl/CreateShardingAlgorithmStatementAssert.java b/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/create/impl/CreateShardingAlgorithmStatementAssert.java
deleted file mode 100644
index 21a518af13e..00000000000
--- a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/create/impl/CreateShardingAlgorithmStatementAssert.java
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.create.impl;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.sharding.distsql.parser.segment.ShardingAlgorithmSegment;
-import org.apache.shardingsphere.sharding.distsql.parser.statement.CreateShardingAlgorithmStatement;
-import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
-import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.segment.distsql.AlgorithmAssert;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.distsql.rdl.ExpectedShardingAlgorithm;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.create.CreateShardingAlgorithmStatementTestCase;
-
-import java.util.Collection;
-import java.util.List;
-import java.util.Map;
-import java.util.stream.Collectors;
-
-import static org.hamcrest.CoreMatchers.is;
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-import static org.hamcrest.MatcherAssert.assertThat;
-
-/**
- * Create sharding algorithm statement assert.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class CreateShardingAlgorithmStatementAssert {
-
- /**
- * Assert create sharding algorithm statement is correct with expected parser result.
- *
- * @param assertContext assert context
- * @param actual actual create sharding algorithm statement
- * @param expected expected create sharding algorithm statement test case
- */
- public static void assertIs(final SQLCaseAssertContext assertContext, final CreateShardingAlgorithmStatement actual, final CreateShardingAlgorithmStatementTestCase expected) {
- if (null == expected) {
- assertNull(assertContext.getText("Actual statement should not exist."), actual);
- } else {
- assertNotNull(assertContext.getText("Actual statement should exist."), actual);
- assertShardingAlgorithm(assertContext, actual.getAlgorithmSegments(), expected.getShardingAlgorithms());
- }
- }
-
- private static void assertShardingAlgorithm(final SQLCaseAssertContext assertContext, final Collection<ShardingAlgorithmSegment> actual, final List<ExpectedShardingAlgorithm> expected) {
- if (null == expected) {
- assertNull(assertContext.getText("Actual sharding algorithm should not exist."), actual);
- } else {
- assertNotNull(assertContext.getText("Actual sharding algorithm should exist."), actual);
- final Map<String, ShardingAlgorithmSegment> actualMap = actual.stream().collect(Collectors.toMap(ShardingAlgorithmSegment::getShardingAlgorithmName, each -> each));
- for (ExpectedShardingAlgorithm each : expected) {
- ShardingAlgorithmSegment actualAlgorithm = actualMap.get(each.getShardingAlgorithmName());
- assertNotNull(assertContext.getText("Actual sharding algorithm should exist."), actualAlgorithm);
- assertThat(actualAlgorithm.getShardingAlgorithmName(), is(each.getShardingAlgorithmName()));
- AlgorithmAssert.assertIs(assertContext, actualAlgorithm.getAlgorithmSegment(), each.getAlgorithmSegment());
- }
- }
- }
-}
diff --git a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/create/impl/CreateShardingKeyGeneratorStatementAssert.java b/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/create/impl/CreateShardingKeyGeneratorStatementAssert.java
deleted file mode 100644
index 73165aef74d..00000000000
--- a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/distsql/rdl/create/impl/CreateShardingKeyGeneratorStatementAssert.java
+++ /dev/null
@@ -1,69 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.test.sql.parser.parameterized.asserts.statement.distsql.rdl.create.impl;
-
-import lombok.AccessLevel;
-import lombok.NoArgsConstructor;
-import org.apache.shardingsphere.sharding.distsql.parser.segment.ShardingKeyGeneratorSegment;
-import org.apache.shardingsphere.sharding.distsql.parser.statement.CreateShardingKeyGeneratorStatement;
-import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.SQLCaseAssertContext;
-import org.apache.shardingsphere.test.sql.parser.parameterized.asserts.segment.distsql.rdl.ShardingKeyGeneratorAssert;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.distsql.rdl.ExpectedShardingKeyGenerator;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.create.CreateShardingKeyGeneratorStatementTestCase;
-
-import java.util.Collection;
-import java.util.List;
-
-import static org.junit.Assert.assertNotNull;
-import static org.junit.Assert.assertNull;
-
-/**
- * Create sharding key generator statement assert.
- */
-@NoArgsConstructor(access = AccessLevel.PRIVATE)
-public final class CreateShardingKeyGeneratorStatementAssert {
-
- /**
- * Assert create sharding key generator statement is correct with expected parser result.
- *
- * @param assertContext assert context
- * @param actual actual create sharding key generator statement
- * @param expected expected create sharding key generator statement test case
- */
- public static void assertIs(final SQLCaseAssertContext assertContext, final CreateShardingKeyGeneratorStatement actual, final CreateShardingKeyGeneratorStatementTestCase expected) {
- if (null == expected) {
- assertNull(assertContext.getText("Actual sharding key generator statement should not exist."), actual);
- } else {
- assertNotNull(assertContext.getText("Actual sharding key generator statement should exist."), actual);
- assertShardingKeyGenerator(assertContext, actual.getKeyGeneratorSegments(), expected.getShardingKeyGenerators());
- }
- }
-
- private static void assertShardingKeyGenerator(final SQLCaseAssertContext assertContext, final Collection<ShardingKeyGeneratorSegment> actual, final List<ExpectedShardingKeyGenerator> expected) {
- if (null == expected) {
- assertNull(assertContext.getText("Actual sharding key generator segments should not exist."), actual);
- } else {
- assertNotNull(assertContext.getText("Actual sharding key generator segments should exist."), actual);
- int count = 0;
- for (ShardingKeyGeneratorSegment each : actual) {
- ShardingKeyGeneratorAssert.assertIs(assertContext, each, expected.get(count));
- count++;
- }
- }
- }
-}
diff --git a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/distsql/rdl/ExpectedShardingAlgorithm.java b/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/distsql/rdl/ExpectedShardingAlgorithm.java
deleted file mode 100644
index 7f4ca8136a0..00000000000
--- a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/distsql/rdl/ExpectedShardingAlgorithm.java
+++ /dev/null
@@ -1,40 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.distsql.rdl;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.AbstractExpectedIdentifierSQLSegment;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.distsql.ExpectedAlgorithm;
-
-import javax.xml.bind.annotation.XmlAttribute;
-import javax.xml.bind.annotation.XmlElement;
-
-/**
- * Expected sharding algorithm segment.
- */
-@Getter
-@Setter
-public final class ExpectedShardingAlgorithm extends AbstractExpectedIdentifierSQLSegment {
-
- @XmlAttribute(name = "sharding-algorithm-name")
- private String shardingAlgorithmName;
-
- @XmlElement(name = "algorithm")
- private ExpectedAlgorithm algorithmSegment;
-}
diff --git a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/distsql/rdl/ExpectedShardingKeyGenerator.java b/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/distsql/rdl/ExpectedShardingKeyGenerator.java
deleted file mode 100644
index 713b24adc06..00000000000
--- a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/segment/impl/distsql/rdl/ExpectedShardingKeyGenerator.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.distsql.rdl;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.AbstractExpectedIdentifierSQLSegment;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.distsql.ExpectedAlgorithm;
-
-import javax.xml.bind.annotation.XmlElement;
-
-/**
- * Expected sharding key generator.
- */
-@Getter
-@Setter
-public final class ExpectedShardingKeyGenerator extends AbstractExpectedIdentifierSQLSegment {
-
- @XmlElement(name = "algorithm")
- private ExpectedAlgorithm algorithmSegment;
-}
diff --git a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/alter/AlterShardingAlgorithmStatementTestCase.java b/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/alter/AlterShardingAlgorithmStatementTestCase.java
deleted file mode 100644
index 8c8e6af0530..00000000000
--- a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/alter/AlterShardingAlgorithmStatementTestCase.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.alter;
-
-import lombok.Getter;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.distsql.rdl.ExpectedShardingAlgorithm;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
-
-import javax.xml.bind.annotation.XmlElement;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Alter sharding algorithm statement test case.
- */
-@Getter
-public final class AlterShardingAlgorithmStatementTestCase extends SQLParserTestCase {
-
- @XmlElement(name = "shardingAlgorithm")
- private final List<ExpectedShardingAlgorithm> shardingAlgorithms = new LinkedList<>();
-}
diff --git a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/alter/AlterShardingKeyGeneratorStatementTestCase.java b/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/alter/AlterShardingKeyGeneratorStatementTestCase.java
deleted file mode 100644
index 59a5438f586..00000000000
--- a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/alter/AlterShardingKeyGeneratorStatementTestCase.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.alter;
-
-import lombok.Getter;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.distsql.rdl.ExpectedShardingKeyGenerator;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
-
-import javax.xml.bind.annotation.XmlElement;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Alter sharding key generator statement test case.
- */
-@Getter
-public final class AlterShardingKeyGeneratorStatementTestCase extends SQLParserTestCase {
-
- @XmlElement(name = "sharding-key-generator")
- private final List<ExpectedShardingKeyGenerator> shardingKeyGenerators = new LinkedList<>();
-}
diff --git a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/create/CreateShardingAlgorithmStatementTestCase.java b/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/create/CreateShardingAlgorithmStatementTestCase.java
deleted file mode 100644
index 26e1311f7d3..00000000000
--- a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/create/CreateShardingAlgorithmStatementTestCase.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.create;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.distsql.rdl.ExpectedShardingAlgorithm;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
-
-import javax.xml.bind.annotation.XmlElement;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Create sharding algorithm statement test case.
- */
-@Getter
-@Setter
-public final class CreateShardingAlgorithmStatementTestCase extends SQLParserTestCase {
-
- @XmlElement(name = "shardingAlgorithm")
- private final List<ExpectedShardingAlgorithm> shardingAlgorithms = new LinkedList<>();
-}
diff --git a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/create/CreateShardingKeyGeneratorStatementTestCase.java b/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/create/CreateShardingKeyGeneratorStatementTestCase.java
deleted file mode 100644
index 73ea62029cc..00000000000
--- a/test/parser/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/jaxb/cases/domain/statement/distsql/rdl/create/CreateShardingKeyGeneratorStatementTestCase.java
+++ /dev/null
@@ -1,38 +0,0 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.distsql.rdl.create;
-
-import lombok.Getter;
-import lombok.Setter;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.segment.impl.distsql.rdl.ExpectedShardingKeyGenerator;
-import org.apache.shardingsphere.test.sql.parser.parameterized.jaxb.cases.domain.statement.SQLParserTestCase;
-
-import javax.xml.bind.annotation.XmlElement;
-import java.util.LinkedList;
-import java.util.List;
-
-/**
- * Create sharding key generator statement test case.
- */
-@Getter
-@Setter
-public final class CreateShardingKeyGeneratorStatementTestCase extends SQLParserTestCase {
-
- @XmlElement(name = "sharding-key-generator")
- private final List<ExpectedShardingKeyGenerator> shardingKeyGenerators = new LinkedList<>();
-}
diff --git a/test/parser/src/main/resources/case/rdl/alter.xml b/test/parser/src/main/resources/case/rdl/alter.xml
index cdf7c07281a..4908a5e620f 100644
--- a/test/parser/src/main/resources/case/rdl/alter.xml
+++ b/test/parser/src/main/resources/case/rdl/alter.xml
@@ -239,12 +239,6 @@
</shadow-algorithm>
</alter-default-shadow-algorithm>
- <alter-sharding-key-generator sql-case-id="alter-sharding-key-generator">
- <sharding-key-generator key-generator-name="uuid_key_generator">
- <algorithm algorithm-name="uuid" />
- </sharding-key-generator>
- </alter-sharding-key-generator>
-
<alter-sharding-auditor sql-case-id="alter-sharding-auditor">
<sharding-auditor auditor-name="sharding_key_required_auditor">
<algorithm algorithm-name="DML_SHARDING_CONDITIONS" />
@@ -255,13 +249,13 @@
<alter-default-sharding-strategy sql-case-id="alter-default-sharding-strategy">
<strategy default-type="TABLE" strategy-type="standard" sharding-column="order_id">
- <algorithm-segment algorithm-name="algorithms_name" />
+ <algorithm-segment algorithm-name="INLINE" />
</strategy>
</alter-default-sharding-strategy>
<alter-default-sharding-strategy sql-case-id="alter-default-sharding-strategy-complex">
<strategy default-type="TABLE" strategy-type="complex" sharding-column="order_id,user_id">
- <algorithm-segment algorithm-name="algorithms_name" />
+ <algorithm-segment algorithm-name="INLINE" />
</strategy>
</alter-default-sharding-strategy>
</sql-parser-test-cases>
diff --git a/test/parser/src/main/resources/case/rdl/create.xml b/test/parser/src/main/resources/case/rdl/create.xml
index 142fa2e93c2..651758916cd 100644
--- a/test/parser/src/main/resources/case/rdl/create.xml
+++ b/test/parser/src/main/resources/case/rdl/create.xml
@@ -113,20 +113,20 @@
<rule name="t_order" key-generate-strategy-column="another_id">
<data-source>ms_group_${0..1}</data-source>
<table-strategy type="standard" sharding-column="user_id">
- <algorithm-segment algorithm-name="table_inline" />
+ <algorithm-segment algorithm-name="INLINE" />
</table-strategy>
<database-strategy type="standard" sharding-column="order_id">
- <algorithm-segment algorithm-name="database_inline" />
+ <algorithm-segment algorithm-name="INLINE" />
</database-strategy>
<key-generate-strategy algorithm-name="snowflake" />
</rule>
<rule name="t_order_item" key-generate-strategy-column="another_id">
<data-source>ms_group_${0..1}</data-source>
<table-strategy type="standard" sharding-column="user_id">
- <algorithm-segment algorithm-name="table_inline" />
+ <algorithm-segment algorithm-name="INLINE" />
</table-strategy>
<database-strategy type="standard" sharding-column="order_id">
- <algorithm-segment algorithm-name="database_inline" />
+ <algorithm-segment algorithm-name="INLINE" />
</database-strategy>
</rule>
</create-sharding-table-rule>
@@ -135,20 +135,20 @@
<rule name="t_order" key-generate-strategy-column="another_id">
<data-source>ms_group_${['abc','ac']}.table</data-source>
<table-strategy type="standard" sharding-column="user_id">
- <algorithm-segment algorithm-name="table_inline" />
+ <algorithm-segment algorithm-name="INLINE" />
</table-strategy>
<database-strategy type="standard" sharding-column="order_id">
- <algorithm-segment algorithm-name="database_inline" />
+ <algorithm-segment algorithm-name="INLINE" />
</database-strategy>
<key-generate-strategy algorithm-name="snowflake" />
</rule>
<rule name="t_order_item" key-generate-strategy-column="another_id">
<data-source>ms_group_${0..1}</data-source>
<table-strategy type="standard" sharding-column="user_id">
- <algorithm-segment algorithm-name="table_inline" />
+ <algorithm-segment algorithm-name="INLINE" />
</table-strategy>
<database-strategy type="standard" sharding-column="order_id">
- <algorithm-segment algorithm-name="database_inline" />
+ <algorithm-segment algorithm-name="INLINE" />
</database-strategy>
</rule>
</create-sharding-table-rule>
@@ -157,20 +157,20 @@
<rule name="t_order" key-generate-strategy-column="another_id">
<data-source>ms_group_${0..1}</data-source>
<table-strategy type="standard" sharding-column="user_id">
- <algorithm-segment algorithm-name="table_inline" />
+ <algorithm-segment algorithm-name="INLINE" />
</table-strategy>
<database-strategy type="complex" sharding-column="order_id,user_id">
- <algorithm-segment algorithm-name="database_inline" />
+ <algorithm-segment algorithm-name="INLINE" />
</database-strategy>
<key-generate-strategy algorithm-name="snowflake" />
</rule>
<rule name="t_order_item" key-generate-strategy-column="another_id">
<data-source>ms_group_${0..1}</data-source>
<table-strategy type="standard" sharding-column="user_id">
- <algorithm-segment algorithm-name="table_inline" />
+ <algorithm-segment algorithm-name="INLINE" />
</table-strategy>
<database-strategy type="standard" sharding-column="order_id">
- <algorithm-segment algorithm-name="database_inline" />
+ <algorithm-segment algorithm-name="INLINE" />
</database-strategy>
</rule>
</create-sharding-table-rule>
@@ -179,10 +179,10 @@
<rule name="t_order" key-generate-strategy-column="another_id">
<data-source>ms_group_${0..1}</data-source>
<table-strategy type="standard" sharding-column="user_id">
- <algorithm-segment algorithm-name="table_inline" />
+ <algorithm-segment algorithm-name="INLINE" />
</table-strategy>
<database-strategy type="standard" sharding-column="order_id" >
- <algorithm-segment algorithm-name="inline">
+ <algorithm-segment algorithm-name="INLINE">
<properties>
<property key="algorithm-expression" value="ms_group_${order_id% 2}" />
</properties>
@@ -394,31 +394,21 @@
</rule>
</create-shadow-rule>
- <create-sharding-algorithm sql-case-id="create-sharding-algorithm">
- <shardingAlgorithm sharding-algorithm-name="algorithm_name">
- <algorithm algorithm-name="hash_mod">
- <properties>
- <property key="algorithm-expression" value="t_order_${order_id % 2}"/>
- </properties>
- </algorithm>
- </shardingAlgorithm>
- </create-sharding-algorithm>
-
<create-default-sharding-strategy sql-case-id="create-default-sharding-table-strategy-with-lower-case">
<strategy default-type="table" strategy-type="standard" sharding-column="order_id">
- <algorithm-segment algorithm-name="algorithms_name" />
+ <algorithm-segment algorithm-name="INLINE" />
</strategy>
</create-default-sharding-strategy>
<create-default-sharding-strategy sql-case-id="create-default-sharding-database-strategy">
<strategy default-type="DATABASE" strategy-type="STANDARD" sharding-column="ORDER_ID">
- <algorithm-segment algorithm-name="algorithms_name" />
+ <algorithm-segment algorithm-name="INLINE" />
</strategy>
</create-default-sharding-strategy>
<create-default-sharding-strategy sql-case-id="create-default-sharding-strategy-complex">
<strategy default-type="TABLE" strategy-type="complex" sharding-column="order_id,user_id">
- <algorithm-segment algorithm-name="algorithms_name" />
+ <algorithm-segment algorithm-name="INLINE" />
</strategy>
</create-default-sharding-strategy>
diff --git a/test/parser/src/main/resources/sql/supported/rdl/alter.xml b/test/parser/src/main/resources/sql/supported/rdl/alter.xml
index 888d52a0799..5cd353fdc46 100644
--- a/test/parser/src/main/resources/sql/supported/rdl/alter.xml
+++ b/test/parser/src/main/resources/sql/supported/rdl/alter.xml
@@ -40,6 +40,6 @@
<distsql-case id="alter-sharding-table-rule-complex" value="ALTER SHARDING TABLE RULE t_order (DATANODES('ms_group_${0..1}'),DATABASE_STRATEGY(TYPE='complex',sharding_columns = order_id,user_id, sharding_algorithm(type(name='database_inline'))),TABLE_STRATEGY(TYPE='standard',sharding_column = user_id,sharding_algorithm(type(name='table_inline'))),KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME='snowflake')))" />
<distsql-case id="alter-default-single-table" value="SET DEFAULT SINGLE TABLE STORAGE UNIT = ds_0" />
<distsql-case id="alter-sharding-auditor" value="ALTER SHARDING AUDITOR sharding_key_required_auditor(TYPE(NAME='DML_SHARDING_CONDITIONS'))" />
- <distsql-case id="alter-default-sharding-strategy" value="ALTER DEFAULT SHARDING TABLE STRATEGY(TYPE='standard', SHARDING_COLUMN=order_id, SHARDING_ALGORITHM(TYPE(NAME='algorithms_name')))" />
- <distsql-case id="alter-default-sharding-strategy-complex" value="ALTER DEFAULT SHARDING TABLE STRATEGY(TYPE='complex', SHARDING_COLUMNS=order_id,user_id, SHARDING_ALGORITHM(TYPE(NAME='algorithms_name')))" />
+ <distsql-case id="alter-default-sharding-strategy" value="ALTER DEFAULT SHARDING TABLE STRATEGY(TYPE='standard', SHARDING_COLUMN=order_id, SHARDING_ALGORITHM(TYPE(NAME='INLINE')))" />
+ <distsql-case id="alter-default-sharding-strategy-complex" value="ALTER DEFAULT SHARDING TABLE STRATEGY(TYPE='complex', SHARDING_COLUMNS=order_id,user_id, SHARDING_ALGORITHM(TYPE(NAME='INLINE')))" />
</sql-cases>
diff --git a/test/parser/src/main/resources/sql/supported/rdl/create.xml b/test/parser/src/main/resources/sql/supported/rdl/create.xml
index 5318d715feb..b737fcaa79d 100644
--- a/test/parser/src/main/resources/sql/supported/rdl/create.xml
+++ b/test/parser/src/main/resources/sql/supported/rdl/create.xml
@@ -37,16 +37,15 @@
<distsql-case id="create-encrypt-rule" value="CREATE ENCRYPT RULE t_encrypt (RESOURCE=ds_1, COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc'))), (NAME=order_id, CIPHER =order_cipher,TYPE(NAME='MD5'))))" />
<distsql-case id="create-encrypt-rule-with-assisted-query-column" value="CREATE ENCRYPT RULE t_encrypt (RESOURCE=ds_1, COLUMNS((NAME=user_id,PLAIN=user_plain,CIPHER=user_cipher,ASSISTED_QUERY_COLUMN=assisted_column, TYPE(NAME='AES',PROPERTIES('aes-key-value'='123456abc')), TYPE(NAME='MD5')), (NAME=order_id, CIPHER =order_cipher,TYPE(NAME='MD5'))))" />
<distsql-case id="create-shadow-rule" value="CREATE SHADOW RULE shadow_rule(SOURCE=demo_ds,SHADOW=demo_ds_shadow,t_order(TYPE(NAME='REGEX_MATCH',PROPERTIES('operation'='insert','column'='user_id','regex'='[1]')),TYPE(NAME='SIMPLE_HINT',PROPERTIES('shadow'='true','foo'='bar'))))" />
- <distsql-case id="create-default-sharding-table-strategy-with-lower-case" value="create default sharding table strategy(type='standard', sharding_column=order_id, SHARDING_ALGORITHM(TYPE(NAME='algorithms_name')))" />
- <distsql-case id="create-default-sharding-database-strategy" value="CREATE DEFAULT SHARDING DATABASE STRATEGY(TYPE='STANDARD', SHARDING_COLUMN=ORDER_ID, SHARDING_ALGORITHM(TYPE(NAME='algorithms_name')))" />
- <distsql-case id="create-default-sharding-strategy-complex" value="CREATE DEFAULT SHARDING TABLE STRATEGY(TYPE='complex', SHARDING_COLUMNS=order_id,user_id, SHARDING_ALGORITHM(TYPE(NAME='algorithms_name')))" />
- <distsql-case id="create-sharding-table-rule" value="CREATE SHARDING TABLE RULE t_order (DATANODES('ms_group_${0..1}'),DATABASE_STRATEGY(TYPE='standard',sharding_column = order_id,sharding_algorithm(type(name='database_inline'))),TABLE_STRATEGY(TYPE='standard',sharding_column = user_id,sharding_algorithm(type(name='table_inline'))),KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME='snowflake'))),t_order_item (DATANODES('ms_group_${0..1}'),DATABASE_STRATEGY(TYPE='standard',sharding_co [...]
- <distsql-case id="create-sharding-table-rule-with-enum-inline-expression" value="CREATE SHARDING TABLE RULE t_order (DATANODES("ms_group_${['abc','ac']}.table " ),DATABASE_STRATEGY(TYPE='standard',sharding_column = order_id,sharding_algorithm(type(name='database_inline'))),TABLE_STRATEGY(TYPE='standard',sharding_column = user_id,sharding_algorithm(type(name='table_inline'))),KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME='snowflake'))),t_order_item (DATANODES('ms_group_$ [...]
- <distsql-case id="create-sharding-table-rule-complex" value="CREATE SHARDING TABLE RULE t_order (DATANODES('ms_group_${0..1}'),DATABASE_STRATEGY(TYPE='complex',sharding_columns = order_id,user_id,sharding_algorithm(type(name='database_inline'))),TABLE_STRATEGY(TYPE='standard',sharding_column = user_id,sharding_algorithm(type(name='table_inline'))),KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME='snowflake'))),t_order_item (DATANODES('ms_group_${0..1}'),DATABASE_STRATEGY(TYPE='stand [...]
- <distsql-case id="create-sharding-table-rule-with-auto-create-algorithm" value="CREATE SHARDING TABLE RULE t_order (DATANODES('ms_group_${0..1}'),DATABASE_STRATEGY(TYPE='standard',sharding_column = order_id,sharding_algorithm (TYPE(NAME='inline',PROPERTIES('algorithm-expression'='ms_group_${order_id% 2}')))),TABLE_STRATEGY(TYPE='standard',sharding_column = user_id,sharding_algorithm(type(name='table_inline'))),KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME='snowflake')))" />
+ <distsql-case id="create-default-sharding-table-strategy-with-lower-case" value="create default sharding table strategy(type='standard', sharding_column=order_id, SHARDING_ALGORITHM(TYPE(NAME='INLINE')))" />
+ <distsql-case id="create-default-sharding-database-strategy" value="CREATE DEFAULT SHARDING DATABASE STRATEGY(TYPE='STANDARD', SHARDING_COLUMN=ORDER_ID, SHARDING_ALGORITHM(TYPE(NAME='INLINE')))" />
+ <distsql-case id="create-default-sharding-strategy-complex" value="CREATE DEFAULT SHARDING TABLE STRATEGY(TYPE='complex', SHARDING_COLUMNS=order_id,user_id, SHARDING_ALGORITHM(TYPE(NAME='INLINE')))" />
+ <distsql-case id="create-sharding-table-rule" value="CREATE SHARDING TABLE RULE t_order (DATANODES('ms_group_${0..1}'),DATABASE_STRATEGY(TYPE='standard',sharding_column = order_id,sharding_algorithm(type(name='INLINE'))),TABLE_STRATEGY(TYPE='standard',sharding_column = user_id,sharding_algorithm(type(name='INLINE'))),KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME='snowflake'))),t_order_item (DATANODES('ms_group_${0..1}'),DATABASE_STRATEGY(TYPE='standard',sharding_column = order_id [...]
+ <distsql-case id="create-sharding-table-rule-with-enum-inline-expression" value="CREATE SHARDING TABLE RULE t_order (DATANODES("ms_group_${['abc','ac']}.table " ),DATABASE_STRATEGY(TYPE='standard',sharding_column = order_id,sharding_algorithm(type(name='INLINE'))),TABLE_STRATEGY(TYPE='standard',sharding_column = user_id,sharding_algorithm(type(name='INLINE'))),KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME='snowflake'))),t_order_item (DATANODES('ms_group_${0..1}'),DATABA [...]
+ <distsql-case id="create-sharding-table-rule-complex" value="CREATE SHARDING TABLE RULE t_order (DATANODES('ms_group_${0..1}'),DATABASE_STRATEGY(TYPE='complex',sharding_columns = order_id,user_id,sharding_algorithm(type(name='INLINE'))),TABLE_STRATEGY(TYPE='standard',sharding_column = user_id,sharding_algorithm(type(name='INLINE'))),KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME='snowflake'))),t_order_item (DATANODES('ms_group_${0..1}'),DATABASE_STRATEGY(TYPE='standard',sharding_c [...]
+ <distsql-case id="create-sharding-table-rule-with-auto-create-algorithm" value="CREATE SHARDING TABLE RULE t_order (DATANODES('ms_group_${0..1}'),DATABASE_STRATEGY(TYPE='standard',sharding_column = order_id,sharding_algorithm(TYPE(NAME='INLINE',PROPERTIES('algorithm-expression'='ms_group_${order_id% 2}')))),TABLE_STRATEGY(TYPE='standard',sharding_column = user_id,sharding_algorithm(type(name='INLINE'))),KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME='snowflake')))" />
<distsql-case id="create-default-shadow-algorithm" value="CREATE DEFAULT SHADOW ALGORITHM TYPE(NAME='HINT', PROPERTIES('shadow'='true', 'foo'='bar'))" />
<distsql-case id="create-default-single-table" value="SET DEFAULT SINGLE TABLE STORAGE UNIT = ds_0" />
-
<distsql-case id="add-resource-with-quota" value="REGISTER STORAGE UNIT `ds_0`(HOST='127.0.0.1',PORT=3306,DB='test0',USER='ROOT');" />
<distsql-case id="create-sharding-auto-table-rule-with-quota" value="CREATE SHARDING TABLE RULE `t_order` (STORAGE_UNITS(ms_group_0,ms_group_1), SHARDING_COLUMN=order_id,TYPE(NAME='hash_mod',PROPERTIES('sharding-count'='4')), KEY_GENERATE_STRATEGY(COLUMN=another_id,TYPE(NAME='snowflake')))" />
<distsql-case id="create-broadcast-table-rule-with-quota" value="CREATE BROADCAST TABLE RULE `t_1`,`t_2` " />