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

Optimize rewriting module #2435

Merged
merged 40 commits into from
May 23, 2019
Merged

Optimize rewriting module #2435

merged 40 commits into from
May 23, 2019

Conversation

tristaZero
Copy link
Contributor

Fixes #2275.

Some suggestions:

  • Remove SQLRewriteEngine.originalSQL, use sqlStatement.getLogicSQL()
  • For EncryptRule with SQLRewriteEngine, use current DatabaseType instead of DatabaseType.MySQL
  • SQLRewriteEngine.isRewriteDistinctLiteral => isMeedRewriteDistinctLiteral
  • SQLRewriteEngine.isContainsAggregationDistinctToken can move to sqlStatement, and let token type as an input parameter
  • SelectStatement.getFirstSelectItemStartIndex() should as a Token and Split append distinct from rewriteInitialLiteral
  • Make sure responsibility of rewriter and engine, only rewriter can use token
  • EncryptSQLRewriter & ShardingSQLRewriter can new instance out of loop
  • Make unify with stopPosition & stopIndex
  • sqlBuilder is global field with SQLRewriteEngine, may avoid pass from private method by input parameter
  • Make accurate with javadoc on SQLRewriter.rewrite
  • Avoid start a new line if not exceed 200 char one line, at line 107 on EncryptSQLRewriter
  • Make input parameter as same sequence for differnet methods, like: EncryptSQLRewriter.encryptInsertOptimizeResultUnit and EncryptSQLRewriter.encryptInsertOptimizeResult's param: unit add Predicate if Optional can not be absent, at line 105 on EncryptSQLRewriter
  • InsertParameterUnit => InsertParameterGroup?
  • Decouple SQLBuilder & ParameterBuilder
  • Remove SchemaPlaceholder and test cases

tristaZero added 10 commits May 23, 2019 16:10
…o dev

# Conflicts:
#	sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/wrapper/PreparedStatementExecutorWrapper.java
#	sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/wrapper/StatementExecutorWrapper.java
@coveralls
Copy link

Pull Request Test Coverage Report for Build 8202

  • 46 of 55 (83.64%) changed or added relevant lines in 13 files are covered.
  • 7 unchanged lines in 2 files lost coverage.
  • Overall coverage decreased (-0.02%) to 60.406%

Changes Missing Coverage Covered Lines Changed/Added Lines %
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/filler/common/dml/SelectItemsFiller.java 0 1 0.0%
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/SQLRewriteEngine.java 15 16 93.75%
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/wrapper/PreparedStatementExecutorWrapper.java 0 1 0.0%
sharding-proxy/sharding-proxy-backend/src/main/java/org/apache/shardingsphere/shardingproxy/backend/communication/jdbc/wrapper/StatementExecutorWrapper.java 0 1 0.0%
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/filler/common/dml/SelectItemFiller.java 0 5 0.0%
Files with Coverage Reduction New Missed Lines %
sharding-core/sharding-core-parse/sharding-core-parse-common/src/main/java/org/apache/shardingsphere/core/parse/filler/common/dml/SelectItemFiller.java 1 0.0%
sharding-core/sharding-core-rewrite/src/main/java/org/apache/shardingsphere/core/rewrite/builder/ParameterBuilder.java 6 77.5%
Totals Coverage Status
Change from base Build 8199: -0.02%
Covered Lines: 8101
Relevant Lines: 13411

💛 - Coveralls

@terrymanu terrymanu merged commit 30a911f into apache:dev May 23, 2019
@terrymanu terrymanu added this to the 4.0.0.M2 milestone May 23, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Reconstruct rewriting module
3 participants