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 2021/07/21 04:18:55 UTC

[GitHub] [shardingsphere] tuichenchuxin opened a new pull request #11426: union mysql parser support

tuichenchuxin opened a new pull request #11426:
URL: https://github.com/apache/shardingsphere/pull/11426


   Fixes #11386 .
   
   Changes proposed in this pull request:
   - support mysql union parser
   - add test case
   


-- 
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 #11426: union mysql parser support

Posted by GitBox <gi...@apache.org>.
codecov-commenter commented on pull request #11426:
URL: https://github.com/apache/shardingsphere/pull/11426#issuecomment-883926078


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/11426?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 [#11426](https://codecov.io/gh/apache/shardingsphere/pull/11426?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (f611440) into [master](https://codecov.io/gh/apache/shardingsphere/commit/58c0a675e26e6c1434f7c69aa7a49315d5a46ae8?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (58c0a67) will **decrease** coverage by `0.22%`.
   > The diff coverage is `22.91%`.
   
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/11426/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/shardingsphere/pull/11426?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   #11426      +/-   ##
   ============================================
   - Coverage     63.54%   63.32%   -0.23%     
   - Complexity     1061     1091      +30     
   ============================================
     Files          2223     2223              
     Lines         33825    33883      +58     
     Branches       5902     5907       +5     
   ============================================
   - Hits          21495    21456      -39     
   - Misses        10616    10706      +90     
   - Partials       1714     1721       +7     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/11426?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...here/sql/parser/sql/common/constant/UnionType.java](https://codecov.io/gh/apache/shardingsphere/pull/11426/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvY29tbW9uL2NvbnN0YW50L1VuaW9uVHlwZS5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...ser/sql/common/segment/dml/union/UnionSegment.java](https://codecov.io/gh/apache/shardingsphere/pull/11426/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvY29tbW9uL3NlZ21lbnQvZG1sL3VuaW9uL1VuaW9uU2VnbWVudC5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...rser/sql/common/statement/dml/SelectStatement.java](https://codecov.io/gh/apache/shardingsphere/pull/11426/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvY29tbW9uL3N0YXRlbWVudC9kbWwvU2VsZWN0U3RhdGVtZW50LmphdmE=) | `57.14% <0.00%> (-9.53%)` | :arrow_down: |
   | [...ql/dialect/handler/dml/SelectStatementHandler.java](https://codecov.io/gh/apache/shardingsphere/pull/11426/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLXN0YXRlbWVudC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9zcWwvZGlhbGVjdC9oYW5kbGVyL2RtbC9TZWxlY3RTdGF0ZW1lbnRIYW5kbGVyLmphdmE=) | `55.55% <0.00%> (-6.95%)` | :arrow_down: |
   | [...erts/statement/dml/impl/SelectStatementAssert.java](https://codecov.io/gh/apache/shardingsphere/pull/11426/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-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvYXNzZXJ0cy9zdGF0ZW1lbnQvZG1sL2ltcGwvU2VsZWN0U3RhdGVtZW50QXNzZXJ0LmphdmE=) | `0.00% <0.00%> (ø)` | |
   | [...sitor/statement/impl/MySQLStatementSQLVisitor.java](https://codecov.io/gh/apache/shardingsphere/pull/11426/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-c2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci9zaGFyZGluZ3NwaGVyZS1zcWwtcGFyc2VyLWRpYWxlY3Qvc2hhcmRpbmdzcGhlcmUtc3FsLXBhcnNlci1teXNxbC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvc3FsL3BhcnNlci9teXNxbC92aXNpdG9yL3N0YXRlbWVudC9pbXBsL015U1FMU3RhdGVtZW50U1FMVmlzaXRvci5qYXZh) | `79.50% <45.00%> (-0.91%)` | :arrow_down: |
   | [...cases/domain/segment/impl/union/ExpectedUnion.java](https://codecov.io/gh/apache/shardingsphere/pull/11426/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-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvamF4Yi9jYXNlcy9kb21haW4vc2VnbWVudC9pbXBsL3VuaW9uL0V4cGVjdGVkVW5pb24uamF2YQ==) | `100.00% <100.00%> (ø)` | |
   | [.../domain/statement/dml/SelectStatementTestCase.java](https://codecov.io/gh/apache/shardingsphere/pull/11426/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-c2hhcmRpbmdzcGhlcmUtdGVzdC9zaGFyZGluZ3NwaGVyZS1wYXJzZXItdGVzdC9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvdGVzdC9zcWwvcGFyc2VyL3BhcmFtZXRlcml6ZWQvamF4Yi9jYXNlcy9kb21haW4vc3RhdGVtZW50L2RtbC9TZWxlY3RTdGF0ZW1lbnRUZXN0Q2FzZS5qYXZh) | `100.00% <100.00%> (ø)` | |
   | [...phere/governance/core/registry/RegistryCenter.java](https://codecov.io/gh/apache/shardingsphere/pull/11426/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-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2dvdmVybmFuY2UvY29yZS9yZWdpc3RyeS9SZWdpc3RyeUNlbnRlci5qYXZh) | `0.00% <0.00%> (-88.24%)` | :arrow_down: |
   | [...onfig/subscriber/GlobalRuleRegistrySubscriber.java](https://codecov.io/gh/apache/shardingsphere/pull/11426/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-c2hhcmRpbmdzcGhlcmUtZ292ZXJuYW5jZS9zaGFyZGluZ3NwaGVyZS1nb3Zlcm5hbmNlLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2dvdmVybmFuY2UvY29yZS9yZWdpc3RyeS9jb25maWcvc3Vic2NyaWJlci9HbG9iYWxSdWxlUmVnaXN0cnlTdWJzY3JpYmVyLmphdmE=) | `0.00% <0.00%> (-33.34%)` | :arrow_down: |
   | ... and [46 more](https://codecov.io/gh/apache/shardingsphere/pull/11426/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/11426?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/11426?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 [58c0a67...f611440](https://codecov.io/gh/apache/shardingsphere/pull/11426?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] tuichenchuxin closed pull request #11426: union mysql parser support

Posted by GitBox <gi...@apache.org>.
tuichenchuxin closed pull request #11426:
URL: https://github.com/apache/shardingsphere/pull/11426


   


-- 
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 #11426: union mysql parser support

Posted by GitBox <gi...@apache.org>.
codecov-commenter edited a comment on pull request #11426:
URL: https://github.com/apache/shardingsphere/pull/11426#issuecomment-883926078


   # [Codecov](https://codecov.io/gh/apache/shardingsphere/pull/11426?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 [#11426](https://codecov.io/gh/apache/shardingsphere/pull/11426?src=pr&el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (ea419c0) into [master](https://codecov.io/gh/apache/shardingsphere/commit/58c0a675e26e6c1434f7c69aa7a49315d5a46ae8?el=desc&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) (58c0a67) will **decrease** coverage by `0.32%`.
   > The diff coverage is `48.75%`.
   
   > :exclamation: Current head ea419c0 differs from pull request most recent head 8c1eb9e. Consider uploading reports for the commit 8c1eb9e to get more accurate results
   [![Impacted file tree graph](https://codecov.io/gh/apache/shardingsphere/pull/11426/graphs/tree.svg?width=650&height=150&src=pr&token=ZvlXpWa7so&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation)](https://codecov.io/gh/apache/shardingsphere/pull/11426?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   #11426      +/-   ##
   ============================================
   - Coverage     63.54%   63.22%   -0.33%     
   - Complexity     1061     1091      +30     
   ============================================
     Files          2223     2224       +1     
     Lines         33825    34022     +197     
     Branches       5902     5928      +26     
   ============================================
   + Hits          21495    21509      +14     
   - Misses        10616    10785     +169     
   - Partials       1714     1728      +14     
   ```
   
   
   | [Impacted Files](https://codecov.io/gh/apache/shardingsphere/pull/11426?src=pr&el=tree&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=The+Apache+Software+Foundation) | Coverage Δ | |
   |---|---|---|
   | [...ere/agent/metrics/api/advice/DataSourceAdvice.java](https://codecov.io/gh/apache/shardingsphere/pull/11426/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-c2hhcmRpbmdzcGhlcmUtYWdlbnQvc2hhcmRpbmdzcGhlcmUtYWdlbnQtcGx1Z2lucy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1wbHVnaW4tbWV0cmljcy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1tZXRyaWNzLWFwaS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvbWV0cmljcy9hcGkvYWR2aWNlL0RhdGFTb3VyY2VBZHZpY2UuamF2YQ==) | `0.00% <0.00%> (-85.72%)` | :arrow_down: |
   | [...re/agent/metrics/api/reporter/MetricsReporter.java](https://codecov.io/gh/apache/shardingsphere/pull/11426/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-c2hhcmRpbmdzcGhlcmUtYWdlbnQvc2hhcmRpbmdzcGhlcmUtYWdlbnQtcGx1Z2lucy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1wbHVnaW4tbWV0cmljcy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1tZXRyaWNzLWFwaS9zcmMvbWFpbi9qYXZhL29yZy9hcGFjaGUvc2hhcmRpbmdzcGhlcmUvYWdlbnQvbWV0cmljcy9hcGkvcmVwb3J0ZXIvTWV0cmljc1JlcG9ydGVyLmphdmE=) | `52.17% <0.00%> (-2.38%)` | :arrow_down: |
   | [...etrics/prometheus/hikari/HikariMetricsTracker.java](https://codecov.io/gh/apache/shardingsphere/pull/11426/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-c2hhcmRpbmdzcGhlcmUtYWdlbnQvc2hhcmRpbmdzcGhlcmUtYWdlbnQtcGx1Z2lucy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1wbHVnaW4tbWV0cmljcy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1tZXRyaWNzLXByb21ldGhldXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2FnZW50L21ldHJpY3MvcHJvbWV0aGV1cy9oaWthcmkvSGlrYXJpTWV0cmljc1RyYWNrZXIuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...ics/prometheus/hikari/HikariPoolStatCollector.java](https://codecov.io/gh/apache/shardingsphere/pull/11426/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-c2hhcmRpbmdzcGhlcmUtYWdlbnQvc2hhcmRpbmdzcGhlcmUtYWdlbnQtcGx1Z2lucy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1wbHVnaW4tbWV0cmljcy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1tZXRyaWNzLXByb21ldGhldXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2FnZW50L21ldHJpY3MvcHJvbWV0aGV1cy9oaWthcmkvSGlrYXJpUG9vbFN0YXRDb2xsZWN0b3IuamF2YQ==) | `0.00% <0.00%> (ø)` | |
   | [...metrics/prometheus/hikari/HikariSimpleMetrics.java](https://codecov.io/gh/apache/shardingsphere/pull/11426/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-c2hhcmRpbmdzcGhlcmUtYWdlbnQvc2hhcmRpbmdzcGhlcmUtYWdlbnQtcGx1Z2lucy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1wbHVnaW4tbWV0cmljcy9zaGFyZGluZ3NwaGVyZS1hZ2VudC1tZXRyaWNzLXByb21ldGhldXMvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2FnZW50L21ldHJpY3MvcHJvbWV0aGV1cy9oaWthcmkvSGlrYXJpU2ltcGxlTWV0cmljcy5qYXZh) | `0.00% <0.00%> (ø)` | |
   | [...AlgorithmProvidedDatabaseDiscoveryRuleBuilder.java](https://codecov.io/gh/apache/shardingsphere/pull/11426/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtZGItZGlzY292ZXJ5L3NoYXJkaW5nc3BoZXJlLWRiLWRpc2NvdmVyeS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9kYmRpc2NvdmVyeS9ydWxlL2J1aWxkZXIvQWxnb3JpdGhtUHJvdmlkZWREYXRhYmFzZURpc2NvdmVyeVJ1bGVCdWlsZGVyLmphdmE=) | `100.00% <ø> (ø)` | |
   | [...ery/rule/builder/DatabaseDiscoveryRuleBuilder.java](https://codecov.io/gh/apache/shardingsphere/pull/11426/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtZGItZGlzY292ZXJ5L3NoYXJkaW5nc3BoZXJlLWRiLWRpc2NvdmVyeS1jb3JlL3NyYy9tYWluL2phdmEvb3JnL2FwYWNoZS9zaGFyZGluZ3NwaGVyZS9kYmRpc2NvdmVyeS9ydWxlL2J1aWxkZXIvRGF0YWJhc2VEaXNjb3ZlcnlSdWxlQnVpbGRlci5qYXZh) | `100.00% <ø> (ø)` | |
   | [...e/builder/AlgorithmProvidedEncryptRuleBuilder.java](https://codecov.io/gh/apache/shardingsphere/pull/11426/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtZW5jcnlwdC9zaGFyZGluZ3NwaGVyZS1lbmNyeXB0LWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2VuY3J5cHQvcnVsZS9idWlsZGVyL0FsZ29yaXRobVByb3ZpZGVkRW5jcnlwdFJ1bGVCdWlsZGVyLmphdmE=) | `100.00% <ø> (ø)` | |
   | [...phere/encrypt/rule/builder/EncryptRuleBuilder.java](https://codecov.io/gh/apache/shardingsphere/pull/11426/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtZW5jcnlwdC9zaGFyZGluZ3NwaGVyZS1lbmNyeXB0LWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL2VuY3J5cHQvcnVsZS9idWlsZGVyL0VuY3J5cHRSdWxlQnVpbGRlci5qYXZh) | `100.00% <ø> (ø)` | |
   | [...lgorithmProvidedReadwriteSplittingRuleBuilder.java](https://codecov.io/gh/apache/shardingsphere/pull/11426/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-c2hhcmRpbmdzcGhlcmUtZmVhdHVyZXMvc2hhcmRpbmdzcGhlcmUtcmVhZHdyaXRlLXNwbGl0dGluZy9zaGFyZGluZ3NwaGVyZS1yZWFkd3JpdGUtc3BsaXR0aW5nLWNvcmUvc3JjL21haW4vamF2YS9vcmcvYXBhY2hlL3NoYXJkaW5nc3BoZXJlL3JlYWR3cml0ZXNwbGl0dGluZy9ydWxlL2J1aWxkZXIvQWxnb3JpdGhtUHJvdmlkZWRSZWFkd3JpdGVTcGxpdHRpbmdSdWxlQnVpbGRlci5qYXZh) | `100.00% <ø> (ø)` | |
   | ... and [59 more](https://codecov.io/gh/apache/shardingsphere/pull/11426/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/11426?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/11426?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 [58c0a67...8c1eb9e](https://codecov.io/gh/apache/shardingsphere/pull/11426?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 commented on a change in pull request #11426: union mysql parser support

Posted by GitBox <gi...@apache.org>.
strongduanmu commented on a change in pull request #11426:
URL: https://github.com/apache/shardingsphere/pull/11426#discussion_r673866068



##########
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/MySQLStatementSQLVisitor.java
##########
@@ -605,9 +608,36 @@ public ASTNode visitQueryExpressionBody(final QueryExpressionBodyContext ctx) {
         if (1 == ctx.getChildCount() && ctx.getChild(0) instanceof QueryPrimaryContext) {
             return visit(ctx.queryPrimary());
         }
-        throw new IllegalStateException("union select is not supported yet.");
+        if (ctx.queryExpressionBody() != null) {

Review comment:
       @tuichenchuxin `null != ctx.queryExpressionBody()` is better.

##########
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/MySQLStatementSQLVisitor.java
##########
@@ -605,9 +608,36 @@ public ASTNode visitQueryExpressionBody(final QueryExpressionBodyContext ctx) {
         if (1 == ctx.getChildCount() && ctx.getChild(0) instanceof QueryPrimaryContext) {
             return visit(ctx.queryPrimary());
         }
-        throw new IllegalStateException("union select is not supported yet.");
+        if (ctx.queryExpressionBody() != null) {
+            MySQLSelectStatement result = (MySQLSelectStatement) visit(ctx.queryExpressionBody());
+            ParserRuleContext ruleContext = ctx.queryPrimary() != null ? ctx.queryPrimary() : ctx.queryExpressionParens(0);
+            MySQLSelectStatement union = (MySQLSelectStatement) visit(ruleContext);
+            UnionSegment unionSegment = new UnionSegment(getUnionType(ctx), union, ctx.UNION().getSymbol().getStartIndex(), ruleContext.getStop().getStopIndex());
+            addUnionSegments(result, unionSegment);
+            return result;
+        }
+        MySQLSelectStatement result = (MySQLSelectStatement) visit(ctx.queryExpressionParens(0));

Review comment:
       This code block looks same with previous, please consider to extract with method.

##########
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/MySQLStatementSQLVisitor.java
##########
@@ -605,9 +608,36 @@ public ASTNode visitQueryExpressionBody(final QueryExpressionBodyContext ctx) {
         if (1 == ctx.getChildCount() && ctx.getChild(0) instanceof QueryPrimaryContext) {
             return visit(ctx.queryPrimary());
         }
-        throw new IllegalStateException("union select is not supported yet.");
+        if (ctx.queryExpressionBody() != null) {
+            MySQLSelectStatement result = (MySQLSelectStatement) visit(ctx.queryExpressionBody());
+            ParserRuleContext ruleContext = ctx.queryPrimary() != null ? ctx.queryPrimary() : ctx.queryExpressionParens(0);
+            MySQLSelectStatement union = (MySQLSelectStatement) visit(ruleContext);
+            UnionSegment unionSegment = new UnionSegment(getUnionType(ctx), union, ctx.UNION().getSymbol().getStartIndex(), ruleContext.getStop().getStopIndex());
+            addUnionSegments(result, unionSegment);
+            return result;
+        }
+        MySQLSelectStatement result = (MySQLSelectStatement) visit(ctx.queryExpressionParens(0));
+        ParserRuleContext ruleContext = ctx.queryPrimary() != null ? ctx.queryPrimary() : ctx.queryExpressionParens(1);
+        MySQLSelectStatement union = (MySQLSelectStatement) visit(ruleContext);
+        UnionSegment unionSegment = new UnionSegment(getUnionType(ctx), union, ctx.UNION().getSymbol().getStartIndex(), ruleContext.getStop().getStopIndex());
+        addUnionSegments(result, unionSegment);

Review comment:
       Please init UnionSegments in MySQLSelectStatement.

##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/dialect/handler/dml/SelectStatementHandler.java
##########
@@ -113,4 +115,17 @@
         }
         return Optional.empty();
     }
+
+    /**
+     * Get union segment.
+     *
+     * @param selectStatement select statement
+     * @return union segment list
+     */
+    public static Optional<List<UnionSegment>> getUnionSegments(final SelectStatement selectStatement) {

Review comment:
       UnionSegment should be a common segment for different dialects.

##########
File path: shardingsphere-sql-parser/shardingsphere-sql-parser-statement/src/main/java/org/apache/shardingsphere/sql/parser/sql/common/statement/dml/SelectStatement.java
##########
@@ -52,6 +54,8 @@
     private OrderBySegment orderBy;
     
     private WithSegment withSegment;
+
+    private List<UnionSegment> unionSegments;

Review comment:
       `Collection<UnionSegment> unionSegments = new LinkedList()` is better.

##########
File path: shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/asserts/statement/dml/impl/SelectStatementAssert.java
##########
@@ -68,8 +72,9 @@ public static void assertIs(final SQLCaseAssertContext assertContext, final Sele
         assertTable(assertContext, actual, expected);
         assertLockClause(assertContext, actual, expected);
         assertWithClause(assertContext, actual, expected);
+        assertUnions(assertContext, actual, expected);
     }
-    

Review comment:
       Please keep indents consistent with the previous one.




-- 
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