RaigorJiang commented on code in PR #24165:
URL: https://github.com/apache/shardingsphere/pull/24165#discussion_r1106570260
##########
features/readwrite-splitting/distsql/handler/src/main/java/org/apache/shardingsphere/readwritesplitting/distsql/handler/query/ShowReadwriteSplittingRuleExecutor.java:
##########
@@ -64,11 +64,15 @@ private void buildExportableMap(final
ReadwriteSplittingRule rule) {
exportableDataSourceMap = (Map<String, Map<String, String>>)
exportedData.get(ExportableConstants.EXPORT_STATIC_READWRITE_SPLITTING_RULE);
}
- private Collection<LocalDataQueryResultRow> buildData(final
ReadwriteSplittingRule rule) {
+ private Collection<LocalDataQueryResultRow> buildData(final
ReadwriteSplittingRule rule, final ShowReadwriteSplittingRulesStatement
sqlStatement) {
Collection<LocalDataQueryResultRow> result = new LinkedList<>();
((ReadwriteSplittingRuleConfiguration)
rule.getConfiguration()).getDataSources().forEach(each -> {
LocalDataQueryResultRow dataItem = buildDataItem(each,
getLoadBalancers((ReadwriteSplittingRuleConfiguration)
rule.getConfiguration()));
- result.add(dataItem);
+ if (null == sqlStatement.getRuleName()) {
+ result.add(dataItem);
+ } else if
(sqlStatement.getRuleName().equalsIgnoreCase(each.getName())) {
Review Comment:
I think it should be possible to combine these two if branches.
--
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]