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 2020/03/20 09:09:00 UTC

[GitHub] [incubator-shardingsphere] yu199195 opened a new pull request #4863: shadingRule lambda modify.

yu199195 opened a new pull request #4863: shadingRule lambda modify.
URL: https://github.com/apache/incubator-shardingsphere/pull/4863
 
 
   I changed some of the methods in ShadingRule to a lambda expression for JDK8

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] codecov-io commented on issue #4863: shadingRule lambda modify.

Posted by GitBox <gi...@apache.org>.
codecov-io commented on issue #4863: shadingRule lambda modify.
URL: https://github.com/apache/incubator-shardingsphere/pull/4863#issuecomment-601633327
 
 
   # [Codecov](https://codecov.io/gh/apache/incubator-shardingsphere/pull/4863?src=pr&el=h1) Report
   > Merging [#4863](https://codecov.io/gh/apache/incubator-shardingsphere/pull/4863?src=pr&el=desc) into [master](https://codecov.io/gh/apache/incubator-shardingsphere/commit/5365f54e0a2cdbef53215a49595451f0d60edfaa?src=pr&el=desc) will **decrease** coverage by `0.02%`.
   > The diff coverage is `100%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/incubator-shardingsphere/pull/4863/graphs/tree.svg?width=650&token=ZvlXpWa7so&height=150&src=pr)](https://codecov.io/gh/apache/incubator-shardingsphere/pull/4863?src=pr&el=tree)
   
   ```diff
   @@             Coverage Diff              @@
   ##             master    #4863      +/-   ##
   ============================================
   - Coverage     55.09%   55.07%   -0.03%     
     Complexity      436      436              
   ============================================
     Files          1136     1136              
     Lines         20293    20281      -12     
     Branches       3747     3739       -8     
   ============================================
   - Hits          11181    11170      -11     
     Misses         8406     8406              
   + Partials        706      705       -1
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/incubator-shardingsphere/pull/4863?src=pr&el=tree) | Coverage Δ | Complexity Δ | |
   |---|---|---|---|
   | [.../apache/shardingsphere/core/rule/ShardingRule.java](https://codecov.io/gh/apache/incubator-shardingsphere/pull/4863/diff?src=pr&el=tree#diff-c2hhcmRpbmctY29yZS9zaGFyZGluZy1jb3JlLWNvbW1vbi9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvY29yZS9ydWxlL1NoYXJkaW5nUnVsZS5qYXZh) | `80.13% <100%> (-0.88%)` | `0 <0> (ø)` | |
   
   ------
   
   [Continue to review full report at Codecov](https://codecov.io/gh/apache/incubator-shardingsphere/pull/4863?src=pr&el=continue).
   > **Legend** - [Click here to learn more](https://docs.codecov.io/docs/codecov-delta)
   > `Δ = absolute <relative> (impact)`, `ø = not affected`, `? = missing data`
   > Powered by [Codecov](https://codecov.io/gh/apache/incubator-shardingsphere/pull/4863?src=pr&el=footer). Last update [5365f54...dc298eb](https://codecov.io/gh/apache/incubator-shardingsphere/pull/4863?src=pr&el=lastupdated). Read the [comment docs](https://docs.codecov.io/docs/pull-request-comments).
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] tristaZero merged pull request #4863: shadingRule lambda modify.

Posted by GitBox <gi...@apache.org>.
tristaZero merged pull request #4863: shadingRule lambda modify.
URL: https://github.com/apache/incubator-shardingsphere/pull/4863
 
 
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] yu199195 commented on a change in pull request #4863: shadingRule lambda modify.

Posted by GitBox <gi...@apache.org>.
yu199195 commented on a change in pull request #4863: shadingRule lambda modify.
URL: https://github.com/apache/incubator-shardingsphere/pull/4863#discussion_r395533657
 
 

 ##########
 File path: sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/rule/ShardingRule.java
 ##########
 @@ -85,36 +85,29 @@ public ShardingRule(final ShardingRuleConfiguration shardingRuleConfig, final Co
     }
     
     private Collection<TableRule> createTableRules(final ShardingRuleConfiguration shardingRuleConfig) {
-        Collection<TableRuleConfiguration> tableRuleConfigurations = shardingRuleConfig.getTableRuleConfigs();
-        Collection<TableRule> result = new ArrayList<>(tableRuleConfigurations.size());
-        for (TableRuleConfiguration each : tableRuleConfigurations) {
-            result.add(new TableRule(each, shardingDataSourceNames, getDefaultGenerateKeyColumn(shardingRuleConfig)));
-        }
-        return result;
+        return shardingRuleConfig.getTableRuleConfigs().stream()
+        .map(each -> new TableRule(each, shardingDataSourceNames, getDefaultGenerateKeyColumn(shardingRuleConfig)))
 
 Review comment:
   Ok,i will fix it

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] coveralls commented on issue #4863: shadingRule lambda modify.

Posted by GitBox <gi...@apache.org>.
coveralls commented on issue #4863: shadingRule lambda modify.
URL: https://github.com/apache/incubator-shardingsphere/pull/4863#issuecomment-601615708
 
 
   ## Pull Request Test Coverage Report for [Build 10441](https://coveralls.io/builds/29496167)
   
   * **13** of **13**   **(100.0%)**  changed or added relevant lines in **1** file are covered.
   * **18** unchanged lines in **3** files lost coverage.
   * Overall coverage decreased (**-0.1%**) to **58.62%**
   
   ---
   
   
   |  Files with Coverage Reduction | New Missed Lines | % |
   | :-----|--------------|--: |
   | [sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/util/IpUtils.java](https://coveralls.io/builds/29496167/source?filename=sharding-orchestration%2Fsharding-orchestration-core%2Fsharding-orchestration-core-registrycenter%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Forchestration%2Fcore%2Fregistrycenter%2Futil%2FIpUtils.java#L63) | 3 | 76.0% |
   | [sharding-scaling/sharding-scaling-core/src/main/java/org/apache/shardingsphere/shardingscaling/core/synctask/history/HistoryDataSyncTask.java](https://coveralls.io/builds/29496167/source?filename=sharding-scaling%2Fsharding-scaling-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingscaling%2Fcore%2Fsynctask%2Fhistory%2FHistoryDataSyncTask.java#L116) | 7 | 76.47% |
   | [sharding-scaling/sharding-scaling-core/src/main/java/org/apache/shardingsphere/shardingscaling/core/execute/executor/channel/MemoryChannel.java](https://coveralls.io/builds/29496167/source?filename=sharding-scaling%2Fsharding-scaling-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingscaling%2Fcore%2Fexecute%2Fexecutor%2Fchannel%2FMemoryChannel.java#L61) | 8 | 51.85% |
   <!-- | **Total:** | **18** |  | -->
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/29496167/badge)](https://coveralls.io/builds/29496167) |
   | :-- | --: |
   | Change from base [Build 1129](https://coveralls.io/builds/29494879): |  -0.1% |
   | Covered Lines: | 11891 |
   | Relevant Lines: | 20285 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] kimmking commented on a change in pull request #4863: shadingRule lambda modify.

Posted by GitBox <gi...@apache.org>.
kimmking commented on a change in pull request #4863: shadingRule lambda modify.
URL: https://github.com/apache/incubator-shardingsphere/pull/4863#discussion_r395527952
 
 

 ##########
 File path: sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/rule/ShardingRule.java
 ##########
 @@ -85,36 +85,29 @@ public ShardingRule(final ShardingRuleConfiguration shardingRuleConfig, final Co
     }
     
     private Collection<TableRule> createTableRules(final ShardingRuleConfiguration shardingRuleConfig) {
-        Collection<TableRuleConfiguration> tableRuleConfigurations = shardingRuleConfig.getTableRuleConfigs();
-        Collection<TableRule> result = new ArrayList<>(tableRuleConfigurations.size());
-        for (TableRuleConfiguration each : tableRuleConfigurations) {
-            result.add(new TableRule(each, shardingDataSourceNames, getDefaultGenerateKeyColumn(shardingRuleConfig)));
-        }
-        return result;
+        return shardingRuleConfig.getTableRuleConfigs().stream()
+        .map(each -> new TableRule(each, shardingDataSourceNames, getDefaultGenerateKeyColumn(shardingRuleConfig)))
 
 Review comment:
   with more blank in the front of this line.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] kimmking commented on a change in pull request #4863: shadingRule lambda modify.

Posted by GitBox <gi...@apache.org>.
kimmking commented on a change in pull request #4863: shadingRule lambda modify.
URL: https://github.com/apache/incubator-shardingsphere/pull/4863#discussion_r395528765
 
 

 ##########
 File path: sharding-core/sharding-core-common/src/main/java/org/apache/shardingsphere/core/rule/ShardingRule.java
 ##########
 @@ -85,36 +85,29 @@ public ShardingRule(final ShardingRuleConfiguration shardingRuleConfig, final Co
     }
     
     private Collection<TableRule> createTableRules(final ShardingRuleConfiguration shardingRuleConfig) {
-        Collection<TableRuleConfiguration> tableRuleConfigurations = shardingRuleConfig.getTableRuleConfigs();
-        Collection<TableRule> result = new ArrayList<>(tableRuleConfigurations.size());
-        for (TableRuleConfiguration each : tableRuleConfigurations) {
-            result.add(new TableRule(each, shardingDataSourceNames, getDefaultGenerateKeyColumn(shardingRuleConfig)));
-        }
-        return result;
+        return shardingRuleConfig.getTableRuleConfigs().stream()
+        .map(each -> new TableRule(each, shardingDataSourceNames, getDefaultGenerateKeyColumn(shardingRuleConfig)))
+        .collect(Collectors.toList());
     }
     
     private String getDefaultGenerateKeyColumn(final ShardingRuleConfiguration shardingRuleConfig) {
-        return null == shardingRuleConfig.getDefaultKeyGeneratorConfig() ? null : shardingRuleConfig.getDefaultKeyGeneratorConfig().getColumn();
+        return Optional.ofNullable(shardingRuleConfig.getDefaultKeyGeneratorConfig()).map(KeyGeneratorConfiguration::getColumn).orElse(null);
     }
     
     private Collection<BindingTableRule> createBindingTableRules(final Collection<String> bindingTableGroups) {
-        Collection<BindingTableRule> result = new ArrayList<>(bindingTableGroups.size());
-        for (String each : bindingTableGroups) {
-            result.add(createBindingTableRule(each));
-        }
-        return result;
+        return bindingTableGroups.stream().map(this::createBindingTableRule).collect(Collectors.toList());
     }
     
     private BindingTableRule createBindingTableRule(final String bindingTableGroup) {
-        List<TableRule> tableRules = new LinkedList<>();
-        for (String each : Splitter.on(",").trimResults().splitToList(bindingTableGroup)) {
-            tableRules.add(getTableRule(each));
-        }
+        List<TableRule> tableRules = Splitter.on(",").trimResults()
+                .splitToList(bindingTableGroup).stream()
 
 Review comment:
   one line is better.

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services

[GitHub] [incubator-shardingsphere] coveralls edited a comment on issue #4863: shadingRule lambda modify.

Posted by GitBox <gi...@apache.org>.
coveralls edited a comment on issue #4863: shadingRule lambda modify.
URL: https://github.com/apache/incubator-shardingsphere/pull/4863#issuecomment-601615708
 
 
   ## Pull Request Test Coverage Report for [Build 10443](https://coveralls.io/builds/29497361)
   
   * **9** of **9**   **(100.0%)**  changed or added relevant lines in **1** file are covered.
   * **18** unchanged lines in **3** files lost coverage.
   * Overall coverage decreased (**-0.1%**) to **58.612%**
   
   ---
   
   
   |  Files with Coverage Reduction | New Missed Lines | % |
   | :-----|--------------|--: |
   | [sharding-orchestration/sharding-orchestration-core/sharding-orchestration-core-registrycenter/src/main/java/org/apache/shardingsphere/orchestration/core/registrycenter/util/IpUtils.java](https://coveralls.io/builds/29497361/source?filename=sharding-orchestration%2Fsharding-orchestration-core%2Fsharding-orchestration-core-registrycenter%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Forchestration%2Fcore%2Fregistrycenter%2Futil%2FIpUtils.java#L63) | 3 | 76.0% |
   | [sharding-scaling/sharding-scaling-core/src/main/java/org/apache/shardingsphere/shardingscaling/core/synctask/history/HistoryDataSyncTask.java](https://coveralls.io/builds/29497361/source?filename=sharding-scaling%2Fsharding-scaling-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingscaling%2Fcore%2Fsynctask%2Fhistory%2FHistoryDataSyncTask.java#L116) | 7 | 76.47% |
   | [sharding-scaling/sharding-scaling-core/src/main/java/org/apache/shardingsphere/shardingscaling/core/execute/executor/channel/MemoryChannel.java](https://coveralls.io/builds/29497361/source?filename=sharding-scaling%2Fsharding-scaling-core%2Fsrc%2Fmain%2Fjava%2Forg%2Fapache%2Fshardingsphere%2Fshardingscaling%2Fcore%2Fexecute%2Fexecutor%2Fchannel%2FMemoryChannel.java#L61) | 8 | 51.85% |
   <!-- | **Total:** | **18** |  | -->
   
   |  Totals | [![Coverage Status](https://coveralls.io/builds/29497361/badge)](https://coveralls.io/builds/29497361) |
   | :-- | --: |
   | Change from base [Build 1129](https://coveralls.io/builds/29494879): |  -0.1% |
   | Covered Lines: | 11887 |
   | Relevant Lines: | 20281 |
   
   ---
   ##### 💛  - [Coveralls](https://coveralls.io)
   

----------------------------------------------------------------
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.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services