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: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to