This is an automated email from the ASF dual-hosted git repository.
zhangliang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/shardingsphere.git
The following commit(s) were added to refs/heads/master by this push:
new 4b9a2950fa4 Add SQL parser test cases for MySQL (#37838)
4b9a2950fa4 is described below
commit 4b9a2950fa4e3bc827392153d2eaa9e830c00cdb
Author: Liang Zhang <[email protected]>
AuthorDate: Sun Jan 25 20:46:58 2026 +0800
Add SQL parser test cases for MySQL (#37838)
---
.../cases/parser/jaxb/RootSQLParserTestCases.java | 4 +++
.../case/{tcl/unlock.xml => dal/restart.xml} | 5 +--
.../src/main/resources/case/ddl/alter-table.xml | 36 ++++++++++++++++++++++
.../parser/src/main/resources/case/tcl/unlock.xml | 1 +
.../unlock.xml => sql/supported/dal/restart.xml} | 9 ++----
.../resources/sql/supported/ddl/alter-table.xml | 4 +++
.../src/main/resources/sql/supported/lcl/lock.xml | 1 +
7 files changed, 50 insertions(+), 10 deletions(-)
diff --git
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
index 757f0334f61..3eadd7ab9bb 100644
---
a/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
+++
b/test/it/parser/src/main/java/org/apache/shardingsphere/test/it/sql/parser/internal/cases/parser/jaxb/RootSQLParserTestCases.java
@@ -42,6 +42,7 @@ import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.s
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.mysql.MySQLKillStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.mysql.MySQLResetPersistStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.mysql.MySQLResetStatementTestCase;
+import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.mysql.MySQLRestartStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.mysql.MySQLShutdownStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.mysql.MySQLUseStatementTestCase;
import
org.apache.shardingsphere.test.it.sql.parser.internal.cases.parser.jaxb.statement.dal.dialect.mysql.component.MySQLInstallComponentStatementTestCase;
@@ -1305,6 +1306,9 @@ public final class RootSQLParserTestCases {
@XmlElement(name = "kill")
private final List<MySQLKillStatementTestCase> killTestCases = new
LinkedList<>();
+ @XmlElement(name = "restart")
+ private final List<MySQLRestartStatementTestCase> restartTestCases = new
LinkedList<>();
+
@XmlElement(name = "shutdown")
private final List<MySQLShutdownStatementTestCase> shutdownTestCases = new
LinkedList<>();
diff --git a/test/it/parser/src/main/resources/case/tcl/unlock.xml
b/test/it/parser/src/main/resources/case/dal/restart.xml
similarity index 83%
copy from test/it/parser/src/main/resources/case/tcl/unlock.xml
copy to test/it/parser/src/main/resources/case/dal/restart.xml
index ec049885d62..11f6165d2d3 100644
--- a/test/it/parser/src/main/resources/case/tcl/unlock.xml
+++ b/test/it/parser/src/main/resources/case/dal/restart.xml
@@ -17,8 +17,5 @@
-->
<sql-parser-test-cases>
- <unlock sql-case-id="unlock_table" />
- <unlock sql-case-id="unlock_tables" />
- <unlock sql-case-id="unlock_instance" />
- <unlock sql-case-id="unlock_tables_doris" />
+ <restart sql-case-id="restart_server_mysql" />
</sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/case/ddl/alter-table.xml
b/test/it/parser/src/main/resources/case/ddl/alter-table.xml
index ba6a9279eb5..f50d4e144df 100644
--- a/test/it/parser/src/main/resources/case/ddl/alter-table.xml
+++ b/test/it/parser/src/main/resources/case/ddl/alter-table.xml
@@ -2636,6 +2636,42 @@
</rename-index>
</alter-table>
+ <alter-table sql-case-id="alter_table_with_algorithm_default_mysql">
+ <table name="t_order" start-index="12" stop-index="18" />
+ <add-column>
+ <column-definition type="INT" start-index="31" stop-index="45">
+ <column name="col_alg_def" start-index="31" stop-index="41" />
+ </column-definition>
+ </add-column>
+ </alter-table>
+
+ <alter-table sql-case-id="alter_table_with_algorithm_instant_mysql">
+ <table name="t_order" start-index="12" stop-index="18" />
+ <add-column>
+ <column-definition type="INT" start-index="31" stop-index="49">
+ <column name="col_alg_instant" start-index="31"
stop-index="45" />
+ </column-definition>
+ </add-column>
+ </alter-table>
+
+ <alter-table sql-case-id="alter_table_with_lock_none_mysql">
+ <table name="t_order" start-index="12" stop-index="18" />
+ <add-column>
+ <column-definition type="INT" start-index="31" stop-index="47">
+ <column name="col_lock_none" start-index="31" stop-index="43"
/>
+ </column-definition>
+ </add-column>
+ </alter-table>
+
+ <alter-table sql-case-id="alter_table_with_lock_default_mysql">
+ <table name="t_order" start-index="12" stop-index="18" />
+ <add-column>
+ <column-definition type="INT" start-index="31" stop-index="50">
+ <column name="col_lock_default" start-index="31"
stop-index="46" />
+ </column-definition>
+ </add-column>
+ </alter-table>
+
<alter-table sql-case-id="alter_table_drop_column_doris">
<table name="t_order" start-index="12" stop-index="18" />
<drop-column name="old_col" start-index="32" stop-index="38" />
diff --git a/test/it/parser/src/main/resources/case/tcl/unlock.xml
b/test/it/parser/src/main/resources/case/tcl/unlock.xml
index ec049885d62..f674f7f352f 100644
--- a/test/it/parser/src/main/resources/case/tcl/unlock.xml
+++ b/test/it/parser/src/main/resources/case/tcl/unlock.xml
@@ -21,4 +21,5 @@
<unlock sql-case-id="unlock_tables" />
<unlock sql-case-id="unlock_instance" />
<unlock sql-case-id="unlock_tables_doris" />
+ <unlock sql-case-id="unlock_tables_mysql" />
</sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/case/tcl/unlock.xml
b/test/it/parser/src/main/resources/sql/supported/dal/restart.xml
similarity index 79%
copy from test/it/parser/src/main/resources/case/tcl/unlock.xml
copy to test/it/parser/src/main/resources/sql/supported/dal/restart.xml
index ec049885d62..8cb0afc68c6 100644
--- a/test/it/parser/src/main/resources/case/tcl/unlock.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dal/restart.xml
@@ -16,9 +16,6 @@
~ limitations under the License.
-->
-<sql-parser-test-cases>
- <unlock sql-case-id="unlock_table" />
- <unlock sql-case-id="unlock_tables" />
- <unlock sql-case-id="unlock_instance" />
- <unlock sql-case-id="unlock_tables_doris" />
-</sql-parser-test-cases>
+<sql-cases>
+ <sql-case id="restart_server_mysql" value="RESTART" db-types="MySQL" />
+</sql-cases>
diff --git
a/test/it/parser/src/main/resources/sql/supported/ddl/alter-table.xml
b/test/it/parser/src/main/resources/sql/supported/ddl/alter-table.xml
index b3b9020af7c..5bcb69492c5 100644
--- a/test/it/parser/src/main/resources/sql/supported/ddl/alter-table.xml
+++ b/test/it/parser/src/main/resources/sql/supported/ddl/alter-table.xml
@@ -390,6 +390,10 @@
<sql-case id="alter_table_with_algorithm_inplace_doris" value="ALTER TABLE
t_order ADD COLUMN col_alg_inplace INT, ALGORITHM=INPLACE" db-types="Doris" />
<sql-case id="alter_table_with_algorithm_copy_doris" value="ALTER TABLE
t_order ADD COLUMN col_alg_copy INT, ALGORITHM=COPY" db-types="Doris" />
<sql-case id="alter_table_with_lock_default_doris" value="ALTER TABLE
t_order ADD COLUMN col_lock_default INT, LOCK=DEFAULT" db-types="Doris" />
+ <sql-case id="alter_table_with_algorithm_default_mysql" value="ALTER TABLE
t_order ADD COLUMN col_alg_def INT, ALGORITHM=DEFAULT" db-types="MySQL" />
+ <sql-case id="alter_table_with_algorithm_instant_mysql" value="ALTER TABLE
t_order ADD COLUMN col_alg_instant INT, ALGORITHM=INSTANT" db-types="MySQL" />
+ <sql-case id="alter_table_with_lock_none_mysql" value="ALTER TABLE t_order
ADD COLUMN col_lock_none INT, LOCK=NONE" db-types="MySQL" />
+ <sql-case id="alter_table_with_lock_default_mysql" value="ALTER TABLE
t_order ADD COLUMN col_lock_default INT, LOCK=DEFAULT" db-types="MySQL" />
<sql-case id="alter_table_with_lock_shared_doris" value="ALTER TABLE
t_order ADD COLUMN col_lock_shared INT, LOCK=SHARED" db-types="Doris" />
<sql-case id="alter_table_with_lock_exclusive_doris" value="ALTER TABLE
t_order ADD COLUMN col_lock_exclusive INT, LOCK=EXCLUSIVE" db-types="Doris" />
</sql-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/lcl/lock.xml
b/test/it/parser/src/main/resources/sql/supported/lcl/lock.xml
index 473095965dc..812b2999754 100644
--- a/test/it/parser/src/main/resources/sql/supported/lcl/lock.xml
+++ b/test/it/parser/src/main/resources/sql/supported/lcl/lock.xml
@@ -32,6 +32,7 @@
<sql-case id="lock_table" value="LOCK TABLE fast_emp4000;"
db-types="PostgreSQL" />
<sql-case id="lock_table_access_exclusive" value="LOCK TABLE lock_tbl1 *
IN ACCESS EXCLUSIVE MODE;" db-types="PostgreSQL" />
<sql-case id="unlock_tables_doris" value="UNLOCK TABLES" db-types="Doris"
/>
+ <sql-case id="unlock_tables_mysql" value="UNLOCK TABLES" db-types="MySQL"
/>
<sql-case id="lock_table_access_exclusive_nowait" value="LOCK TABLE
lock_tbl1 IN ACCESS EXCLUSIVE MODE NOWAIT;" db-types="PostgreSQL" />
<sql-case id="lock_table_access_share_nowait" value="LOCK TABLE lock_tbl1
IN ACCESS SHARE MODE NOWAIT;" db-types="PostgreSQL" />
<sql-case id="lock_table_access_share" value="LOCK TABLE lock_tbl1 IN
ACCESS SHARE MODE;" db-types="PostgreSQL" />