tuichenchuxin opened a new issue #14110: URL: https://github.com/apache/shardingsphere/issues/14110
Hi community, This issue is to proofread the SQL definitions of MySQL. Therefore, we can support parsing more SQLs. We need your interaction! If you >Be familiar with g4 file of Antlr (The grammars are RegularExpression-like) Understand the MySQL grammars then welcome! ### Background #### How is a SQL parsed? `SQL definition file` ->(Parse to) `AST` ->(Visit it) `SQLStatment` ### Process Compare SQL definitions in [Oficial SQL Doc](https://dev.mysql.com/doc/refman/8.0/en/sql-statements.htmll) and [ShardingSphere SQL Doc](https://github.com/apache/shardingsphere/tree/master/shardingsphere-sql-parser/shardingsphere-sql-parser-dialect/shardingsphere-sql-parser-mysql/src/main/antlr4/imports/mysql) If there is any difference in ShardingSphere SQL Doc, please correct them referring to Official SQL Doc You can also refer to [MySQL source code](https://github.com/mysql/mysql-server/blob/8.0/sql/sql_yacc.yy) Run mvn install the current_file_module Check whether there are any exceptions. If indeed, please fix them. (Especially xxxVisitor.class) Add new corresponding SQL case in [SQL Cases](https://github.com/apache/shardingsphere/tree/master/shardingsphere-test/shardingsphere-parser-test/src/main/resources/sql/supported) and expected parsed result in[ Expected Statment XML](https://github.com/apache/shardingsphere/tree/master/shardingsphere-test/shardingsphere-parser-test/src/main/resources/case) Run [SQLParserParameterizedTest](https://github.com/apache/shardingsphere/blob/master/shardingsphere-test/shardingsphere-parser-test/src/main/java/org/apache/shardingsphere/test/sql/parser/parameterized/engine/SQLParserParameterizedTest.java) to make sure no exceptions. ### Notice - Left recursion can not work well in Antlr4, ``` a : b | a b ; b : a c ; c : ... ; ``` - you can consider the following one, ``` a : b* ; b : a c ; c : ... ; ``` [Here](https://shimo.im/docs/WrgrCt9JR3JDjq8H/read) is a Chinese version for reference. ### subtask - [ ] [ALTER DATABASE Statement](https://dev.mysql.com/doc/refman/8.0/en/alter-database.html) - [ ] [ALTER EVENT Statement](https://dev.mysql.com/doc/refman/8.0/en/alter-event.html) - [ ] [ALTER FUNCTION Statement](https://dev.mysql.com/doc/refman/8.0/en/alter-function.html) - [ ] [ALTER INSTANCE Statement](https://dev.mysql.com/doc/refman/8.0/en/alter-instance.html) - [ ] [ALTER LOGFILE GROUP Statement](https://dev.mysql.com/doc/refman/8.0/en/alter-logfile-group.html) - [ ] [ALTER PROCEDURE Statement](https://dev.mysql.com/doc/refman/8.0/en/alter-procedure.html) - [ ] [ALTER SERVER Statement](https://dev.mysql.com/doc/refman/8.0/en/alter-server.html) - [ ] [ALTER TABLE Statement](https://dev.mysql.com/doc/refman/8.0/en/alter-table.html) - [ ] [ALTER TABLESPACE Statement](https://dev.mysql.com/doc/refman/8.0/en/alter-tablespace.html) - [ ] [ALTER VIEW Statement](https://dev.mysql.com/doc/refman/8.0/en/alter-view.html) - [ ] [CREATE DATABASE Statement](https://dev.mysql.com/doc/refman/8.0/en/create-database.html) - [ ] [CREATE EVENT Statement](https://dev.mysql.com/doc/refman/8.0/en/create-event.html) - [ ] [CREATE FUNCTION Statement](https://dev.mysql.com/doc/refman/8.0/en/create-function.html) - [ ] [CREATE INDEX Statement](https://dev.mysql.com/doc/refman/8.0/en/create-index.html) - [ ] [CREATE LOGFILE GROUP Statement](https://dev.mysql.com/doc/refman/8.0/en/create-logfile-group.html) - [ ] [CREATE PROCEDURE and CREATE FUNCTION Statements](https://dev.mysql.com/doc/refman/8.0/en/create-procedure.html) - [ ] [CREATE SERVER Statement](https://dev.mysql.com/doc/refman/8.0/en/create-server.html) - [ ] [CREATE SPATIAL REFERENCE SYSTEM Statement](https://dev.mysql.com/doc/refman/8.0/en/create-spatial-reference-system.html) - [ ] [CREATE TABLE Statement](https://dev.mysql.com/doc/refman/8.0/en/create-table.html) - [ ] [CREATE TABLESPACE Statement](https://dev.mysql.com/doc/refman/8.0/en/create-tablespace.html) - [ ] [CREATE TRIGGER Statement](https://dev.mysql.com/doc/refman/8.0/en/create-trigger.html) - [ ] [CREATE VIEW Statement](https://dev.mysql.com/doc/refman/8.0/en/create-view.html) - [ ] [DROP DATABASE Statement](https://dev.mysql.com/doc/refman/8.0/en/drop-database.html) - [ ] [DROP EVENT Statement](https://dev.mysql.com/doc/refman/8.0/en/drop-event.html) - [ ] [DROP FUNCTION Statement](https://dev.mysql.com/doc/refman/8.0/en/drop-function.html) - [ ] [DROP INDEX Statement](https://dev.mysql.com/doc/refman/8.0/en/drop-index.html) - [ ] [DROP LOGFILE GROUP Statement](https://dev.mysql.com/doc/refman/8.0/en/drop-logfile-group.html) - [ ] [DROP PROCEDURE and DROP FUNCTION Statements](https://dev.mysql.com/doc/refman/8.0/en/drop-procedure.html) - [ ] [DROP SERVER Statement](https://dev.mysql.com/doc/refman/8.0/en/drop-server.html) - [ ] [DROP SPATIAL REFERENCE SYSTEM Statement](https://dev.mysql.com/doc/refman/8.0/en/drop-spatial-reference-system.html) - [ ] [DROP TABLE Statement](https://dev.mysql.com/doc/refman/8.0/en/drop-table.html) - [ ] [DROP TABLESPACE Statement](https://dev.mysql.com/doc/refman/8.0/en/drop-tablespace.html) - [ ] [DROP TRIGGER Statement](https://dev.mysql.com/doc/refman/8.0/en/drop-trigger.html) - [ ] [DROP VIEW Statement](https://dev.mysql.com/doc/refman/8.0/en/drop-view.html) - [ ] [RENAME TABLE Statement](https://dev.mysql.com/doc/refman/8.0/en/rename-table.html) - [ ] [TRUNCATE TABLE Statement](https://dev.mysql.com/doc/refman/8.0/en/truncate-table.html) - [ ] [CALL Statement](https://dev.mysql.com/doc/refman/8.0/en/call.html) - [ ] [DELETE Statement](https://dev.mysql.com/doc/refman/8.0/en/delete.html) - [ ] [DO Statement](https://dev.mysql.com/doc/refman/8.0/en/do.html) - [ ] [HANDLER Statement](https://dev.mysql.com/doc/refman/8.0/en/handler.html) - [ ] [IMPORT TABLE Statement](https://dev.mysql.com/doc/refman/8.0/en/import-table.html) - [ ] [INSERT Statement](https://dev.mysql.com/doc/refman/8.0/en/insert.html) - [ ] [LOAD DATA Statement](https://dev.mysql.com/doc/refman/8.0/en/load-data.html) - [ ] [LOAD XML Statement](https://dev.mysql.com/doc/refman/8.0/en/load-xml.html) - [ ] [REPLACE Statement](https://dev.mysql.com/doc/refman/8.0/en/replace.html) - [ ] [SELECT Statement](https://dev.mysql.com/doc/refman/8.0/en/select.html) - [ ] [Subqueries](https://dev.mysql.com/doc/refman/8.0/en/subqueries.html) - [ ] [TABLE Statement](https://dev.mysql.com/doc/refman/8.0/en/table.html) - [ ] [UPDATE Statement](https://dev.mysql.com/doc/refman/8.0/en/update.html) - [ ] [VALUES Statement](https://dev.mysql.com/doc/refman/8.0/en/values.html) - [ ] [WITH (Common Table Expressions)](https://dev.mysql.com/doc/refman/8.0/en/with.html) - [ ] [START TRANSACTION, COMMIT, and ROLLBACK Statements](https://dev.mysql.com/doc/refman/8.0/en/commit.html) - [ ] [Statements That Cannot Be Rolled Back](https://dev.mysql.com/doc/refman/8.0/en/cannot-roll-back.html) - [ ] [Statements That Cause an Implicit Commit](https://dev.mysql.com/doc/refman/8.0/en/implicit-commit.html) - [ ] [SAVEPOINT, ROLLBACK TO SAVEPOINT, and RELEASE SAVEPOINT Statements](https://dev.mysql.com/doc/refman/8.0/en/savepoint.html) - [ ] [LOCK INSTANCE FOR BACKUP and UNLOCK INSTANCE Statements](https://dev.mysql.com/doc/refman/8.0/en/lock-instance-for-backup.html) - [ ] [LOCK TABLES and UNLOCK TABLES Statements](https://dev.mysql.com/doc/refman/8.0/en/lock-tables.html) - [ ] [SET TRANSACTION Statement](https://dev.mysql.com/doc/refman/8.0/en/set-transaction.html) - [ ] [XA Transactions](https://dev.mysql.com/doc/refman/8.0/en/xa.html) - [ ] [SQL Statements for Controlling Source Servers](https://dev.mysql.com/doc/refman/8.0/en/replication-statements-master.html) - [ ] [SQL Statements for Controlling Replica Servers](https://dev.mysql.com/doc/refman/8.0/en/replication-statements-replica.html) - [ ] [SQL Statements for Controlling Group Replication](https://dev.mysql.com/doc/refman/8.0/en/replication-statements-group.html) - [ ] [PREPARE Statement](https://dev.mysql.com/doc/refman/8.0/en/prepare.html) - [ ] [EXECUTE Statement](https://dev.mysql.com/doc/refman/8.0/en/execute.html) - [ ] [DEALLOCATE PREPARE Statement](https://dev.mysql.com/doc/refman/8.0/en/deallocate-prepare.html) - [ ] [BEGIN ... END Compound Statement](https://dev.mysql.com/doc/refman/8.0/en/begin-end.html) - [ ] [Statement Labels](https://dev.mysql.com/doc/refman/8.0/en/statement-labels.html) - [ ] [DECLARE Statement](https://dev.mysql.com/doc/refman/8.0/en/declare.html) - [ ] [Variables in Stored Programs](https://dev.mysql.com/doc/refman/8.0/en/stored-program-variables.html) - [ ] [Flow Control Statements](https://dev.mysql.com/doc/refman/8.0/en/flow-control-statements.html) - [ ] [Cursors](https://dev.mysql.com/doc/refman/8.0/en/cursors.html) - [ ] [Condition Handling](https://dev.mysql.com/doc/refman/8.0/en/condition-handling.html) - [ ] [Restrictions on Condition Handling](https://dev.mysql.com/doc/refman/8.0/en/condition-handling-restrictions.html) - [ ] [Account Management Statements](https://dev.mysql.com/doc/refman/8.0/en/account-management-statements.html) - [ ] [Resource Group Management Statements](https://dev.mysql.com/doc/refman/8.0/en/resource-group-statements.html) - [ ] [Table Maintenance Statements](https://dev.mysql.com/doc/refman/8.0/en/table-maintenance-statements.html) - [ ] [Component, Plugin, and Loadable Function Statements](https://dev.mysql.com/doc/refman/8.0/en/component-statements.html) - [ ] [CLONE Statement](https://dev.mysql.com/doc/refman/8.0/en/clone.html) - [ ] [SET Statements](https://dev.mysql.com/doc/refman/8.0/en/set-statement.html) - [ ] [SHOW Statements](https://dev.mysql.com/doc/refman/8.0/en/show.html) - [ ] [Other Administrative Statements](https://dev.mysql.com/doc/refman/8.0/en/other-administrative-statements.html) - [ ] [DESCRIBE Statement](https://dev.mysql.com/doc/refman/8.0/en/describe.html) - [ ] [EXPLAIN Statement](https://dev.mysql.com/doc/refman/8.0/en/explain.html) - [ ] [HELP Statement](https://dev.mysql.com/doc/refman/8.0/en/help.html) - [ ] [USE Statement](https://dev.mysql.com/doc/refman/8.0/en/use.html) -- 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]
