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 2022/02/24 12:29:49 UTC
[GitHub] [shardingsphere] soulasuna opened a new pull request #15619: Fix set character sql parser
soulasuna opened a new pull request #15619:
URL: https://github.com/apache/shardingsphere/pull/15619
## Fix set character sql parser
Related to #13317.
Changes proposed in this pull request:
- Set charset sql parser supported for MySQL by `SET {CHARACTER SET | CHARSET} {'charsetName' | DEFAULT};`.
- Set charset sql parser supported for PostgreSQL by `SET NAMES 'charsetName';`.
--
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 #15619: Fix set character sql parser
Posted by GitBox <gi...@apache.org>.
soulasuna commented on a change in pull request #15619:
URL: https://github.com/apache/shardingsphere/pull/15619#discussion_r814421910
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLDALStatementSQLVisitor.java
##########
@@ -77,8 +77,17 @@ public ASTNode visitSet(final SetContext ctx) {
variableAssignSegment.getVariable().setScope(ctx.runtimeScope().getText());
}
variableAssigns.add(variableAssignSegment);
- result.getVariableAssigns().addAll(variableAssigns);
}
+ if (null != ctx.encoding()) {
+ VariableAssignSegment variableAssignSegment = new VariableAssignSegment();
+ VariableSegment variableSegment = new VariableSegment();
+ variableSegment.setVariable("charset");
+ variableAssignSegment.setVariable(variableSegment);
+ String value = ctx.encoding().getText();
+ variableAssignSegment.setAssignValue(value);
+ variableAssigns.add(variableAssignSegment);
+ }
+ result.getVariableAssigns().addAll(variableAssigns);
Review comment:
OK, I will add test.
--
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 #15619: Fix set character sql parser
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #15619:
URL: https://github.com/apache/shardingsphere/pull/15619#issuecomment-1050149023
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/15619?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 [#15619](https://codecov.io/gh/apache/shardingsphere/pull/15619?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (017dc76) into [master](https://codecov.io/gh/apache/shardingsphere/commit/de97faeb4f898f9e144ddd3cb589cfe9e24bed24?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (de97fae) will **decrease** coverage by `0.01%`.
> The diff coverage is `6.25%`.
[](https://codecov.io/gh/apache/shardingsphere/pull/15619?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 #15619 +/- ##
============================================
- Coverage 60.42% 60.41% -0.02%
Complexity 1763 1763
============================================
Files 3242 3242
Lines 48823 48836 +13
Branches 8345 8347 +2
============================================
Hits 29502 29502
- Misses 16897 16909 +12
- Partials 2424 2425 +1
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/15619?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [.../db/protocol/mysql/constant/MySQLCharacterSet.java](https://codecov.io/gh/apache/shardingsphere/pull/15619/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-c2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wvc2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wtbXlzcWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RiL3Byb3RvY29sL215c3FsL2NvbnN0YW50L015U1FMQ2hhcmFjdGVyU2V0LmphdmE=) | `98.02% <0.00%> (-0.98%)` | :arrow_down: |
| [...or/statement/impl/MySQLDALStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/15619/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1teXNxbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9teXNxbC92aXNpdG9yL3N0YXRlbWVudC9pbXBsL015U1FMREFMU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `83.21% <0.00%> (-0.39%)` | :arrow_down: |
| [...atement/impl/PostgreSQLDALStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/15619/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1wb3N0Z3Jlc3FsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zcWwvcGFyc2VyL3Bvc3RncmVzcWwvdmlzaXRvci9zdGF0ZW1lbnQvaW1wbC9Qb3N0Z3JlU1FMREFMU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `56.06% <11.11%> (-7.74%)` | :arrow_down: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/15619?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/15619?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 [de97fae...017dc76](https://codecov.io/gh/apache/shardingsphere/pull/15619?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
[GitHub] [shardingsphere] soulasuna commented on a change in pull request #15619: Fix set character sql parser
Posted by GitBox <gi...@apache.org>.
soulasuna commented on a change in pull request #15619:
URL: https://github.com/apache/shardingsphere/pull/15619#discussion_r814421087
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
##########
@@ -974,13 +974,15 @@ private VariableAssignSegment getVariableAssign(final OptionValueContext ctx) {
@Override
public ASTNode visitSetCharacter(final SetCharacterContext ctx) {
- MySQLSetStatement result = new MySQLSetStatement();
+ final MySQLSetStatement result = new MySQLSetStatement();
Review comment:
This final for `<module name="VariableDeclarationUsageDistance"/>` can not removed.
--
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] strongduanmu commented on a change in pull request #15619: Fix set character sql parser
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on a change in pull request #15619:
URL: https://github.com/apache/shardingsphere/pull/15619#discussion_r814406924
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
##########
@@ -974,13 +974,15 @@ private VariableAssignSegment getVariableAssign(final OptionValueContext ctx) {
@Override
public ASTNode visitSetCharacter(final SetCharacterContext ctx) {
- MySQLSetStatement result = new MySQLSetStatement();
+ final MySQLSetStatement result = new MySQLSetStatement();
Review comment:
@soulasuna Please remove final modifier here.
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLDALStatementSQLVisitor.java
##########
@@ -77,8 +77,17 @@ public ASTNode visitSet(final SetContext ctx) {
variableAssignSegment.getVariable().setScope(ctx.runtimeScope().getText());
}
variableAssigns.add(variableAssignSegment);
- result.getVariableAssigns().addAll(variableAssigns);
}
+ if (null != ctx.encoding()) {
+ VariableAssignSegment variableAssignSegment = new VariableAssignSegment();
+ VariableSegment variableSegment = new VariableSegment();
+ variableSegment.setVariable("charset");
+ variableAssignSegment.setVariable(variableSegment);
+ String value = ctx.encoding().getText();
+ variableAssignSegment.setAssignValue(value);
+ variableAssigns.add(variableAssignSegment);
+ }
+ result.getVariableAssigns().addAll(variableAssigns);
Review comment:
@soulasuna Can you add some sql parse test case for this logic?
--
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 #15619: Fix set character sql parser
Posted by GitBox <gi...@apache.org>.
soulasuna commented on a change in pull request #15619:
URL: https://github.com/apache/shardingsphere/pull/15619#discussion_r814421087
##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/java/org/apache/shardingsphere/sql/parser/mysql/visitor/statement/impl/MySQLDALStatementSQLVisitor.java
##########
@@ -974,13 +974,15 @@ private VariableAssignSegment getVariableAssign(final OptionValueContext ctx) {
@Override
public ASTNode visitSetCharacter(final SetCharacterContext ctx) {
- MySQLSetStatement result = new MySQLSetStatement();
+ final MySQLSetStatement result = new MySQLSetStatement();
Review comment:
This final for `<module name="VariableDeclarationUsageDistance"/>` in `checkstyle_ci.xml` can not removed.
--
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 edited a comment on pull request #15619: Fix set character sql parser
Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #15619:
URL: https://github.com/apache/shardingsphere/pull/15619#issuecomment-1050149023
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/15619?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 [#15619](https://codecov.io/gh/apache/shardingsphere/pull/15619?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (1c2c003) into [master](https://codecov.io/gh/apache/shardingsphere/commit/de97faeb4f898f9e144ddd3cb589cfe9e24bed24?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (de97fae) will **increase** coverage by `0.00%`.
> The diff coverage is `56.25%`.
> :exclamation: Current head 1c2c003 differs from pull request most recent head 0bbdf5c. Consider uploading reports for the commit 0bbdf5c to get more accurate results
[](https://codecov.io/gh/apache/shardingsphere/pull/15619?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 #15619 +/- ##
=========================================
Coverage 60.42% 60.42%
Complexity 1763 1763
=========================================
Files 3242 3242
Lines 48823 48837 +14
Branches 8345 8347 +2
=========================================
+ Hits 29502 29511 +9
- Misses 16897 16902 +5
Partials 2424 2424
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/15619?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [.../db/protocol/mysql/constant/MySQLCharacterSet.java](https://codecov.io/gh/apache/shardingsphere/pull/15619/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-c2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wvc2hhcmRpbmdzcGhlcmUtZGItcHJvdG9jb2wtbXlzcWwvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RiL3Byb3RvY29sL215c3FsL2NvbnN0YW50L015U1FMQ2hhcmFjdGVyU2V0LmphdmE=) | `98.02% <0.00%> (-0.98%)` | :arrow_down: |
| [...or/statement/impl/MySQLDALStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/15619/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1teXNxbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9teXNxbC92aXNpdG9yL3N0YXRlbWVudC9pbXBsL015U1FMREFMU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `83.21% <0.00%> (-0.39%)` | :arrow_down: |
| [...atement/impl/PostgreSQLDALStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/15619/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1wb3N0Z3Jlc3FsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zcWwvcGFyc2VyL3Bvc3RncmVzcWwvdmlzaXRvci9zdGF0ZW1lbnQvaW1wbC9Qb3N0Z3JlU1FMREFMU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `68.18% <100.00%> (+4.38%)` | :arrow_up: |
| [...he/shardingsphere/infra/hint/SQLHintExtractor.java](https://codecov.io/gh/apache/shardingsphere/pull/15619/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-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtY29tbW9uL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9oaW50L1NRTEhpbnRFeHRyYWN0b3IuamF2YQ==) | `91.66% <0.00%> (+0.75%)` | :arrow_up: |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/15619?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/15619?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 [de97fae...0bbdf5c](https://codecov.io/gh/apache/shardingsphere/pull/15619?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
[GitHub] [shardingsphere] strongduanmu merged pull request #15619: Fix set character sql parser
Posted by GitBox <gi...@apache.org>.
strongduanmu merged pull request #15619:
URL: https://github.com/apache/shardingsphere/pull/15619
--
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