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 156ec18a4d3 Refactor ShadowRuleStatementConverter (#36115)
156ec18a4d3 is described below
commit 156ec18a4d36648ca5d7e911d7bc6e08b32dd0be
Author: Liang Zhang <[email protected]>
AuthorDate: Tue Jul 29 23:38:59 2025 +0800
Refactor ShadowRuleStatementConverter (#36115)
---
.../distsql/handler/converter/ShadowRuleStatementConverter.java | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/converter/ShadowRuleStatementConverter.java
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/converter/ShadowRuleStatementConverter.java
index 9a74828184e..20ac7b43c52 100644
---
a/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/converter/ShadowRuleStatementConverter.java
+++
b/features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/converter/ShadowRuleStatementConverter.java
@@ -60,14 +60,14 @@ public final class ShadowRuleStatementConverter {
Map<String, ShadowTableConfiguration> result = new HashMap<>();
segments.forEach(each -> {
Map<String, ShadowTableConfiguration> currentRuleTableConfig =
each.getShadowTableRules().entrySet().stream()
- .collect(Collectors.toMap(Entry::getKey, entry ->
buildShadowTableConfiguration(each.getRuleName(), entry),
ShadowRuleStatementSupporter::mergeConfiguration));
+ .collect(Collectors.toMap(Entry::getKey, entry ->
buildShadowTableConfiguration(each.getRuleName(), entry.getValue()),
ShadowRuleStatementSupporter::mergeConfiguration));
currentRuleTableConfig.forEach((key, value) -> result.merge(key,
value, ShadowRuleStatementSupporter::mergeConfiguration));
});
return result;
}
- private static ShadowTableConfiguration
buildShadowTableConfiguration(final String ruleName, final Entry<String,
Collection<ShadowAlgorithmSegment>> entry) {
- return new ShadowTableConfiguration(new
ArrayList<>(Collections.singleton(ruleName)),
entry.getValue().stream().map(ShadowAlgorithmSegment::getAlgorithmName).collect(Collectors.toList()));
+ private static ShadowTableConfiguration
buildShadowTableConfiguration(final String ruleName, final
Collection<ShadowAlgorithmSegment> algorithmSegments) {
+ return new ShadowTableConfiguration(new
ArrayList<>(Collections.singleton(ruleName)),
algorithmSegments.stream().map(ShadowAlgorithmSegment::getAlgorithmName).collect(Collectors.toList()));
}
private static Collection<ShadowDataSourceConfiguration>
getDataSource(final Collection<ShadowRuleSegment> segments) {