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/04/11 13:02:27 UTC
[GitHub] [shardingsphere] tuichenchuxin opened a new pull request, #16744: support visit and route logic table in comment statement
tuichenchuxin opened a new pull request, #16744:
URL: https://github.com/apache/shardingsphere/pull/16744
Fixes #16548.
Changes proposed in this pull request:
- support visit logic table in comment segment
- support route comment statement
--
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] tuichenchuxin commented on a diff in pull request #16744: support visit and route logic table in comment statement
Posted by GitBox <gi...@apache.org>.
tuichenchuxin commented on code in PR #16744:
URL: https://github.com/apache/shardingsphere/pull/16744#discussion_r847924777
##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussDDLStatementSQLVisitor.java:
##########
@@ -747,7 +750,35 @@ public ASTNode visitDeclare(final DeclareContext ctx) {
}
@Override
+ @SuppressWarnings("unchecked")
public ASTNode visitComment(final CommentContext ctx) {
- return new OpenGaussCommentStatement();
+ OpenGaussCommentStatement result = new OpenGaussCommentStatement();
+ if (null != ctx.commentClauses().objectTypeAnyName() && null != ctx.commentClauses().objectTypeAnyName().TABLE()) {
+ LinkedList<NameSegment> nameSegments = (LinkedList<NameSegment>) ((CollectionValue<NameSegment>) visit(ctx.commentClauses().anyName())).getValue();
+ findTableName(nameSegments).ifPresent(result::setTable);
+ } else if (null != ctx.commentClauses().COLUMN()) {
+ LinkedList<NameSegment> nameSegments = (LinkedList<NameSegment>) ((CollectionValue<NameSegment>) visit(ctx.commentClauses().anyName())).getValue();
+ nameSegments.pollLast();
+ findTableName(nameSegments).ifPresent(result::setTable);
+ }
+ return result;
+ }
+
+ private Optional<SimpleTableSegment> findTableName(final LinkedList<NameSegment> nameSegments) {
+ NameSegment tableName = nameSegments.pollLast();
+ if (tableName == null) {
Review Comment:
Thank you. Done.
--
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] tuichenchuxin commented on a diff in pull request #16744: support visit and route logic table in comment statement
Posted by GitBox <gi...@apache.org>.
tuichenchuxin commented on code in PR #16744:
URL: https://github.com/apache/shardingsphere/pull/16744#discussion_r847924423
##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussDDLStatementSQLVisitor.java:
##########
@@ -747,7 +750,35 @@ public ASTNode visitDeclare(final DeclareContext ctx) {
}
@Override
+ @SuppressWarnings("unchecked")
public ASTNode visitComment(final CommentContext ctx) {
- return new OpenGaussCommentStatement();
+ OpenGaussCommentStatement result = new OpenGaussCommentStatement();
+ if (null != ctx.commentClauses().objectTypeAnyName() && null != ctx.commentClauses().objectTypeAnyName().TABLE()) {
+ LinkedList<NameSegment> nameSegments = (LinkedList<NameSegment>) ((CollectionValue<NameSegment>) visit(ctx.commentClauses().anyName())).getValue();
Review Comment:
Thank you. Done.
--
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 #16744: support visit and route logic table in comment statement
Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on PR #16744:
URL: https://github.com/apache/shardingsphere/pull/16744#issuecomment-1095430188
# [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/16744?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 [#16744](https://codecov.io/gh/apache/shardingsphere/pull/16744?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (6537ad9) into [master](https://codecov.io/gh/apache/shardingsphere/commit/12191b4faa87e509bc78f9a74e1f6eb78667b944?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (12191b4) will **decrease** coverage by `0.02%`.
> The diff coverage is `48.52%`.
```diff
@@ Coverage Diff @@
## master #16744 +/- ##
============================================
- Coverage 60.60% 60.57% -0.03%
Complexity 2116 2116
============================================
Files 3392 3393 +1
Lines 50914 50980 +66
Branches 8724 8740 +16
============================================
+ Hits 30854 30882 +28
- Misses 17468 17499 +31
- Partials 2592 2599 +7
```
| [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/16744?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
|---|---|---|
| [...phere/infra/binder/SQLStatementContextFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/16744/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-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtYmluZGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9iaW5kZXIvU1FMU3RhdGVtZW50Q29udGV4dEZhY3RvcnkuamF2YQ==) | `7.50% <0.00%> (-0.20%)` | :arrow_down: |
| [.../binder/statement/ddl/CommentStatementContext.java](https://codecov.io/gh/apache/shardingsphere/pull/16744/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-c2hhcmRpbmdzcGhlcmUtaW5mcmEvc2hhcmRpbmdzcGhlcmUtaW5mcmEtYmluZGVyL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9pbmZyYS9iaW5kZXIvc3RhdGVtZW50L2RkbC9Db21tZW50U3RhdGVtZW50Q29udGV4dC5qYXZh) | `0.00% <0.00%> (ø)` | |
| [...ser/sql/common/statement/ddl/CommentStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/16744/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvY29tbW9uL3N0YXRlbWVudC9kZGwvQ29tbWVudFN0YXRlbWVudC5qYXZh) | `0.00% <ø> (ø)` | |
| [...t/statement/oracle/ddl/OracleCommentStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/16744/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvZGlhbGVjdC9zdGF0ZW1lbnQvb3JhY2xlL2RkbC9PcmFjbGVDb21tZW50U3RhdGVtZW50LmphdmE=) | `0.00% <ø> (ø)` | |
| [...r/statement/impl/OpenGaussStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/16744/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1vcGVuZ2F1c3Mvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NxbC9wYXJzZXIvb3BlbmdhdXNzL3Zpc2l0b3Ivc3RhdGVtZW50L2ltcGwvT3BlbkdhdXNzU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `86.37% <30.00%> (-1.02%)` | :arrow_down: |
| [...tatement/impl/OpenGaussDDLStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/16744/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1vcGVuZ2F1c3Mvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3NxbC9wYXJzZXIvb3BlbmdhdXNzL3Zpc2l0b3Ivc3RhdGVtZW50L2ltcGwvT3BlbkdhdXNzRERMU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `76.19% <42.85%> (-3.12%)` | :arrow_down: |
| [...atement/impl/PostgreSQLDDLStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/16744/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1wb3N0Z3Jlc3FsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zcWwvcGFyc2VyL3Bvc3RncmVzcWwvdmlzaXRvci9zdGF0ZW1lbnQvaW1wbC9Qb3N0Z3JlU1FMRERMU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `79.48% <61.90%> (-1.55%)` | :arrow_down: |
| [.../statement/impl/PostgreSQLStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/16744/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1wb3N0Z3Jlc3FsL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9zcWwvcGFyc2VyL3Bvc3RncmVzcWwvdmlzaXRvci9zdGF0ZW1lbnQvaW1wbC9Qb3N0Z3JlU1FMU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `89.01% <80.00%> (-0.17%)` | :arrow_down: |
| [...d/text/distsql/ral/common/hint/HintSourceType.java](https://codecov.io/gh/apache/shardingsphere/pull/16744/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-c2hhcmRpbmdzcGhlcmUtcHJveHkvc2hhcmRpbmdzcGhlcmUtcHJveHktYmFja2VuZC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvcHJveHkvYmFja2VuZC90ZXh0L2Rpc3RzcWwvcmFsL2NvbW1vbi9oaW50L0hpbnRTb3VyY2VUeXBlLmphdmE=) | `0.00% <0.00%> (-42.86%)` | :arrow_down: |
| [...phere/data/pipeline/api/PipelineJobAPIFactory.java](https://codecov.io/gh/apache/shardingsphere/pull/16744/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-c2hhcmRpbmdzcGhlcmUta2VybmVsL3NoYXJkaW5nc3BoZXJlLWRhdGEtcGlwZWxpbmUvc2hhcmRpbmdzcGhlcmUtZGF0YS1waXBlbGluZS1zcGkvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2RhdGEvcGlwZWxpbmUvYXBpL1BpcGVsaW5lSm9iQVBJRmFjdG9yeS5qYXZh) | `0.00% <0.00%> (ø)` | |
| ... and [1 more](https://codecov.io/gh/apache/shardingsphere/pull/16744/diff?src=pr&el=tree-more&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | |
------
[Continue to review full report at Codecov](https://codecov.io/gh/apache/shardingsphere/pull/16744?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/16744?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 [12191b4...6537ad9](https://codecov.io/gh/apache/shardingsphere/pull/16744?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 #16744: support visit and route logic table in comment statement
Posted by GitBox <gi...@apache.org>.
strongduanmu merged PR #16744:
URL: https://github.com/apache/shardingsphere/pull/16744
--
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 diff in pull request #16744: support visit and route logic table in comment statement
Posted by GitBox <gi...@apache.org>.
strongduanmu commented on code in PR #16744:
URL: https://github.com/apache/shardingsphere/pull/16744#discussion_r847837591
##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussDDLStatementSQLVisitor.java:
##########
@@ -747,7 +750,35 @@ public ASTNode visitDeclare(final DeclareContext ctx) {
}
@Override
+ @SuppressWarnings("unchecked")
public ASTNode visitComment(final CommentContext ctx) {
- return new OpenGaussCommentStatement();
+ OpenGaussCommentStatement result = new OpenGaussCommentStatement();
+ if (null != ctx.commentClauses().objectTypeAnyName() && null != ctx.commentClauses().objectTypeAnyName().TABLE()) {
+ LinkedList<NameSegment> nameSegments = (LinkedList<NameSegment>) ((CollectionValue<NameSegment>) visit(ctx.commentClauses().anyName())).getValue();
+ findTableName(nameSegments).ifPresent(result::setTable);
+ } else if (null != ctx.commentClauses().COLUMN()) {
+ LinkedList<NameSegment> nameSegments = (LinkedList<NameSegment>) ((CollectionValue<NameSegment>) visit(ctx.commentClauses().anyName())).getValue();
+ nameSegments.pollLast();
+ findTableName(nameSegments).ifPresent(result::setTable);
+ }
+ return result;
+ }
+
+ private Optional<SimpleTableSegment> findTableName(final LinkedList<NameSegment> nameSegments) {
+ NameSegment tableName = nameSegments.pollLast();
+ if (tableName == null) {
Review Comment:
Put null to the left condition.
##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-postgresql/src/main/java/org/apache/shardingsphere/sql/parser/postgresql/visitor/statement/impl/PostgreSQLDDLStatementSQLVisitor.java:
##########
@@ -884,8 +887,36 @@ public ASTNode visitDropType(final DropTypeContext ctx) {
}
@Override
+ @SuppressWarnings("unchecked")
public ASTNode visitComment(final CommentContext ctx) {
- return new PostgreSQLCommentStatement();
+ PostgreSQLCommentStatement result = new PostgreSQLCommentStatement();
+ if (null != ctx.commentClauses().objectTypeAnyName() && null != ctx.commentClauses().objectTypeAnyName().TABLE()) {
+ LinkedList<NameSegment> nameSegments = (LinkedList<NameSegment>) ((CollectionValue<NameSegment>) visit(ctx.commentClauses().anyName())).getValue();
Review Comment:
Please replace LinkedList with Collection.
##########
shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-opengauss/src/main/java/org/apache/shardingsphere/sql/parser/opengauss/visitor/statement/impl/OpenGaussDDLStatementSQLVisitor.java:
##########
@@ -747,7 +750,35 @@ public ASTNode visitDeclare(final DeclareContext ctx) {
}
@Override
+ @SuppressWarnings("unchecked")
public ASTNode visitComment(final CommentContext ctx) {
- return new OpenGaussCommentStatement();
+ OpenGaussCommentStatement result = new OpenGaussCommentStatement();
+ if (null != ctx.commentClauses().objectTypeAnyName() && null != ctx.commentClauses().objectTypeAnyName().TABLE()) {
+ LinkedList<NameSegment> nameSegments = (LinkedList<NameSegment>) ((CollectionValue<NameSegment>) visit(ctx.commentClauses().anyName())).getValue();
Review Comment:
Please replace LinkedList with Collection.
--
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