Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Code optimization for shardingsphere-shadow project. (#11282) #11285

Merged
merged 6 commits into from
Jul 13, 2021
Merged

Code optimization for shardingsphere-shadow project. (#11282) #11285

merged 6 commits into from
Jul 13, 2021

Conversation

soulasuna
Copy link
Contributor

Code optimization for shardingsphere-shadow project.
For #11282

Changes proposed in this pull request:

  • Optimize the code under the rewrite package.
  • Add junit test method for ShadowConditionEngine.

@soulasuna soulasuna changed the title Code optimization for shardingsphere-shadow project. (#11282)#11282 Code optimization for shardingsphere-shadow project. (#11282) Jul 12, 2021
@codecov-commenter
Copy link

codecov-commenter commented Jul 12, 2021

Codecov Report

Merging #11285 (0916865) into master (89b2506) will decrease coverage by 0.03%.
The diff coverage is 65.67%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master   #11285      +/-   ##
============================================
- Coverage     63.49%   63.46%   -0.04%     
  Complexity     1026     1026              
============================================
  Files          2200     2206       +6     
  Lines         33608    33683      +75     
  Branches       5881     5895      +14     
============================================
+ Hits          21340    21376      +36     
- Misses        10567    10601      +34     
- Partials       1701     1706       +5     
Impacted Files Coverage Δ
...rite/context/ShadowSQLRewriteContextDecorator.java 17.64% <0.00%> (-15.69%) ⬇️
...nerator/impl/ShadowInsertValuesTokenGenerator.java 37.25% <50.00%> (+1.83%) ⬆️
...meter/impl/ShadowInsertValueParameterRewriter.java 63.63% <73.33%> (+22.45%) ⬆️
...nerator/impl/RemoveShadowColumnTokenGenerator.java 78.94% <73.33%> (+12.28%) ⬆️
...e/shardingsphere/shadow/route/ShadowSQLRouter.java 97.50% <94.73%> (+0.44%) ⬆️
...dow/rewrite/parameter/ShadowParameterRewriter.java 66.66% <100.00%> (+16.66%) ⬆️
...e/token/generator/BaseShadowSQLTokenGenerator.java 66.66% <100.00%> (+16.66%) ⬆️
...state/service/DataSourceStatusRegistryService.java 50.00% <0.00%> (-34.62%) ⬇️
...andler/update/DropEncryptRuleStatementUpdater.java 72.41% <0.00%> (-1.50%) ⬇️
...sitor/statement/impl/MySQLStatementSQLVisitor.java 80.41% <0.00%> (-1.23%) ⬇️
... and 19 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 89b2506...0916865. Read the comment docs.

@@ -41,4 +41,8 @@ public final boolean isNeedRewrite(final SQLStatementContext sqlStatementContext
}

protected abstract boolean isNeedRewriteForShadow(SQLStatementContext sqlStatementContext);

protected String getShadowColumn() {
return shadowRule.getColumn();
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why do we need another function?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Each subclass is called multiple times, and protected methods are extracted from the parent class.

@tristaZero tristaZero added this to the 5.0.0-RC1 milestone Jul 13, 2021
@tristaZero tristaZero merged commit 6618aa1 into apache:master Jul 13, 2021
@soulasuna soulasuna deleted the #11282 branch July 14, 2021 02:23
@menghaoranss menghaoranss modified the milestones: 5.0.0-RC1, 5.0.0 Oct 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants