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 2021/08/11 12:44:07 UTC

[GitHub] [shardingsphere] TeslaCN commented on a change in pull request #11768: modify tableRules to Map to improve performance

TeslaCN commented on a change in pull request #11768:
URL: https://github.com/apache/shardingsphere/pull/11768#discussion_r686793688



##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
##########
@@ -207,7 +209,7 @@ public ShardingStrategyConfiguration getTableShardingStrategyConfiguration(final
      * @return table rule
      */
     public Optional<TableRule> findTableRule(final String logicTableName) {
-        return tableRules.stream().filter(each -> each.getLogicTable().equalsIgnoreCase(logicTableName)).findFirst();
+        return Optional.ofNullable(tableRules.getOrDefault(logicTableName.toLowerCase(), null));

Review comment:
       ```suggestion
           return Optional.ofNullable(tableRules.get(logicTableName.toLowerCase()));
   ```




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