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 192d61b Resolve compilation errors (#12585)
192d61b is described below
commit 192d61bf073ea39dd2c0406b5dbc184718e06be2
Author: lanchengx <[email protected]>
AuthorDate: Sun Sep 19 11:26:22 2021 -0500
Resolve compilation errors (#12585)
---
.../shadow/distsql/handler/query/ShadowRuleQueryResultSet.java | 6 +++++-
.../shadow/distsql/query/ShadowAlgorithmQueryResultSetTest.java | 2 +-
.../shadow/distsql/query/ShadowRuleQueryResultSetTest.java | 4 ++--
.../shadow/distsql/query/ShadowTableRuleQueryResultSetTest.java | 2 +-
4 files changed, 9 insertions(+), 5 deletions(-)
diff --git
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShadowRuleQueryResultSet.java
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShadowRuleQueryResultSet.java
index 01a75a2..6bb1576 100644
---
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShadowRuleQueryResultSet.java
+++
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShadowRuleQueryResultSet.java
@@ -30,6 +30,7 @@ import java.util.Collection;
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.LinkedHashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Optional;
@@ -65,7 +66,10 @@ public final class ShadowRuleQueryResultSet implements
DistSQLResultSet {
}
private Map<String, Map<String, ShadowTableConfiguration>>
convertToDataSourceTableMap(final Map<String, ShadowTableConfiguration> tables)
{
- return tables.entrySet().stream().collect(Collectors.groupingBy(entry
-> entry.getValue().getDataSourceName(), Collectors.toMap(Entry::getKey,
Entry::getValue)));
+ Map<String, Map<String, ShadowTableConfiguration>> result =
tables.values().stream().map(ShadowTableConfiguration::getDataSourceNames)
+
.flatMap(Collection::stream).distinct().collect(Collectors.toMap(each -> each,
each -> new LinkedHashMap<>()));
+ tables.forEach((key, value) -> value.getDataSourceNames().forEach(each
-> result.get(each).put(key, value)));
+ return result;
}
private boolean isSpecified(final ShowShadowRulesStatement sqlStatement) {
diff --git
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/query/ShadowAlgorithmQueryResultSetTest.java
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/query/ShadowAlgorithmQueryResultSetTest.java
index 416b438..cd0b15d 100644
---
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/query/ShadowAlgorithmQueryResultSetTest.java
+++
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/query/ShadowAlgorithmQueryResultSetTest.java
@@ -58,7 +58,7 @@ public final class ShadowAlgorithmQueryResultSetTest {
ShadowRuleConfiguration result = new
ShadowRuleConfiguration("removed", Collections.singletonList("removed"),
Collections.singletonList("removed"));
Properties properties = new Properties();
properties.setProperty("foo", "bar");
- result.getTables().put("t_order", new ShadowTableConfiguration("",
Collections.singletonList("shadowAlgorithmName")));
+ result.getTables().put("t_order", new
ShadowTableConfiguration(Collections.emptyList(),
Collections.singletonList("shadowAlgorithmName")));
result.getShadowAlgorithms().put("shadowAlgorithmName", new
ShardingSphereAlgorithmConfiguration("simple_note", properties));
return result;
}
diff --git
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/query/ShadowRuleQueryResultSetTest.java
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/query/ShadowRuleQueryResultSetTest.java
index c40f932..2cb1bc9 100644
---
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/query/ShadowRuleQueryResultSetTest.java
+++
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/query/ShadowRuleQueryResultSetTest.java
@@ -57,8 +57,8 @@ public final class ShadowRuleQueryResultSetTest {
// FIXME because the defined final attribute will be removed, here is
just for the new object
ShadowRuleConfiguration result = new
ShadowRuleConfiguration("removed", Collections.singletonList("removed"),
Collections.singletonList("removed"));
result.getDataSources().put("shadow_rule", new
ShadowDataSourceConfiguration("source", "shadow"));
- result.getTables().put("t_order", new
ShadowTableConfiguration("shadow_rule", Collections.emptyList()));
- result.getTables().put("t_order_1", new
ShadowTableConfiguration("shadow_rule", Collections.emptyList()));
+ result.getTables().put("t_order", new
ShadowTableConfiguration(Collections.singletonList("shadow_rule"),
Collections.emptyList()));
+ result.getTables().put("t_order_1", new
ShadowTableConfiguration(Collections.singletonList("shadow_rule"),
Collections.emptyList()));
return result;
}
}
diff --git
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/query/ShadowTableRuleQueryResultSetTest.java
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/query/ShadowTableRuleQueryResultSetTest.java
index 0c50d81..7910e97 100644
---
a/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/query/ShadowTableRuleQueryResultSetTest.java
+++
b/shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-distsql/shardingsphere-shadow-distsql-handler/src/test/java/org/apache/shardingsphere/shadow/distsql/query/ShadowTableRuleQueryResultSetTest.java
@@ -58,7 +58,7 @@ public final class ShadowTableRuleQueryResultSetTest {
ShadowRuleConfiguration result = new
ShadowRuleConfiguration("removed", Collections.singletonList("removed"),
Collections.singletonList("removed"));
Properties properties = new Properties();
properties.setProperty("foo", "bar");
- result.getTables().put("t_order", new ShadowTableConfiguration("",
Arrays.asList("shadowAlgorithmName_1", "shadowAlgorithmName_2")));
+ result.getTables().put("t_order", new
ShadowTableConfiguration(Collections.emptyList(),
Arrays.asList("shadowAlgorithmName_1", "shadowAlgorithmName_2")));
result.getShadowAlgorithms().put("shadowAlgorithmName", new
ShardingSphereAlgorithmConfiguration("simple_note", properties));
return result;
}