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: optimize recognize sql in limit and order by #3212

Merged
merged 31 commits into from Aug 14, 2021

Conversation

l81893521
Copy link
Contributor

Ⅰ. Describe what this PR did

This solution still has a problem that

getLimitCondition()

and

getOrderByCondition()

in the

WhereRecognizer.java 

and I will refactor it in the later version.

Ⅱ. Does this pull request fix one issue?

Ⅲ. Why don't you add test cases (unit test/integration test)?

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@codecov-io
Copy link

codecov-io commented Oct 23, 2020

Codecov Report

Merging #3212 (aeeb526) into develop (4040644) will decrease coverage by 0.43%.
The diff coverage is 23.57%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #3212      +/-   ##
=============================================
- Coverage      51.96%   51.52%   -0.44%     
+ Complexity      3481     3397      -84     
=============================================
  Files            637      621      -16     
  Lines          21054    20637     -417     
  Branches        2605     2549      -56     
=============================================
- Hits           10941    10634     -307     
+ Misses          9032     8949      -83     
+ Partials        1081     1054      -27     
Impacted Files Coverage Δ Complexity Δ
...er/druid/mysql/MySQLSelectForUpdateRecognizer.java 77.77% <0.00%> (-22.23%) 9.00 <0.00> (ø)
...a/sqlparser/druid/mysql/MySQLUpdateRecognizer.java 82.35% <0.00%> (-10.99%) 15.00 <0.00> (ø)
...a/sqlparser/druid/oracle/BaseOracleRecognizer.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...sqlparser/druid/oracle/OracleDeleteRecognizer.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
.../druid/oracle/OracleSelectForUpdateRecognizer.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...sqlparser/druid/oracle/OracleUpdateRecognizer.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...ser/druid/postgresql/BasePostgresqlRecognizer.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...r/druid/postgresql/PostgresqlDeleteRecognizer.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...ostgresql/PostgresqlSelectForUpdateRecognizer.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
...r/druid/postgresql/PostgresqlUpdateRecognizer.java 0.00% <0.00%> (ø) 0.00 <0.00> (ø)
... and 49 more

if (StringUtils.isNotBlank(orderBy)) {
suffix.append(orderBy);
suffix.append(" ").append(orderBy);
Copy link
Contributor

Choose a reason for hiding this comment

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

“ ” you can set it to a constant, right?

…er_by_sql

# Conflicts:
#	rm-datasource/src/main/java/io/seata/rm/datasource/exec/DeleteExecutor.java
#	rm-datasource/src/main/java/io/seata/rm/datasource/exec/UpdateExecutor.java
#	sqlparser/seata-sqlparser-core/src/main/java/io/seata/sqlparser/WhereRecognizer.java
#	sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/mysql/BaseMySQLRecognizer.java
#	sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/mysql/MySQLDeleteRecognizer.java
#	sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/mysql/MySQLUpdateRecognizer.java
#	sqlparser/seata-sqlparser-druid/src/test/java/io/seata/sqlparser/druid/MySQLDeleteRecognizerTest.java
@funky-eyes funky-eyes added this to the 1.5.0 milestone Jan 11, 2021
…er_by_sql

# Conflicts:
#	changes/1.5.0.md
#	changes/en-us/1.5.0.md
@caohdgege
Copy link
Contributor

plz modify AntlrMySQLDeleteRecognizer, AntlrMySQLSelectRecognizer, AntlrMySQLUpdateRecognizer either

@slievrly slievrly self-requested a review March 8, 2021 14:17
@slievrly slievrly modified the milestones: 1.4.2, 1.5.0 Mar 29, 2021
@l81893521
Copy link
Contributor Author

plz modify AntlrMySQLDeleteRecognizer, AntlrMySQLSelectRecognizer, AntlrMySQLUpdateRecognizer either

fixed

…er_by_sql

# Conflicts:
#	changes/1.5.0.md
#	changes/en-us/1.5.0.md
#	sqlparser/seata-sqlparser-core/src/main/java/io/seata/sqlparser/WhereRecognizer.java
#	sqlparser/seata-sqlparser-druid/src/main/java/io/seata/sqlparser/druid/BaseRecognizer.java
@codecov-commenter
Copy link

codecov-commenter commented Jul 23, 2021

Codecov Report

Merging #3212 (4ee5af0) into develop (f4bbf03) will decrease coverage by 0.18%.
The diff coverage is 21.71%.

Impacted file tree graph

@@              Coverage Diff              @@
##             develop    #3212      +/-   ##
=============================================
- Coverage      40.75%   40.56%   -0.19%     
+ Complexity      3071     3070       -1     
=============================================
  Files            682      682              
  Lines          23001    23082      +81     
  Branches        2867     2854      -13     
=============================================
- Hits            9373     9364       -9     
- Misses         12752    12848      +96     
+ Partials         876      870       -6     
Impacted Files Coverage Δ
...parser/antlr/mysql/AntlrMySQLDeleteRecognizer.java 0.00% <0.00%> (ø)
...parser/antlr/mysql/AntlrMySQLSelectRecognizer.java 50.00% <0.00%> (-12.50%) ⬇️
...parser/antlr/mysql/AntlrMySQLUpdateRecognizer.java 0.00% <0.00%> (ø)
...er/druid/mysql/MySQLSelectForUpdateRecognizer.java 77.77% <0.00%> (-22.23%) ⬇️
...a/sqlparser/druid/mysql/MySQLUpdateRecognizer.java 67.85% <0.00%> (-8.15%) ⬇️
...a/sqlparser/druid/oracle/BaseOracleRecognizer.java 0.00% <0.00%> (ø)
...sqlparser/druid/oracle/OracleDeleteRecognizer.java 0.00% <0.00%> (ø)
.../druid/oracle/OracleSelectForUpdateRecognizer.java 0.00% <0.00%> (ø)
...sqlparser/druid/oracle/OracleUpdateRecognizer.java 0.00% <0.00%> (ø)
...ser/druid/postgresql/BasePostgresqlRecognizer.java 0.00% <0.00%> (ø)
... and 13 more

Copy link
Contributor

@funky-eyes funky-eyes left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@caohdgege caohdgege left a comment

Choose a reason for hiding this comment

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

LGTM

@funky-eyes funky-eyes merged commit 4628861 into apache:develop Aug 14, 2021
Copy link
Member

@slievrly slievrly left a comment

Choose a reason for hiding this comment

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

LGTM

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

7 participants