You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "zihaoAK47 (via GitHub)" <gi...@apache.org> on 2023/11/10 09:31:05 UTC

[PR] Fix oracle select union sql parse [shardingsphere]

zihaoAK47 opened a new pull request, #29001:
URL: https://github.com/apache/shardingsphere/pull/29001

   Fixes #ISSUSE_ID.
   
   Changes proposed in this pull request:
     - The Oracle select SQL statement union was not parsed
     - Fix oracle select union sql parse
     - Add test sql
   
   ---
   
   Before committing this PR, I'm sure that I have checked the following options:
   - [ ✓] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
   - [ ✓] I have self-reviewed the commit code.
   - [ ] I have (or in comment I request) added corresponding labels for the pull request.
   - [ ✓] I have passed maven check locally : `./mvnw clean install -B -T1C -Dmaven.javadoc.skip -Dmaven.jacoco.skip -e`.
   - [ ] I have made corresponding changes to the documentation.
   - [ ✓] I have added corresponding unit tests for my changes.
   


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


Re: [PR] Fix oracle select union sql parse [shardingsphere]

Posted by "zihaoAK47 (via GitHub)" <gi...@apache.org>.
zihaoAK47 commented on PR #29001:
URL: https://github.com/apache/shardingsphere/pull/29001#issuecomment-1806769704

   > Hi @zihaoAK47, thank you for your contribution. Can you add some more test case for more than one union statement?
   
   Ok, I will add more SQL tests for this parsing


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


Re: [PR] Fix oracle select union sql parse [shardingsphere]

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on code in PR #29001:
URL: https://github.com/apache/shardingsphere/pull/29001#discussion_r1389291523


##########
parser/sql/dialect/oracle/src/main/java/org/apache/shardingsphere/sql/parser/oracle/visitor/statement/type/OracleDMLStatementVisitor.java:
##########
@@ -669,6 +669,23 @@ public ASTNode visitParenthesisSelectSubquery(final ParenthesisSelectSubqueryCon
         return visit(ctx.selectSubquery());
     }
     
+    private void setSelectCombineClause(final SelectCombineClauseContext ctx, final OracleSelectStatement result, final OracleSelectStatement left) {
+        for (int i = 0; i < ctx.selectSubquery().size(); i++) {
+            CombineType combineType;
+            if (null != ctx.UNION(i) && null != ctx.ALL(i)) {
+                combineType = CombineType.UNION_ALL;
+            } else if (null != ctx.UNION(i)) {
+                combineType = CombineType.UNION;
+            } else if (null != ctx.INTERSECT(i)) {
+                combineType = CombineType.INTERSECT;
+            } else {
+                combineType = CombineType.MINUS;
+            }
+            result.setCombine(new CombineSegment(ctx.getStart().getStartIndex(), ctx.getStop().getStopIndex(), left,

Review Comment:
   Why call setCombine in foreach? I think combine should be a multi-level nested structure.



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


Re: [PR] Fix oracle select union sql parse [shardingsphere]

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu merged PR #29001:
URL: https://github.com/apache/shardingsphere/pull/29001


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


Re: [PR] Fix oracle select union sql parse [shardingsphere]

Posted by "strongduanmu (via GitHub)" <gi...@apache.org>.
strongduanmu commented on PR #29001:
URL: https://github.com/apache/shardingsphere/pull/29001#issuecomment-1806593413

   Hi @zihaoAK47, thank you for your contribution. Can you add some more test case for more than one union 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