Skip to content

Conversation

@YoWuwuuuw
Copy link
Contributor

@YoWuwuuuw YoWuwuuuw commented Mar 13, 2025

  • I have registered the PR changes.

Ⅰ. Describe what this PR did

Ⅱ. Does this pull request fix one issue?

#7217

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

Ⅳ. Describe how to verify it

Ⅴ. Special notes for reviews

@codecov
Copy link

codecov bot commented Mar 13, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 53.45%. Comparing base (886874e) to head (01deabc).
Report is 2 commits behind head on 2.x.

Additional details and impacted files

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #7219      +/-   ##
============================================
+ Coverage     53.28%   53.45%   +0.17%     
- Complexity     7069     7108      +39     
============================================
  Files          1169     1169              
  Lines         41585    41578       -7     
  Branches       4871     4873       +2     
============================================
+ Hits          22158    22226      +68     
+ Misses        17328    17251      -77     
- Partials       2099     2101       +2     
Files with missing lines Coverage Δ
...tasource/exec/kingbase/KingbaseInsertExecutor.java 83.78% <ø> (ø)
...g/apache/seata/sqlparser/druid/BaseRecognizer.java 85.00% <ø> (+4.04%) ⬆️
...sqlparser/druid/DruidSQLRecognizerFactoryImpl.java 75.00% <100.00%> (+5.76%) ⬆️
...lparser/druid/kingbase/BaseKingbaseRecognizer.java 67.34% <ø> (+30.09%) ⬆️
...a/sqlparser/druid/oracle/BaseOracleRecognizer.java 71.42% <ø> (+2.80%) ⬆️
...ata/sqlparser/druid/oscar/BaseOscarRecognizer.java 55.10% <ø> (+17.84%) ⬆️
...ser/druid/postgresql/BasePostgresqlRecognizer.java 27.77% <ø> (+0.99%) ⬆️
...arser/druid/sqlserver/BaseSqlServerRecognizer.java 70.96% <ø> (+16.42%) ⬆️
...id/sqlserver/SqlServerOperateRecognizerHolder.java 72.72% <100.00%> (+4.30%) ⬆️

... and 26 files with indirect coverage changes

🚀 New features to boost your workflow:
  • Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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.

Good catch.

@slievrly slievrly changed the title bugfix:NotSupportExc can't be thrown out in some cases optimize: optimize sql parsing logic Mar 13, 2025
@slievrly
Copy link
Member

The REPLACE INTO syntax is not standard SQL92/99 syntax, is not supported by all databases, and should be removed from the Base class.

Copy link
Member

@YongGoose YongGoose left a comment

Choose a reason for hiding this comment

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

The code seems to be well-written.
However, I have left a few comments.

Have a good day :)

Comment on lines 62 to 83
if (tableSource instanceof SQLSubqueryTableSource) {
return new SqlServerSelectForUpdateRecognizer(sql, ast);
} else {
List<SQLHint> hints = tableSource.getHints();
if (CollectionUtils.isNotEmpty(hints)) {
List<String> hintsTexts = hints
.stream()
.map(hint -> {
if (hint instanceof SQLExprHint) {
SQLExpr expr = ((SQLExprHint) hint).getExpr();
return expr instanceof SQLIdentifierExpr ? ((SQLIdentifierExpr) expr).getName() : "";
} else if (hint instanceof SQLCommentHint) {
return ((SQLCommentHint) hint).getText();
}
return "";
}).collect(Collectors.toList());
if (hintsTexts.contains("UPDLOCK")) {
return new SqlServerSelectForUpdateRecognizer(sql, ast);
}
}
return null;
}
Copy link
Member

Choose a reason for hiding this comment

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

In the given code, the else block is unnecessary because the return statement inside the if block already exits the method. Removing the else will improve readability and reduce nesting.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, it was an unwarranted mistake, I corrected it.

Comment on lines 160 to 165
// When dbtype are DM and SQLSERVER, druid cannot parse
// try {
// recognizerFactory.create(sql3, JdbcConstants.DM);
// } catch (Exception e) {
// //e.printStackTrace();
// }
Copy link
Member

@YongGoose YongGoose Mar 14, 2025

Choose a reason for hiding this comment

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

Is there a reason why you didn’t remove the single-line comments?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is a bad habit I developed in the past. I have deleted the comments so that later people can understand them easily

Comment on lines 174 to 178
// try {
// recognizerFactory.create(sql4, JdbcConstants.MYSQL);
// } catch (Exception e) {
// //e.printStackTrace();
// }
Copy link
Member

Choose a reason for hiding this comment

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

Ditto

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because merge sql syntax is not supported, the relevant code has been removed

Copy link
Member

@xingfudeshi xingfudeshi left a comment

Choose a reason for hiding this comment

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

LGTM

@xingfudeshi
Copy link
Member

@YongGoose Can we merge this code now?

@YongGoose
Copy link
Member

@YongGoose Can we merge this code now?

Sure :)

Copy link
Member

@YongGoose YongGoose left a comment

Choose a reason for hiding this comment

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

LGTM

@xingfudeshi xingfudeshi merged commit 44dd9d6 into apache:2.x Mar 14, 2025
8 checks passed
@slievrly slievrly added this to the 2.4.0 milestone Mar 15, 2025
slievrly pushed a commit to slievrly/fescar that referenced this pull request Oct 21, 2025
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.

5 participants