You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by GitBox <gi...@apache.org> on 2022/01/04 08:12:42 UTC

[GitHub] [shardingsphere] taojintianxia commented on a change in pull request #14502: optimize traffic executor logic and modify SQLHintUtils

taojintianxia commented on a change in pull request #14502:
URL: https://github.com/apache/shardingsphere/pull/14502#discussion_r777891284



##########
File path: shardingsphere-infra/shardingsphere-infra-common/src/main/java/org/apache/shardingsphere/infra/hint/SQLHintUtils.java
##########
@@ -48,9 +53,12 @@ public static Properties getSQLHintProps(final String comment) {
         }
         startIndex = startIndex + SQL_HINT_TOKEN.length();
         int endIndex = comment.endsWith(SQL_COMMENT_SUFFIX) ? comment.indexOf(SQL_COMMENT_SUFFIX) : comment.length();
-        String[] hintValue = comment.substring(startIndex, endIndex).trim().split(SQL_HINT_SPLIT);
-        if (2 == hintValue.length && hintValue[0].trim().length() > 0 && hintValue[1].trim().length() > 0) {
-            result.put(hintValue[0].trim(), hintValue[1].trim());
+        Collection<String> sqlHints = Splitter.on(SQL_HINT_SPLIT).trimResults().splitToList(comment.substring(startIndex, endIndex).trim());
+        for (String each : sqlHints) {
+            List<String> hintValues = Splitter.on(SQL_HINT_VALUE_SPLIT).trimResults().splitToList(each);
+            if (2 == hintValues.size()) {

Review comment:
       why not use a meaningful constant here instead of magic number `2`




-- 
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