This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 28e7f74 [DistSQL] `Show sharding table node` statement support other
algorithms. (#14588)
28e7f74 is described below
commit 28e7f740fec62cc95bcd572c090481dadb474a59
Author: lanchengx <[email protected]>
AuthorDate: Sun Jan 9 10:59:26 2022 +0800
[DistSQL] `Show sharding table node` statement support other algorithms.
(#14588)
* Rename class.
* `Show sharding table node` syntax support other algorithms.
---
.../checker/ShardingTableRuleStatementChecker.java | 4 +-
.../ShardingTableRuleStatementConverter.java | 22 +++++------
...velEnum.java => ShardingStrategyLevelType.java} | 2 +-
...tegyTypeEnum.java => ShardingStrategyType.java} | 8 ++--
.../DefaultShardingStrategyQueryResultSet.java | 6 +--
.../query/ShardingTableNodesQueryResultSet.java | 44 ++++++++++++++--------
...terDefaultShardingStrategyStatementUpdater.java | 10 ++---
...ateDefaultShardingStrategyStatementUpdater.java | 10 ++---
.../DropDefaultStrategyStatementUpdater.java | 6 +--
... => BoundaryRangeShardingAlgorithmFixture.java} | 15 +++++++-
.../fixture/ModShardingAlgorithmFixture.java | 13 ++++++-
.../ShardingTableNodesQueryResultSetTest.java | 19 ++++++++--
...e.shardingsphere.sharding.spi.ShardingAlgorithm | 1 +
13 files changed, 103 insertions(+), 57 deletions(-)
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
index 0ca4907..f7125b7 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java
@@ -31,7 +31,7 @@ import
org.apache.shardingsphere.infra.rule.identifier.type.DataSourceContainedR
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
-import
org.apache.shardingsphere.sharding.distsql.handler.enums.ShardingStrategyTypeEnum;
+import
org.apache.shardingsphere.sharding.distsql.handler.enums.ShardingStrategyType;
import
org.apache.shardingsphere.sharding.distsql.parser.segment.AbstractTableRuleSegment;
import
org.apache.shardingsphere.sharding.distsql.parser.segment.AutoTableRuleSegment;
import
org.apache.shardingsphere.sharding.distsql.parser.segment.ShardingStrategySegment;
@@ -216,7 +216,7 @@ public final class ShardingTableRuleStatementChecker {
}
private static boolean isAlgorithmInvalid(final Collection<String>
currentAlgorithms, final ShardingStrategySegment shardingStrategySegment) {
- return
!ShardingStrategyTypeEnum.contain(shardingStrategySegment.getType()) ||
!isAlgorithmExists(currentAlgorithms, shardingStrategySegment);
+ return
!ShardingStrategyType.contain(shardingStrategySegment.getType()) ||
!isAlgorithmExists(currentAlgorithms, shardingStrategySegment);
}
private static boolean isAlgorithmExists(final Collection<String>
currentAlgorithms, final ShardingStrategySegment shardingStrategySegment) {
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/converter/ShardingTableRuleStatementConverter.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/converter/ShardingTableRuleStatementConverter.java
index 5f3d6c5..ca6f6cf 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/converter/ShardingTableRuleStatementConverter.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/converter/ShardingTableRuleStatementConverter.java
@@ -27,8 +27,8 @@ import
org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleC
import
org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.strategy.keygen.KeyGenerateStrategyConfiguration;
import
org.apache.shardingsphere.sharding.api.config.strategy.sharding.ShardingStrategyConfiguration;
-import
org.apache.shardingsphere.sharding.distsql.handler.enums.ShardingStrategyLevelEnum;
-import
org.apache.shardingsphere.sharding.distsql.handler.enums.ShardingStrategyTypeEnum;
+import
org.apache.shardingsphere.sharding.distsql.handler.enums.ShardingStrategyLevelType;
+import
org.apache.shardingsphere.sharding.distsql.handler.enums.ShardingStrategyType;
import
org.apache.shardingsphere.sharding.distsql.parser.segment.AbstractTableRuleSegment;
import
org.apache.shardingsphere.sharding.distsql.parser.segment.AutoTableRuleSegment;
import
org.apache.shardingsphere.sharding.distsql.parser.segment.KeyGenerateSegment;
@@ -89,11 +89,11 @@ public final class ShardingTableRuleStatementConverter {
Map<String, ShardingSphereAlgorithmConfiguration> result = new
HashMap<>();
if (null != rule.getTableStrategySegment()) {
Optional.ofNullable(rule.getTableStrategySegment().getAlgorithmSegment()).ifPresent(op
->
-
result.put(getTableShardingAlgorithmName(rule.getLogicTable(),
ShardingStrategyLevelEnum.TABLE, op.getName()),
createAlgorithmConfiguration(op)));
+
result.put(getTableShardingAlgorithmName(rule.getLogicTable(),
ShardingStrategyLevelType.TABLE, op.getName()),
createAlgorithmConfiguration(op)));
}
if (null != rule.getDatabaseStrategySegment()) {
Optional.ofNullable(rule.getDatabaseStrategySegment().getAlgorithmSegment()).ifPresent(op
->
-
result.put(getTableShardingAlgorithmName(rule.getLogicTable(),
ShardingStrategyLevelEnum.DATABASE, op.getName()),
createAlgorithmConfiguration(op)));
+
result.put(getTableShardingAlgorithmName(rule.getLogicTable(),
ShardingStrategyLevelType.DATABASE, op.getName()),
createAlgorithmConfiguration(op)));
}
return result;
}
@@ -117,7 +117,7 @@ public final class ShardingTableRuleStatementConverter {
}
private static ShardingStrategyConfiguration
createAutoTableStrategyConfiguration(final AutoTableRuleSegment rule) {
- return
createStrategyConfiguration(ShardingStrategyTypeEnum.STANDARD.name(),
+ return
createStrategyConfiguration(ShardingStrategyType.STANDARD.name(),
rule.getShardingColumn(),
getAutoTableShardingAlgorithmName(rule.getLogicTable(),
rule.getShardingAlgorithmSegment().getName()));
}
@@ -125,19 +125,19 @@ public final class ShardingTableRuleStatementConverter {
String dataSourceNodes = String.join(",",
tableRuleSegment.getDataSourceNodes());
ShardingTableRuleConfiguration tableRuleConfiguration = new
ShardingTableRuleConfiguration(tableRuleSegment.getLogicTable(),
dataSourceNodes);
Optional.ofNullable(tableRuleSegment.getTableStrategySegment()).ifPresent(op ->
-
tableRuleConfiguration.setTableShardingStrategy(createShardingStrategyConfiguration(tableRuleSegment.getLogicTable(),
ShardingStrategyLevelEnum.TABLE, op.getType(), op)));
+
tableRuleConfiguration.setTableShardingStrategy(createShardingStrategyConfiguration(tableRuleSegment.getLogicTable(),
ShardingStrategyLevelType.TABLE, op.getType(), op)));
Optional.ofNullable(tableRuleSegment.getDatabaseStrategySegment()).ifPresent(op
->
-
tableRuleConfiguration.setDatabaseShardingStrategy(createShardingStrategyConfiguration(tableRuleSegment.getLogicTable(),
ShardingStrategyLevelEnum.DATABASE, op.getType(), op)));
+
tableRuleConfiguration.setDatabaseShardingStrategy(createShardingStrategyConfiguration(tableRuleSegment.getLogicTable(),
ShardingStrategyLevelType.DATABASE, op.getType(), op)));
Optional.ofNullable(tableRuleSegment.getKeyGenerateSegment()).ifPresent(op ->
tableRuleConfiguration.setKeyGenerateStrategy(createKeyGenerateStrategyConfiguration(tableRuleSegment.getLogicTable(),
op)));
return tableRuleConfiguration;
}
- private static ShardingStrategyConfiguration
createShardingStrategyConfiguration(final String logicTable, final
ShardingStrategyLevelEnum strategyLevel, final String type,
+ private static ShardingStrategyConfiguration
createShardingStrategyConfiguration(final String logicTable, final
ShardingStrategyLevelType strategyLevel, final String type,
final ShardingStrategySegment segment) {
String shardingAlgorithmName = null ==
segment.getShardingAlgorithmName() ? getTableShardingAlgorithmName(logicTable,
strategyLevel, segment.getAlgorithmSegment().getName())
: segment.getShardingAlgorithmName();
- return
createStrategyConfiguration(ShardingStrategyTypeEnum.getValueOf(type).name(),
segment.getShardingColumn(), shardingAlgorithmName);
+ return
createStrategyConfiguration(ShardingStrategyType.getValueOf(type).name(),
segment.getShardingColumn(), shardingAlgorithmName);
}
private static KeyGenerateStrategyConfiguration
createKeyGenerateStrategyConfiguration(final String logicTable, final
KeyGenerateSegment segment) {
@@ -156,7 +156,7 @@ public final class ShardingTableRuleStatementConverter {
* @return sharding strategy configuration
*/
public static ShardingStrategyConfiguration
createStrategyConfiguration(final String strategyType, final String
shardingColumn, final String shardingAlgorithmName) {
- ShardingStrategyTypeEnum shardingStrategyType =
ShardingStrategyTypeEnum.getValueOf(strategyType);
+ ShardingStrategyType shardingStrategyType =
ShardingStrategyType.getValueOf(strategyType);
return shardingStrategyType.createConfiguration(shardingAlgorithmName,
shardingColumn);
}
@@ -164,7 +164,7 @@ public final class ShardingTableRuleStatementConverter {
return String.format("%s_%s", tableName, algorithmType);
}
- private static String getTableShardingAlgorithmName(final String
tableName, final ShardingStrategyLevelEnum strategyLevel, final String
algorithmType) {
+ private static String getTableShardingAlgorithmName(final String
tableName, final ShardingStrategyLevelType strategyLevel, final String
algorithmType) {
return String.format("%s_%s_%s", tableName,
strategyLevel.name().toLowerCase(), algorithmType);
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyLevelEnum.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyLevelType.java
similarity index 95%
rename from
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyLevelEnum.java
rename to
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyLevelType.java
index fb53575..e0eb484 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyLevelEnum.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyLevelType.java
@@ -20,7 +20,7 @@ package
org.apache.shardingsphere.sharding.distsql.handler.enums;
/**
* Sharding strategy level enum.
*/
-public enum ShardingStrategyLevelEnum {
+public enum ShardingStrategyLevelType {
DATABASE, TABLE
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyTypeEnum.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyType.java
similarity index 95%
rename from
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyTypeEnum.java
rename to
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyType.java
index 58151a8..8eef5c2 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyTypeEnum.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/enums/ShardingStrategyType.java
@@ -30,7 +30,7 @@ import java.util.Optional;
/**
* Sharding strategy type enum.
*/
-public enum ShardingStrategyTypeEnum {
+public enum ShardingStrategyType {
STANDARD {
@Override
@@ -124,7 +124,7 @@ public enum ShardingStrategyTypeEnum {
* @param name name
* @return sharding strategy type
*/
- public static ShardingStrategyTypeEnum getValueOf(final String name) {
+ public static ShardingStrategyType getValueOf(final String name) {
try {
return valueOf(name.toUpperCase());
} catch (IllegalArgumentException e) {
@@ -138,8 +138,8 @@ public enum ShardingStrategyTypeEnum {
* @param shardingStrategyConfiguration Implementation class of sharding
strategy configuration
* @return sharding strategy type
*/
- public static ShardingStrategyTypeEnum getValueOf(final
ShardingStrategyConfiguration shardingStrategyConfiguration) {
- Optional<ShardingStrategyTypeEnum> type = Arrays.stream(values())
+ public static ShardingStrategyType getValueOf(final
ShardingStrategyConfiguration shardingStrategyConfiguration) {
+ Optional<ShardingStrategyType> type = Arrays.stream(values())
.filter(each ->
shardingStrategyConfiguration.getClass().getCanonicalName().equals(each.getImplementedClass().getCanonicalName())).findFirst();
type.orElseThrow(() -> new
UnsupportedOperationException(String.format("unsupported strategy type %s",
shardingStrategyConfiguration.getClass().getName())));
return type.get();
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/DefaultShardingStrategyQueryResultSet.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/DefaultShardingStrategyQueryResultSet.java
index 6f8be52..4e46d12 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/DefaultShardingStrategyQueryResultSet.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/DefaultShardingStrategyQueryResultSet.java
@@ -22,7 +22,7 @@ import
org.apache.shardingsphere.infra.distsql.query.DistSQLResultSet;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.strategy.sharding.ShardingStrategyConfiguration;
-import
org.apache.shardingsphere.sharding.distsql.handler.enums.ShardingStrategyTypeEnum;
+import
org.apache.shardingsphere.sharding.distsql.handler.enums.ShardingStrategyType;
import
org.apache.shardingsphere.sharding.distsql.parser.statement.ShowDefaultShardingStrategyStatement;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
@@ -60,8 +60,8 @@ public final class DefaultShardingStrategyQueryResultSet
implements DistSQLResul
if (null == strategyConfiguration) {
return new LinkedList<>(Arrays.asList("NONE", "", "", "", ""));
}
- ShardingStrategyTypeEnum strategyType =
ShardingStrategyTypeEnum.getValueOf(strategyConfiguration);
- if (strategyType == ShardingStrategyTypeEnum.NONE) {
+ ShardingStrategyType strategyType =
ShardingStrategyType.getValueOf(strategyConfiguration);
+ if (strategyType == ShardingStrategyType.NONE) {
return new LinkedList<>(Arrays.asList("NONE", "", "", "", ""));
}
LinkedList<Object> result = new
LinkedList<>(Collections.singleton(strategyType.name()));
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShardingTableNodesQueryResultSet.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShardingTableNodesQueryResultSet.java
index da3d907..e7e54a0 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShardingTableNodesQueryResultSet.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/query/ShardingTableNodesQueryResultSet.java
@@ -25,8 +25,11 @@ import
org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.rule.ShardingAutoTableRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.strategy.sharding.ShardingStrategyConfiguration;
+import
org.apache.shardingsphere.sharding.api.sharding.ShardingAutoTableAlgorithm;
import
org.apache.shardingsphere.sharding.distsql.parser.statement.ShowShardingTableNodesStatement;
+import org.apache.shardingsphere.sharding.spi.ShardingAlgorithm;
import org.apache.shardingsphere.sharding.support.InlineExpressionParser;
+import org.apache.shardingsphere.spi.typed.TypedSPIRegistry;
import org.apache.shardingsphere.sql.parser.sql.common.statement.SQLStatement;
import java.util.Arrays;
@@ -38,6 +41,7 @@ import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.Map.Entry;
+import java.util.Optional;
import java.util.stream.Collectors;
/**
@@ -45,8 +49,6 @@ import java.util.stream.Collectors;
*/
public final class ShardingTableNodesQueryResultSet implements
DistSQLResultSet {
- private static final String SHARDING_COUNT_KEY = "sharding-count";
-
private static final String NAME = "name";
private static final String NODES = "nodes";
@@ -66,33 +68,43 @@ public final class ShardingTableNodesQueryResultSet
implements DistSQLResultSet
Map<String, String> dataNodes =
config.getTables().stream().filter(each -> null == tableName ||
each.getLogicTable().equals(tableName))
.collect(Collectors.toMap(ShardingTableRuleConfiguration::getLogicTable,
this::getDataNodes, (x, y) -> x, LinkedHashMap::new));
Map<String, String> autoTables =
config.getAutoTables().stream().filter(each -> null == tableName ||
each.getLogicTable().equals(tableName))
-
.collect(Collectors.toMap(ShardingAutoTableRuleConfiguration::getLogicTable,
each -> getDataNodes(each, getShardingCount(config, each)), (x, y) -> x,
LinkedHashMap::new));
+
.collect(Collectors.toMap(ShardingAutoTableRuleConfiguration::getLogicTable,
each -> getDataNodes(each, getTotalShardingCount(config, each)), (x, y) -> x,
LinkedHashMap::new));
Map<String, String> result = new LinkedHashMap<>();
result.putAll(dataNodes);
result.putAll(autoTables);
return result;
}
- private int getShardingCount(final ShardingRuleConfiguration
ruleConfiguration, final ShardingAutoTableRuleConfiguration
shardingAutoTableRuleConfig) {
+ private int getTotalShardingCount(final ShardingRuleConfiguration
ruleConfiguration, final ShardingAutoTableRuleConfiguration
shardingAutoTableRuleConfig) {
int result = 0;
+ Map<String, ShardingSphereAlgorithmConfiguration> shardingAlgorithms =
ruleConfiguration.getShardingAlgorithms();
ShardingStrategyConfiguration shardingStrategy =
shardingAutoTableRuleConfig.getShardingStrategy();
- String shardingAlgorithmName;
- if (null == shardingStrategy ||
Strings.isNullOrEmpty(shardingStrategy.getShardingAlgorithmName())) {
- if (ruleConfiguration.getDefaultTableShardingStrategy() != null &&
ruleConfiguration.getDefaultDatabaseShardingStrategy() != null) {
- int tableCount =
Integer.parseInt(ruleConfiguration.getShardingAlgorithms().get(ruleConfiguration.getDefaultTableShardingStrategy().getShardingAlgorithmName())
- .getProps().getOrDefault(SHARDING_COUNT_KEY,
0).toString());
- int databaseCount =
Integer.parseInt(ruleConfiguration.getShardingAlgorithms().get(ruleConfiguration.getDefaultDatabaseShardingStrategy().getShardingAlgorithmName())
- .getProps().getOrDefault(SHARDING_COUNT_KEY,
0).toString());
- result = tableCount * databaseCount;
- }
+ if (useDefaultStrategy(shardingStrategy, ruleConfiguration)) {
+ int tableCount =
getShardingCount(shardingAlgorithms.get(ruleConfiguration.getDefaultTableShardingStrategy().getShardingAlgorithmName()));
+ int databaseCount =
getShardingCount(shardingAlgorithms.get(ruleConfiguration.getDefaultDatabaseShardingStrategy().getShardingAlgorithmName()));
+ result = tableCount * databaseCount;
} else {
- shardingAlgorithmName =
shardingStrategy.getShardingAlgorithmName();
- ShardingSphereAlgorithmConfiguration algorithmConfiguration =
ruleConfiguration.getShardingAlgorithms().get(shardingAlgorithmName);
- result = algorithmConfiguration != null ?
Integer.parseInt(algorithmConfiguration.getProps().getOrDefault(SHARDING_COUNT_KEY,
result).toString()) : result;
+ result =
getShardingCount(shardingAlgorithms.get(shardingStrategy.getShardingAlgorithmName()));
}
return result;
}
+ private boolean useDefaultStrategy(final ShardingStrategyConfiguration
currentShardingStrategy, final ShardingRuleConfiguration ruleConfiguration) {
+ return (null == currentShardingStrategy ||
Strings.isNullOrEmpty(currentShardingStrategy.getShardingAlgorithmName()))
+ && null !=
ruleConfiguration.getDefaultDatabaseShardingStrategy() && null !=
ruleConfiguration.getDefaultTableShardingStrategy();
+ }
+
+ private int getShardingCount(final ShardingSphereAlgorithmConfiguration
algorithmConfiguration) {
+ if (null == algorithmConfiguration) {
+ return 0;
+ }
+ Optional<ShardingAlgorithm> shardingAlgorithm =
TypedSPIRegistry.findRegisteredService(ShardingAlgorithm.class,
algorithmConfiguration.getType(), algorithmConfiguration.getProps());
+ return shardingAlgorithm.filter(op -> op instanceof
ShardingAutoTableAlgorithm).map(op -> {
+ op.init();
+ return ((ShardingAutoTableAlgorithm) op).getAutoTablesAmount();
+ }).orElse(0);
+ }
+
private String getDataNodes(final ShardingAutoTableRuleConfiguration
shardingAutoTableRuleConfig, final int shardingCount) {
List<String> dataSources = new
InlineExpressionParser(shardingAutoTableRuleConfig.getActualDataSources()).splitAndEvaluate();
return
fillDataSourceNames(shardingAutoTableRuleConfig.getLogicTable(), shardingCount,
dataSources);
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterDefaultShardingStrategyStatementUpdater.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterDefaultShardingStrategyStatementUpdater.java
index fc5bba7..0c65a73 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterDefaultShardingStrategyStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/AlterDefaultShardingStrategyStatementUpdater.java
@@ -28,8 +28,8 @@ import
org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.strategy.sharding.ShardingStrategyConfiguration;
import
org.apache.shardingsphere.sharding.distsql.handler.converter.ShardingTableRuleStatementConverter;
-import
org.apache.shardingsphere.sharding.distsql.handler.enums.ShardingStrategyLevelEnum;
-import
org.apache.shardingsphere.sharding.distsql.handler.enums.ShardingStrategyTypeEnum;
+import
org.apache.shardingsphere.sharding.distsql.handler.enums.ShardingStrategyLevelType;
+import
org.apache.shardingsphere.sharding.distsql.handler.enums.ShardingStrategyType;
import
org.apache.shardingsphere.sharding.distsql.parser.statement.AlterDefaultShardingStrategyStatement;
import java.util.Collections;
@@ -54,7 +54,7 @@ public final class
AlterDefaultShardingStrategyStatementUpdater implements RuleD
}
private void checkAlgorithm(final String schemaName, final
ShardingRuleConfiguration currentRuleConfig, final
AlterDefaultShardingStrategyStatement sqlStatement) throws DistSQLException {
-
DistSQLException.predictionThrow(ShardingStrategyTypeEnum.contain(sqlStatement.getStrategyType()),
new InvalidAlgorithmConfigurationException(sqlStatement.getStrategyType()));
+
DistSQLException.predictionThrow(ShardingStrategyType.contain(sqlStatement.getStrategyType()),
new InvalidAlgorithmConfigurationException(sqlStatement.getStrategyType()));
DistSQLException.predictionThrow(isAlgorithmDefinitionExists(sqlStatement), new
RequiredAlgorithmMissedException());
if (null == sqlStatement.getShardingAlgorithmName() && null !=
sqlStatement.getAlgorithmSegment()) {
return;
@@ -74,7 +74,7 @@ public final class
AlterDefaultShardingStrategyStatementUpdater implements RuleD
}
private Optional<ShardingStrategyConfiguration>
getStrategyConfiguration(final ShardingRuleConfiguration currentRuleConfig,
final String type) {
- ShardingStrategyConfiguration result =
type.equalsIgnoreCase(ShardingStrategyLevelEnum.TABLE.name())
+ ShardingStrategyConfiguration result =
type.equalsIgnoreCase(ShardingStrategyLevelType.TABLE.name())
? currentRuleConfig.getDefaultTableShardingStrategy() :
currentRuleConfig.getDefaultDatabaseShardingStrategy();
return Optional.ofNullable(result);
}
@@ -111,7 +111,7 @@ public final class
AlterDefaultShardingStrategyStatementUpdater implements RuleD
}
private void setStrategyConfiguration(final ShardingRuleConfiguration
configuration, final String type, final ShardingStrategyConfiguration
shardingStrategyConfiguration) {
- if (type.equalsIgnoreCase(ShardingStrategyLevelEnum.TABLE.name())) {
+ if (type.equalsIgnoreCase(ShardingStrategyLevelType.TABLE.name())) {
configuration.setDefaultTableShardingStrategy(shardingStrategyConfiguration);
} else {
configuration.setDefaultDatabaseShardingStrategy(shardingStrategyConfiguration);
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateDefaultShardingStrategyStatementUpdater.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateDefaultShardingStrategyStatementUpdater.java
index 2ae4c0d..e1e1acd 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateDefaultShardingStrategyStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/CreateDefaultShardingStrategyStatementUpdater.java
@@ -28,9 +28,9 @@ import
org.apache.shardingsphere.infra.distsql.update.RuleDefinitionCreateUpdate
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.strategy.sharding.ShardingStrategyConfiguration;
-import
org.apache.shardingsphere.sharding.distsql.handler.enums.ShardingStrategyTypeEnum;
+import
org.apache.shardingsphere.sharding.distsql.handler.enums.ShardingStrategyType;
import
org.apache.shardingsphere.sharding.distsql.handler.converter.ShardingTableRuleStatementConverter;
-import
org.apache.shardingsphere.sharding.distsql.handler.enums.ShardingStrategyLevelEnum;
+import
org.apache.shardingsphere.sharding.distsql.handler.enums.ShardingStrategyLevelType;
import
org.apache.shardingsphere.sharding.distsql.parser.statement.CreateDefaultShardingStrategyStatement;
import java.util.Collections;
@@ -55,7 +55,7 @@ public final class
CreateDefaultShardingStrategyStatementUpdater implements Rule
}
private void checkAlgorithm(final String schemaName, final
ShardingRuleConfiguration currentRuleConfig, final
CreateDefaultShardingStrategyStatement sqlStatement) throws DistSQLException {
-
DistSQLException.predictionThrow(ShardingStrategyTypeEnum.contain(sqlStatement.getStrategyType()),
new InvalidAlgorithmConfigurationException(sqlStatement.getStrategyType()));
+
DistSQLException.predictionThrow(ShardingStrategyType.contain(sqlStatement.getStrategyType()),
new InvalidAlgorithmConfigurationException(sqlStatement.getStrategyType()));
DistSQLException.predictionThrow(isAlgorithmDefinitionExists(sqlStatement), new
RequiredAlgorithmMissedException());
if (null == sqlStatement.getShardingAlgorithmName() && null !=
sqlStatement.getAlgorithmSegment()) {
return;
@@ -75,7 +75,7 @@ public final class
CreateDefaultShardingStrategyStatementUpdater implements Rule
}
private Optional<ShardingStrategyConfiguration>
getStrategyConfiguration(final ShardingRuleConfiguration currentRuleConfig,
final String type) {
- ShardingStrategyConfiguration result =
type.equalsIgnoreCase(ShardingStrategyLevelEnum.TABLE.name())
+ ShardingStrategyConfiguration result =
type.equalsIgnoreCase(ShardingStrategyLevelType.TABLE.name())
? currentRuleConfig.getDefaultTableShardingStrategy() :
currentRuleConfig.getDefaultDatabaseShardingStrategy();
return Optional.ofNullable(result);
}
@@ -112,7 +112,7 @@ public final class
CreateDefaultShardingStrategyStatementUpdater implements Rule
}
private void setStrategyConfiguration(final ShardingRuleConfiguration
configuration, final String type, final ShardingStrategyConfiguration
shardingStrategyConfiguration) {
- if (type.equalsIgnoreCase(ShardingStrategyLevelEnum.TABLE.name())) {
+ if (type.equalsIgnoreCase(ShardingStrategyLevelType.TABLE.name())) {
configuration.setDefaultTableShardingStrategy(shardingStrategyConfiguration);
} else {
configuration.setDefaultDatabaseShardingStrategy(shardingStrategyConfiguration);
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropDefaultStrategyStatementUpdater.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropDefaultStrategyStatementUpdater.java
index 095f293..93ebcc5 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropDefaultStrategyStatementUpdater.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/update/DropDefaultStrategyStatementUpdater.java
@@ -23,7 +23,7 @@ import
org.apache.shardingsphere.infra.distsql.update.RuleDefinitionDropUpdater;
import org.apache.shardingsphere.infra.metadata.ShardingSphereMetaData;
import org.apache.shardingsphere.sharding.api.config.ShardingRuleConfiguration;
import
org.apache.shardingsphere.sharding.api.config.strategy.sharding.ShardingStrategyConfiguration;
-import
org.apache.shardingsphere.sharding.distsql.handler.enums.ShardingStrategyLevelEnum;
+import
org.apache.shardingsphere.sharding.distsql.handler.enums.ShardingStrategyLevelType;
import
org.apache.shardingsphere.sharding.distsql.parser.statement.DropDefaultShardingStrategyStatement;
import java.util.Optional;
@@ -48,7 +48,7 @@ public final class DropDefaultStrategyStatementUpdater
implements RuleDefinition
}
private Optional<ShardingStrategyConfiguration>
getStrategyConfiguration(final ShardingRuleConfiguration currentRuleConfig,
final String type) {
- ShardingStrategyConfiguration result =
type.equalsIgnoreCase(ShardingStrategyLevelEnum.TABLE.name())
+ ShardingStrategyConfiguration result =
type.equalsIgnoreCase(ShardingStrategyLevelType.TABLE.name())
? currentRuleConfig.getDefaultTableShardingStrategy() :
currentRuleConfig.getDefaultDatabaseShardingStrategy();
return Optional.ofNullable(result);
}
@@ -59,7 +59,7 @@ public final class DropDefaultStrategyStatementUpdater
implements RuleDefinition
@Override
public boolean updateCurrentRuleConfiguration(final
DropDefaultShardingStrategyStatement sqlStatement, final
ShardingRuleConfiguration currentRuleConfig) {
- if
(sqlStatement.getDefaultType().equalsIgnoreCase(ShardingStrategyLevelEnum.TABLE.name()))
{
+ if
(sqlStatement.getDefaultType().equalsIgnoreCase(ShardingStrategyLevelType.TABLE.name()))
{
currentRuleConfig.setDefaultTableShardingStrategy(null);
} else {
currentRuleConfig.setDefaultDatabaseShardingStrategy(null);
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/ModShardingAlgorithmFixture.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/BoundaryRangeShardingAlgorithmFixture.java
similarity index 79%
copy from
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/ModShardingAlgorithmFixture.java
copy to
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/BoundaryRangeShardingAlgorithmFixture.java
index 4af508e..daf2773 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/ModShardingAlgorithmFixture.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/BoundaryRangeShardingAlgorithmFixture.java
@@ -17,6 +17,7 @@
package org.apache.shardingsphere.sharding.distsql.fixture;
+import
org.apache.shardingsphere.sharding.api.sharding.ShardingAutoTableAlgorithm;
import
org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue;
import
org.apache.shardingsphere.sharding.api.sharding.standard.RangeShardingValue;
import
org.apache.shardingsphere.sharding.api.sharding.standard.StandardShardingAlgorithm;
@@ -24,7 +25,7 @@ import
org.apache.shardingsphere.sharding.api.sharding.standard.StandardSharding
import java.util.Collection;
import java.util.Collections;
-public final class ModShardingAlgorithmFixture implements
StandardShardingAlgorithm<Integer> {
+public final class BoundaryRangeShardingAlgorithmFixture implements
StandardShardingAlgorithm<Integer>, ShardingAutoTableAlgorithm {
@Override
public void init() {
@@ -42,6 +43,16 @@ public final class ModShardingAlgorithmFixture implements
StandardShardingAlgori
@Override
public String getType() {
- return "MOD_TEST";
+ return "BOUNDARY_RANGE_TEST";
+ }
+
+ @Override
+ public int getAutoTablesAmount() {
+ return 4;
+ }
+
+ @Override
+ public Collection<String> getAllPropertyKeys() {
+ return null;
}
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/ModShardingAlgorithmFixture.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/ModShardingAlgorithmFixture.java
index 4af508e..d83adef 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/ModShardingAlgorithmFixture.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/fixture/ModShardingAlgorithmFixture.java
@@ -17,6 +17,7 @@
package org.apache.shardingsphere.sharding.distsql.fixture;
+import
org.apache.shardingsphere.sharding.api.sharding.ShardingAutoTableAlgorithm;
import
org.apache.shardingsphere.sharding.api.sharding.standard.PreciseShardingValue;
import
org.apache.shardingsphere.sharding.api.sharding.standard.RangeShardingValue;
import
org.apache.shardingsphere.sharding.api.sharding.standard.StandardShardingAlgorithm;
@@ -24,7 +25,7 @@ import
org.apache.shardingsphere.sharding.api.sharding.standard.StandardSharding
import java.util.Collection;
import java.util.Collections;
-public final class ModShardingAlgorithmFixture implements
StandardShardingAlgorithm<Integer> {
+public final class ModShardingAlgorithmFixture implements
StandardShardingAlgorithm<Integer>, ShardingAutoTableAlgorithm {
@Override
public void init() {
@@ -44,4 +45,14 @@ public final class ModShardingAlgorithmFixture implements
StandardShardingAlgori
public String getType() {
return "MOD_TEST";
}
+
+ @Override
+ public int getAutoTablesAmount() {
+ return 2;
+ }
+
+ @Override
+ public Collection<String> getAllPropertyKeys() {
+ return null;
+ }
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShardingTableNodesQueryResultSetTest.java
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShardingTableNodesQueryResultSetTest.java
index dec1d82..5c26bb7 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShardingTableNodesQueryResultSetTest.java
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/java/org/apache/shardingsphere/sharding/distsql/query/ShardingTableNodesQueryResultSetTest.java
@@ -27,6 +27,8 @@ import
org.apache.shardingsphere.sharding.api.config.rule.ShardingTableRuleConfi
import
org.apache.shardingsphere.sharding.api.config.strategy.sharding.StandardShardingStrategyConfiguration;
import
org.apache.shardingsphere.sharding.distsql.handler.query.ShardingTableNodesQueryResultSet;
import
org.apache.shardingsphere.sharding.distsql.parser.statement.ShowShardingTableNodesStatement;
+import org.apache.shardingsphere.sharding.spi.ShardingAlgorithm;
+import org.apache.shardingsphere.spi.ShardingSphereServiceLoader;
import org.junit.Test;
import java.util.ArrayList;
@@ -42,6 +44,10 @@ import static org.mockito.Mockito.when;
public final class ShardingTableNodesQueryResultSetTest {
+ static {
+ ShardingSphereServiceLoader.register(ShardingAlgorithm.class);
+ }
+
@Test
public void assertGetRowData() {
ShardingSphereMetaData metaData = mock(ShardingSphereMetaData.class,
RETURNS_DEEP_STUBS);
@@ -66,9 +72,8 @@ public final class ShardingTableNodesQueryResultSetTest {
result.getTables().add(createShardingTableRuleConfiguration());
result.getAutoTables().add(createProductAutoTableConfiguration());
result.getAutoTables().add(createUserAutoTableConfiguration());
- Properties properties = new Properties();
- properties.put("sharding-count", 2);
- result.getShardingAlgorithms().put("t_product_algorithm", new
ShardingSphereAlgorithmConfiguration("hash_mod", properties));
+ result.getShardingAlgorithms().put("t_product_algorithm", new
ShardingSphereAlgorithmConfiguration("MOD_TEST",
newProperties("sharding-count", 2)));
+ result.getShardingAlgorithms().put("t_user_algorithm", new
ShardingSphereAlgorithmConfiguration("BOUNDARY_RANGE_TEST",
newProperties("sharding-ranges", "10,20,30")));
result.setDefaultTableShardingStrategy(new
StandardShardingStrategyConfiguration("user_id", "t_product_algorithm"));
result.setDefaultDatabaseShardingStrategy(new
StandardShardingStrategyConfiguration("user_id", "t_product_algorithm"));
return result;
@@ -86,7 +91,13 @@ public final class ShardingTableNodesQueryResultSetTest {
private ShardingAutoTableRuleConfiguration
createUserAutoTableConfiguration() {
ShardingAutoTableRuleConfiguration shardingAutoTableRuleConfiguration
= new ShardingAutoTableRuleConfiguration("t_user", "ds_2,ds_3");
- shardingAutoTableRuleConfiguration.setShardingStrategy(new
StandardShardingStrategyConfiguration("user_id", ""));
+ shardingAutoTableRuleConfiguration.setShardingStrategy(new
StandardShardingStrategyConfiguration("user_id", "t_user_algorithm"));
return shardingAutoTableRuleConfiguration;
}
+
+ private Properties newProperties(final String key, final Object value) {
+ Properties properties = new Properties();
+ properties.put(key, value);
+ return properties;
+ }
}
diff --git
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.ShardingAlgorithm
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.ShardingAlgorithm
index ec83596..4034838 100644
---
a/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.ShardingAlgorithm
+++
b/shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/test/resources/META-INF/services/org.apache.shardingsphere.sharding.spi.ShardingAlgorithm
@@ -17,3 +17,4 @@
org.apache.shardingsphere.sharding.distsql.fixture.StandardShardingAlgorithmFixture
org.apache.shardingsphere.sharding.distsql.fixture.ModShardingAlgorithmFixture
+org.apache.shardingsphere.sharding.distsql.fixture.BoundaryRangeShardingAlgorithmFixture