terrymanu commented on code in PR #19159:
URL: https://github.com/apache/shardingsphere/pull/19159#discussion_r921308094
##########
shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-distsql/shardingsphere-sharding-distsql-handler/src/main/java/org/apache/shardingsphere/sharding/distsql/handler/checker/ShardingTableRuleStatementChecker.java:
##########
@@ -162,12 +162,12 @@ private static Collection<String> parseDateSource(final
String dateSource) {
}
private static Collection<String> getDataSourceNames(final
Collection<String> actualDataNodes) {
- return actualDataNodes.stream().map(each -> {
- if (isValidDataNode(each)) {
- return actualDataNodes.stream().map(each1 -> new
DataNode(each1).getDataSourceName()).collect(Collectors.toList());
- }
- return Collections.singletonList(each);
-
}).flatMap(Collection::stream).collect(Collectors.toCollection(LinkedHashSet::new));
+ Collection<String> result = new HashSet<>();
+ for (String each : actualDataNodes) {
+ String dataSourceName = isValidDataNode(each) ? new
DataNode(each).getDataSourceName() : each;
+ result.add(dataSourceName);
Review Comment:
It is better to inline dataSourceName and add()
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]