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/30 05:45:38 UTC
[GitHub] [shardingsphere] soulasuna opened a new pull request #12099: Refactor shadow rule and modify shadow value generic type.
soulasuna opened a new pull request #12099:
URL: https://github.com/apache/shardingsphere/pull/12099
## Refactor shadow rule and modify shadow value generic type.
For #11661.
Changes proposed in this pull request:
- Refactor the shadow rule add rule checker.
- Add shadow rule checker.
- Add shadow rule test.
- Modify shadow value generic type.
--
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] soulasuna commented on a change in pull request #12099: Refactor shadow rule and modify shadow value generic type.
Posted by GitBox <gi...@apache.org>.
soulasuna commented on a change in pull request #12099:
URL: https://github.com/apache/shardingsphere/pull/12099#discussion_r698288889
##########
File path: shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnRegexMatchShadowAlgorithm.java
##########
@@ -81,11 +81,11 @@ private void checkOperation() {
}
@Override
- public boolean isShadow(final Collection<String> shadowTableNames, final PreciseColumnShadowValue<String> shadowValue) {
+ public boolean isShadow(final Collection<String> shadowTableNames, final PreciseColumnShadowValue<Comparable<?>> shadowValue) {
boolean containTable = shadowTableNames.contains(shadowValue.getLogicTableName());
Review comment:
Thanks.
Method `isShadow()` in the algorithm is used to determine whether the sql contains shadow coloring.
Shadow tables and shadow algorithms are separately configured and referenced by ID.
If the user customizes the algorithm, he needs to get the configured shadow tables to customize his own judgment algorithm.
So the beginning of `isContainTable` is not used.
--
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] taojintianxia commented on a change in pull request #12099: Refactor shadow rule and modify shadow value generic type.
Posted by GitBox <gi...@apache.org>.
taojintianxia commented on a change in pull request #12099:
URL: https://github.com/apache/shardingsphere/pull/12099#discussion_r698274038
##########
File path: shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/algorithm/shadow/column/ColumnRegexMatchShadowAlgorithm.java
##########
@@ -81,11 +81,11 @@ private void checkOperation() {
}
@Override
- public boolean isShadow(final Collection<String> shadowTableNames, final PreciseColumnShadowValue<String> shadowValue) {
+ public boolean isShadow(final Collection<String> shadowTableNames, final PreciseColumnShadowValue<Comparable<?>> shadowValue) {
boolean containTable = shadowTableNames.contains(shadowValue.getLogicTableName());
Review comment:
why containTable is not isContainTable or why others start with `is`
--
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] tristaZero merged pull request #12099: Refactor shadow rule and modify shadow value generic type.
Posted by GitBox <gi...@apache.org>.
tristaZero merged pull request #12099:
URL: https://github.com/apache/shardingsphere/pull/12099
--
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] taojintianxia commented on a change in pull request #12099: Refactor shadow rule and modify shadow value generic type.
Posted by GitBox <gi...@apache.org>.
taojintianxia commented on a change in pull request #12099:
URL: https://github.com/apache/shardingsphere/pull/12099#discussion_r698276003
##########
File path: shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/rule/ShadowRule.java
##########
@@ -51,43 +56,95 @@
private final boolean enable;
- private final Map<String, ShadowDataSourceConfiguration> dataSources = new LinkedHashMap<>();
-
- private final Map<String, ShadowTableConfiguration> tables = new LinkedHashMap<>();
+ private final Map<String, String> shadowDataSourceMappings = new LinkedHashMap<>();
private final Map<String, ShadowAlgorithm> shadowAlgorithms = new LinkedHashMap<>();
+ private final Map<String, ShadowTableRule> shadowTableRules = new LinkedHashMap<>();
+
public ShadowRule(final ShadowRuleConfiguration shadowRuleConfig) {
+ enable = shadowRuleConfig.isEnable();
Review comment:
upon the boolean variable style is `isXXXX`, but here enable is not `isEnable` . why not use same varible style ?
--
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] soulasuna commented on a change in pull request #12099: Refactor shadow rule and modify shadow value generic type.
Posted by GitBox <gi...@apache.org>.
soulasuna commented on a change in pull request #12099:
URL: https://github.com/apache/shardingsphere/pull/12099#discussion_r698298609
##########
File path: shardingsphere-features/shardingsphere-shadow/shardingsphere-shadow-core/src/main/java/org/apache/shardingsphere/shadow/rule/ShadowRule.java
##########
@@ -51,43 +56,95 @@
private final boolean enable;
- private final Map<String, ShadowDataSourceConfiguration> dataSources = new LinkedHashMap<>();
-
- private final Map<String, ShadowTableConfiguration> tables = new LinkedHashMap<>();
+ private final Map<String, String> shadowDataSourceMappings = new LinkedHashMap<>();
private final Map<String, ShadowAlgorithm> shadowAlgorithms = new LinkedHashMap<>();
+ private final Map<String, ShadowTableRule> shadowTableRules = new LinkedHashMap<>();
+
public ShadowRule(final ShadowRuleConfiguration shadowRuleConfig) {
+ enable = shadowRuleConfig.isEnable();
Review comment:
isXXXX is added by lombok annotation @getter.
--
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 #12099: Refactor shadow rule and modify shadow value generic type.
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #12099:
URL: https://github.com/apache/shardingsphere/pull/12099#issuecomment-908108769
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/12099?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 [#12099](https://codecov.io/gh/apache/shardingsphere/pull/12099?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (c39e355) into [master](https://codecov.io/gh/apache/shardingsphere/commit/80fa0631fdf835343a84d5e7da5223c2fdec816b?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (80fa063) will **increase** coverage by `0.25%`.
> The diff coverage is `77.63%`.
[](https://codecov.io/gh/apache/shardingsphere/pull/12099?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 #12099 +/- ##
============================================
+ Coverage 63.22% 63.48% +0.25%
- Complexity 1227 1233 +6
============================================
Files 2311 2312 +1
Lines 35109 35168 +59
Branches 6103 6117 +14
============================================
+ Hits 22198 22325 +127
+ Misses 11122 11042 -80
- Partials 1789 1801 +12
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/12099?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...re/shadow/rule/checker/ShadowTableRuleChecker.java](https://codecov.io/gh/apache/shardingsphere/pull/12099/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cvcnVsZS9jaGVja2VyL1NoYWRvd1RhYmxlUnVsZUNoZWNrZXIuamF2YQ==) | `65.78% <65.78%> (ø)` | |
| [.../apache/shardingsphere/shadow/rule/ShadowRule.java](https://codecov.io/gh/apache/shardingsphere/pull/12099/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cvcnVsZS9TaGFkb3dSdWxlLmphdmE=) | `83.63% <88.57%> (+48.34%)` | :arrow_up: |
| [...shadow/column/ColumnRegexMatchShadowAlgorithm.java](https://codecov.io/gh/apache/shardingsphere/pull/12099/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cvYWxnb3JpdGhtL3NoYWRvdy9jb2x1bW4vQ29sdW1uUmVnZXhNYXRjaFNoYWRvd0FsZ29yaXRobS5qYXZh) | `96.15% <100.00%> (ø)` | |
| [...gorithmProvidedShadowRuleConfigurationChecker.java](https://codecov.io/gh/apache/shardingsphere/pull/12099/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cvcnVsZS9jaGVja2VyL0FsZ29yaXRobVByb3ZpZGVkU2hhZG93UnVsZUNvbmZpZ3VyYXRpb25DaGVja2VyLmphdmE=) | `60.00% <100.00%> (ø)` | |
| [...d/text/distsql/ral/common/hint/HintSourceType.java](https://codecov.io/gh/apache/shardingsphere/pull/12099/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-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmFsL2NvbW1vbi9oaW50L0hpbnRTb3VyY2VUeXBlLmphdmE=) | `0.00% <0.00%> (-42.86%)` | :arrow_down: |
| [...sphere/sharding/rewrite/token/pojo/IndexToken.java](https://codecov.io/gh/apache/shardingsphere/pull/12099/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcmV3cml0ZS90b2tlbi9wb2pvL0luZGV4VG9rZW4uamF2YQ==) | `26.92% <0.00%> (+26.92%)` | :arrow_up: |
| [...here/sharding/rewrite/token/pojo/OrderByToken.java](https://codecov.io/gh/apache/shardingsphere/pull/12099/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcmV3cml0ZS90b2tlbi9wb2pvL09yZGVyQnlUb2tlbi5qYXZh) | `33.33% <0.00%> (+33.33%)` | :arrow_up: |
| [...e/sharding/rewrite/token/pojo/ConstraintToken.java](https://codecov.io/gh/apache/shardingsphere/pull/12099/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmcvc2hhcmRpbmdzcGhlcmUtc2hhcmRpbmctY29yZS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc2hhcmRpbmcvcmV3cml0ZS90b2tlbi9wb2pvL0NvbnN0cmFpbnRUb2tlbi5qYXZh) | `33.33% <0.00%> (+33.33%)` | :arrow_up: |
| [...ithm/shadow/note/SimpleSQLNoteShadowAlgorithm.java](https://codecov.io/gh/apache/shardingsphere/pull/12099/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtc2hhZG93L3NoYXJkaW5nc3BoZXJlLXNoYWRvdy1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zaGFkb3cvYWxnb3JpdGhtL3NoYWRvdy9ub3RlL1NpbXBsZVNRTE5vdGVTaGFkb3dBbGdvcml0aG0uamF2YQ==) | `72.72% <0.00%> (+36.36%)` | :arrow_up: |
| ... and [7 more](https://codecov.io/gh/apache/shardingsphere/pull/12099/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/12099?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/12099?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 [80fa063...c39e355](https://codecov.io/gh/apache/shardingsphere/pull/12099?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