You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "yx9o (via GitHub)" <gi...@apache.org> on 2023/04/22 15:38:15 UTC

[GitHub] [shardingsphere] yx9o opened a new pull request, #25279: SHOW SHADOW RULES add algorithm information return

yx9o opened a new pull request, #25279:
URL: https://github.com/apache/shardingsphere/pull/25279

   Fixes #25128 .
   
   before:
   <img width="550" alt="image" src="https://user-images.githubusercontent.com/12792261/233793618-4d946f91-80e0-4b55-a06f-0f18d96a1297.png">
   
   after:
   <img width="754" alt="image" src="https://user-images.githubusercontent.com/12792261/233793576-273ea955-c635-45e7-80c5-3fb3d5581656.png">
   
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following options:
   - [ ] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
   - [ ] I have self-reviewed the commit code.
   - [ ] I have (or in comment I request) added corresponding labels for the pull request.
   - [ ] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
   - [ ] I have made corresponding changes to the documentation.
   - [ ] I have added corresponding unit tests for my changes.
   


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on a diff in pull request #25279: SHOW SHADOW RULES add algorithm information return

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on code in PR #25279:
URL: https://github.com/apache/shardingsphere/pull/25279#discussion_r1174435087


##########
features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowRuleExecutor.java:
##########
@@ -84,28 +92,32 @@ private boolean isSpecified(final ShowShadowRulesStatement sqlStatement) {
         return null != sqlStatement.getRuleName() && !sqlStatement.getRuleName().isEmpty();
     }
     
-    private Map<String, String> buildDataItem(final ShadowDataSourceConfiguration dataSourceConfiguration, final Map<String, Map<String, ShadowTableConfiguration>> dataSourceTableMap) {
-        Map<String, String> result = convertToDataSourceMap(dataSourceConfiguration);
-        Map<String, ShadowTableConfiguration> dataSourceTable = dataSourceTableMap.getOrDefault(result.get(RULE_NAME), Collections.emptyMap());
-        result.put(SHADOW_TABLE, convertToString(dataSourceTable.keySet()));
+    private Collection<Map<String, String>> buildDataItems(final ShadowDataSourceConfiguration dataSourceConfig, final Map<String, Map<String, ShadowTableConfiguration>> dataSourceTableMap,
+                                                           final Map<String, AlgorithmConfiguration> algorithmConfigs) {
+        Map<String, ShadowTableConfiguration> dataSourceTable = dataSourceTableMap.getOrDefault(dataSourceConfig.getName(), Collections.emptyMap());
+        Collection<Map<String, String>> result = new LinkedList<>();
+        dataSourceTable.forEach((each, value) -> {
+            value.getShadowAlgorithmNames().forEach(algorithm -> {

Review Comment:
   The iterated element should be named `each`



-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang merged pull request #25279: SHOW SHADOW RULES add algorithm information return

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang merged PR #25279:
URL: https://github.com/apache/shardingsphere/pull/25279


-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


[GitHub] [shardingsphere] RaigorJiang commented on a diff in pull request #25279: SHOW SHADOW RULES add algorithm information return

Posted by "RaigorJiang (via GitHub)" <gi...@apache.org>.
RaigorJiang commented on code in PR #25279:
URL: https://github.com/apache/shardingsphere/pull/25279#discussion_r1174434953


##########
features/shadow/distsql/handler/src/main/java/org/apache/shardingsphere/shadow/distsql/handler/query/ShowShadowRuleExecutor.java:
##########
@@ -84,28 +92,32 @@ private boolean isSpecified(final ShowShadowRulesStatement sqlStatement) {
         return null != sqlStatement.getRuleName() && !sqlStatement.getRuleName().isEmpty();
     }
     
-    private Map<String, String> buildDataItem(final ShadowDataSourceConfiguration dataSourceConfiguration, final Map<String, Map<String, ShadowTableConfiguration>> dataSourceTableMap) {
-        Map<String, String> result = convertToDataSourceMap(dataSourceConfiguration);
-        Map<String, ShadowTableConfiguration> dataSourceTable = dataSourceTableMap.getOrDefault(result.get(RULE_NAME), Collections.emptyMap());
-        result.put(SHADOW_TABLE, convertToString(dataSourceTable.keySet()));
+    private Collection<Map<String, String>> buildDataItems(final ShadowDataSourceConfiguration dataSourceConfig, final Map<String, Map<String, ShadowTableConfiguration>> dataSourceTableMap,
+                                                           final Map<String, AlgorithmConfiguration> algorithmConfigs) {
+        Map<String, ShadowTableConfiguration> dataSourceTable = dataSourceTableMap.getOrDefault(dataSourceConfig.getName(), Collections.emptyMap());
+        Collection<Map<String, String>> result = new LinkedList<>();
+        dataSourceTable.forEach((each, value) -> {

Review Comment:
   We should use `(key, value)` when iterating over a map.
   Please search `forEach((key, value)` for reference.



-- 
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: notifications-unsubscribe@shardingsphere.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org