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/02/18 08:56:45 UTC

[GitHub] [shardingsphere] TeslaCN opened a new pull request #15498: Replace high frequency stream with loop

TeslaCN opened a new pull request #15498:
URL: https://github.com/apache/shardingsphere/pull/15498


   Related to #10626, #13848.


-- 
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] codecov-commenter commented on pull request #15498: Replace high frequency stream with loop

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #15498:
URL: https://github.com/apache/shardingsphere/pull/15498#issuecomment-1044758588


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/15498?src=pr&el=h1&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) Report
   > Merging [#15498](https://codecov.io/gh/apache/shardingsphere/pull/15498?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (a84a13b) into [master](https://codecov.io/gh/apache/shardingsphere/commit/ea9cf5a0090c143b2e49a02d662f696645ec8583?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ea9cf5a) will **decrease** coverage by `0.00%`.
   > The diff coverage is `50.00%`.
   
   > :exclamation: Current head a84a13b differs from pull request most recent head 59f4c33. Consider uploading reports for the commit 59f4c33 to get more accurate results
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/15498/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/shardingsphere/pull/15498?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master   #15498      +/-   ##
   ============================================
   - Coverage     60.53%   60.52%   -0.01%     
     Complexity     1958     1958              
   ============================================
     Files          3228     3223       -5     
     Lines         48352    48392      +40     
     Branches       8257     8259       +2     
   ============================================
   + Hits          29268    29291      +23     
   - Misses        16686    16705      +19     
   + Partials       2398     2396       -2     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/15498?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...end/communication/DatabaseCommunicationEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/15498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC9jb21tdW5pY2F0aW9uL0RhdGFiYXNlQ29tbXVuaWNhdGlvbkVuZ2luZS5qYXZh) | `31.03% <0.00%> (-2.30%)` | :arrow_down: |
   | [.../proxy/backend/communication/ProxySQLExecutor.java](https://codecov.io/gh/apache/shardingsphere/pull/15498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC9jb21tdW5pY2F0aW9uL1Byb3h5U1FMRXhlY3V0b3IuamF2YQ==) | `32.00% <0.00%> (-2.79%)` | :arrow_down: |
   | [...ication/jdbc/datasource/JDBCBackendDataSource.java](https://codecov.io/gh/apache/shardingsphere/pull/15498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC9jb21tdW5pY2F0aW9uL2pkYmMvZGF0YXNvdXJjZS9KREJDQmFja2VuZERhdGFTb3VyY2UuamF2YQ==) | `66.66% <20.00%> (-11.91%)` | :arrow_down: |
   | [...ackend/text/TextProtocolBackendHandlerFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/15498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L1RleHRQcm90b2NvbEJhY2tlbmRIYW5kbGVyRmFjdG9yeS5qYXZh) | `63.46% <20.00%> (-5.29%)` | :arrow_down: |
   | [...a/binder/statement/dml/DeleteStatementContext.java](https://codecov.io/gh/apache/shardingsphere/pull/15498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtYmluZGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9iaW5kZXIvc3RhdGVtZW50L2RtbC9EZWxldGVTdGF0ZW1lbnRDb250ZXh0LmphdmE=) | `86.36% <60.00%> (-8.38%)` | :arrow_down: |
   | [...ct/projection/engine/ProjectionsContextEngine.java](https://codecov.io/gh/apache/shardingsphere/pull/15498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtYmluZGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9iaW5kZXIvc2VnbWVudC9zZWxlY3QvcHJvamVjdGlvbi9lbmdpbmUvUHJvamVjdGlvbnNDb250ZXh0RW5naW5lLmphdmE=) | `96.00% <80.00%> (-1.88%)` | :arrow_down: |
   | [...che/shardingsphere/sharding/rule/ShardingRule.java](https://codecov.io/gh/apache/shardingsphere/pull/15498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcnVsZS9TaGFyZGluZ1J1bGUuamF2YQ==) | `81.41% <90.90%> (+0.77%)` | :arrow_up: |
   | [...che/shardingsphere/spi/typed/TypedSPIRegistry.java](https://codecov.io/gh/apache/shardingsphere/pull/15498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtc3BpL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zcGkvdHlwZWQvVHlwZWRTUElSZWdpc3RyeS5qYXZh) | `81.25% <100.00%> (ø)` | |
   | [.../shardingsphere/spring/boot/util/PropertyUtil.java](https://codecov.io/gh/apache/shardingsphere/pull/15498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtamRiYy9zaGFyZGluZ3NwaGVyZS1qZGJjLXNwcmluZy9zaGFyZGluZ3NwaGVyZS1qZGJjLXNwcmluZy1pbmZyYS9zaGFyZGluZ3NwaGVyZS1qZGJjLXNwcmluZy1ib290LXN0YXJ0ZXItaW5mcmEvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NwcmluZy9ib290L3V0aWwvUHJvcGVydHlVdGlsLmphdmE=) | `37.09% <0.00%> (-12.91%)` | :arrow_down: |
   | [...persist/service/impl/DataSourcePersistService.java](https://codecov.io/gh/apache/shardingsphere/pull/15498/diff?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation#diff-c2hhcmRpbmdzcGhlcmUtbW9kZS9zaGFyZGluZ3NwaGVyZS1tb2RlLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL21vZGUvbWV0YWRhdGEvcGVyc2lzdC9zZXJ2aWNlL2ltcGwvRGF0YVNvdXJjZVBlcnNpc3RTZXJ2aWNlLmphdmE=) | `61.76% <0.00%> (-8.24%)` | :arrow_down: |
   | ... and [51 more](https://codecov.io/gh/apache/shardingsphere/pull/15498/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/15498?src=pr&el=continue&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/15498?src=pr&el=footer&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Last update [ea9cf5a...59f4c33](https://codecov.io/gh/apache/shardingsphere/pull/15498?src=pr&el=lastupdated&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation).
   


-- 
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] strongduanmu merged pull request #15498: Replace high frequency stream with loop

Posted by GitBox <gi...@apache.org>.
strongduanmu merged pull request #15498:
URL: https://github.com/apache/shardingsphere/pull/15498


   


-- 
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] strongduanmu commented on a change in pull request #15498: Replace high frequency stream with loop

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on a change in pull request #15498:
URL: https://github.com/apache/shardingsphere/pull/15498#discussion_r809842031



##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
##########
@@ -314,7 +314,13 @@ public boolean isAllBindingTables(final ShardingSphereSchema schema, final SQLSt
     }
     
     private Optional<BindingTableRule> findBindingTableRule(final Collection<String> logicTableNames) {
-        return logicTableNames.stream().map(this::findBindingTableRule).filter(Optional::isPresent).findFirst().orElse(Optional.empty());
+        for (String logicTableName : logicTableNames) {

Review comment:
       Please rename logicTableName with each.

##########
File path: shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/statement/dml/DeleteStatementContext.java
##########
@@ -56,8 +55,12 @@ public DeleteStatementContext(final DeleteStatement sqlStatement) {
     }
     
     private Collection<SimpleTableSegment> filterAliasDeleteTable(final Collection<SimpleTableSegment> tableSegments) {
-        Map<String, SimpleTableSegment> aliasTableSegmentMap = tableSegments.stream().filter(each 
-            -> each.getAlias().isPresent()).collect(Collectors.toMap(each -> each.getAlias().get(), Function.identity(), (oldValue, currentValue) -> oldValue));
+        Map<String, SimpleTableSegment> aliasTableSegmentMap = new HashMap<>(tableSegments.size(), 1f);
+        for (SimpleTableSegment tableSegment : tableSegments) {

Review comment:
       Rename tableSegment with 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] TeslaCN commented on a change in pull request #15498: Replace high frequency stream with loop

Posted by GitBox <gi...@apache.org>.
TeslaCN commented on a change in pull request #15498:
URL: https://github.com/apache/shardingsphere/pull/15498#discussion_r810108699



##########
File path: shardingsphere-features/shardingsphere-sharding/shardingsphere-sharding-core/src/main/java/org/apache/shardingsphere/sharding/rule/ShardingRule.java
##########
@@ -314,7 +314,13 @@ public boolean isAllBindingTables(final ShardingSphereSchema schema, final SQLSt
     }
     
     private Optional<BindingTableRule> findBindingTableRule(final Collection<String> logicTableNames) {
-        return logicTableNames.stream().map(this::findBindingTableRule).filter(Optional::isPresent).findFirst().orElse(Optional.empty());
+        for (String logicTableName : logicTableNames) {

Review comment:
       Fixed.

##########
File path: shardingsphere-infra/shardingsphere-infra-binder/src/main/java/org/apache/shardingsphere/infra/binder/statement/dml/DeleteStatementContext.java
##########
@@ -56,8 +55,12 @@ public DeleteStatementContext(final DeleteStatement sqlStatement) {
     }
     
     private Collection<SimpleTableSegment> filterAliasDeleteTable(final Collection<SimpleTableSegment> tableSegments) {
-        Map<String, SimpleTableSegment> aliasTableSegmentMap = tableSegments.stream().filter(each 
-            -> each.getAlias().isPresent()).collect(Collectors.toMap(each -> each.getAlias().get(), Function.identity(), (oldValue, currentValue) -> oldValue));
+        Map<String, SimpleTableSegment> aliasTableSegmentMap = new HashMap<>(tableSegments.size(), 1f);
+        for (SimpleTableSegment tableSegment : tableSegments) {

Review comment:
       Fixed.




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