You are viewing a plain text version of this content. The canonical link for it is here.
Posted to notifications@shardingsphere.apache.org by "ccxxxyy (via GitHub)" <gi...@apache.org> on 2025/12/13 12:53:01 UTC
[PR] Support for the explain and do keywords in Stored Procedures [shardingsphere]
ccxxxyy opened a new pull request, #37376:
URL: https://github.com/apache/shardingsphere/pull/37376
Fixes https://github.com/apache/shardingsphere/issues/35088
Changes proposed in this pull request:
-
---
Before committing this PR, I'm sure that I have checked the following options:
- [x] My code follows the [code of conduct](https://shardingsphere.apache.org/community/en/involved/conduct/code/) of this project.
- [x] I have self-reviewed the commit code.
- [ ] I have (or in comment I request) added corresponding labels for the pull request.
- [x] 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.
- [ ] I have updated the Release Notes of the current development version. For more details, see [Update Release Note](https://shardingsphere.apache.org/community/en/involved/contribute/contributor/)
--
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] Support for the explain and do keywords in Stored Procedures [shardingsphere]
Posted by "ccxxxyy (via GitHub)" <gi...@apache.org>.
ccxxxyy commented on PR #37376:
URL: https://github.com/apache/shardingsphere/pull/37376#issuecomment-3652610808
@terrymanu Hi, I have made the revisions as requested. Hope that you could take a look at it when you have a moment.
--
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] Support for the explain and do keywords in Stored Procedures [shardingsphere]
Posted by "terrymanu (via GitHub)" <gi...@apache.org>.
terrymanu merged PR #37376:
URL: https://github.com/apache/shardingsphere/pull/37376
--
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] Support for the explain and do keywords in Stored Procedures [shardingsphere]
Posted by "Copilot (via GitHub)" <gi...@apache.org>.
Copilot commented on code in PR #37376:
URL: https://github.com/apache/shardingsphere/pull/37376#discussion_r2616714596
##########
parser/sql/engine/dialect/mysql/src/main/antlr4/imports/mysql/DDLStatement.g4:
##########
@@ -683,7 +683,7 @@ validStatement
| createView | prepare | executeStmt | commit | deallocate
| setVariable | beginStatement | declareStatement | flowControlStatement | cursorStatement | conditionHandlingStatement
| setStatement | showStatement | showCreateTable | startTransaction | rollback | commit | show
- | alterEvent | dropEvent) SEMI_?
+ | alterEvent | dropEvent| doStatement | EXPLAIN) SEMI_?
Review Comment:
Using the EXPLAIN keyword token directly instead of the 'explain' rule. Since DDLStatement imports DALStatement where the 'explain' rule is defined, you should reference 'explain' (the rule) instead of 'EXPLAIN' (the keyword token). The 'explain' rule properly handles DESC, DESCRIBE, EXPLAIN variants and their various forms. Change 'EXPLAIN' to 'explain' for proper parsing.
```suggestion
| alterEvent | dropEvent| doStatement | explain) SEMI_?
```
##########
parser/sql/engine/dialect/mysql/src/main/antlr4/imports/mysql/DDLStatement.g4:
##########
@@ -683,7 +683,7 @@ validStatement
| createView | prepare | executeStmt | commit | deallocate
| setVariable | beginStatement | declareStatement | flowControlStatement | cursorStatement | conditionHandlingStatement
| setStatement | showStatement | showCreateTable | startTransaction | rollback | commit | show
- | alterEvent | dropEvent) SEMI_?
+ | alterEvent | dropEvent| doStatement | EXPLAIN) SEMI_?
Review Comment:
Missing space after 'dropEvent'. There should be a space before the pipe separator for consistency with other alternatives in this rule. Change 'dropEvent|' to 'dropEvent |'.
```suggestion
| alterEvent | dropEvent | doStatement | EXPLAIN) SEMI_?
```
##########
test/it/parser/src/main/resources/case/ddl/create-procedure.xml:
##########
@@ -143,4 +143,6 @@
<sql-statement start-index="28" stop-index="40" statement-class-simple-name="MySQLDropEventStatement" />
</sql-statements>
</create-procedure>
+ <create-procedure sql-case-id="create_procedure_with_begin_explain" />
+ <create-procedure sql-case-id="create_procedure_with_begin_do" />
Review Comment:
The test case definition is missing assertions for the internal SQL statements. The procedure 'create_procedure_with_begin_do' contains a SELECT statement and a DO statement within the BEGIN...END block. Similar test cases in this file include sql-statement elements with start-index, stop-index, and statement-class-simple-name to verify proper parsing of internal statements. Add procedure-name and sql-statements elements to validate the parser correctly identifies the SELECT and DO statements.
##########
test/it/parser/src/main/resources/case/ddl/create-procedure.xml:
##########
@@ -143,4 +143,6 @@
<sql-statement start-index="28" stop-index="40" statement-class-simple-name="MySQLDropEventStatement" />
</sql-statements>
</create-procedure>
+ <create-procedure sql-case-id="create_procedure_with_begin_explain" />
Review Comment:
The test case definition is missing assertions for the internal SQL statements. The procedure 'create_procedure_with_begin_explain' contains two SELECT statements and one EXPLAIN statement within the BEGIN...END block. Similar test cases in this file (lines 67-145) include sql-statement elements with start-index, stop-index, and statement-class-simple-name to verify proper parsing of internal statements. Add procedure-name and sql-statements elements to validate the parser correctly identifies the SELECT and EXPLAIN statements.
--
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] Support for the explain and do keywords in Stored Procedures [shardingsphere]
Posted by "ccxxxyy (via GitHub)" <gi...@apache.org>.
ccxxxyy commented on PR #37376:
URL: https://github.com/apache/shardingsphere/pull/37376#issuecomment-3650480661
@terrymanu Hi, I've already made the revisions as requested. Hope that you can review it when you have some free time.
--
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