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 6c4ab10860c Support parsing Doris SHOW CREATE/DROP TABLE syntax 
(#38221)
6c4ab10860c is described below

commit 6c4ab10860c10f2759579bcbe52f30db46e39c75
Author: cxy <[email protected]>
AuthorDate: Fri Feb 27 13:08:58 2026 +0800

    Support parsing Doris SHOW CREATE/DROP TABLE syntax (#38221)
    
    * Support parsing Doris SHOW CREATE/DROP TABLE syntax
    
    * Fix SQL case value for show_brief_create_table_doris
    
    * Fix SQL case value by removing unnecessary semicolon
    
    Removed a semicolon from the SQL case value for 
'show_brief_create_table_doris'.
---
 .../dialect/doris/src/main/antlr4/imports/doris/BaseRule.g4    |  1 +
 .../doris/src/main/antlr4/imports/doris/DALStatement.g4        |  2 +-
 .../doris/src/main/antlr4/imports/doris/DDLStatement.g4        |  2 +-
 .../doris/src/main/antlr4/imports/doris/DorisKeyword.g4        |  4 ++++
 test/it/parser/src/main/resources/case/dal/show.xml            | 10 ++++++++++
 test/it/parser/src/main/resources/case/ddl/drop-table.xml      | 10 ++++++++++
 test/it/parser/src/main/resources/sql/supported/dal/show.xml   |  2 ++
 .../parser/src/main/resources/sql/supported/ddl/drop-table.xml |  2 ++
 8 files changed, 31 insertions(+), 2 deletions(-)

diff --git 
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/BaseRule.g4 
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/BaseRule.g4
index e18e719ee17..bbca59c68c6 100644
--- a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/BaseRule.g4
+++ b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/BaseRule.g4
@@ -160,6 +160,7 @@ identifierKeywordsUnambiguous
     | BLOCK
     | BOOLEAN
     | BOOL
+    | BRIEF
     | BTREE
     | BUCKETS
     | BUILTIN
diff --git 
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4 
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4
index 359ba5e5923..1ea447da784 100644
--- 
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4
+++ 
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DALStatement.g4
@@ -135,7 +135,7 @@ showCreateProcedure
     ;
 
 showCreateTable
-    : SHOW CREATE TABLE tableName
+    : SHOW BRIEF? CREATE TABLE tableName
     ;
 
 showCreateRoutineLoad
diff --git 
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DDLStatement.g4 
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DDLStatement.g4
index 8ba849b2d2c..1086a85f994 100644
--- 
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DDLStatement.g4
+++ 
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DDLStatement.g4
@@ -251,7 +251,7 @@ fulltextIndexOption
     ;
 
 dropTable
-    : DROP TEMPORARY? tableOrTables ifExists? tableList restrict?
+    : DROP TEMPORARY? tableOrTables ifExists? tableList (restrict | FORCE)?
     ;
 
 dropIndex
diff --git 
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DorisKeyword.g4 
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DorisKeyword.g4
index 9df598e58c6..b6264b0e149 100644
--- 
a/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DorisKeyword.g4
+++ 
b/parser/sql/engine/dialect/doris/src/main/antlr4/imports/doris/DorisKeyword.g4
@@ -205,6 +205,10 @@ BOTH
     : B O T H
     ;
 
+BRIEF
+    : B R I E F
+    ;
+
 BTREE
     : B T R E E
     ;
diff --git a/test/it/parser/src/main/resources/case/dal/show.xml 
b/test/it/parser/src/main/resources/case/dal/show.xml
index ad35acecd41..ffba3a52dd5 100644
--- a/test/it/parser/src/main/resources/case/dal/show.xml
+++ b/test/it/parser/src/main/resources/case/dal/show.xml
@@ -1228,4 +1228,14 @@
     <show-slave-hosts sql-case-id="show_slave_hosts_doris" />
     <show-replica-status sql-case-id="show_replica_status_doris" />
     <show-relay-log-events sql-case-id="show_relaylog_events_doris" />
+
+    <show-create-table sql-case-id="show_brief_create_table_doris">
+        <table name="test_table" start-index="24" stop-index="33" />
+    </show-create-table>
+
+    <show-create-table sql-case-id="show_brief_create_table_with_db_doris">
+        <table name="test_table" start-index="24" stop-index="38">
+            <owner name="demo" start-index="24" stop-index="27" />
+        </table>
+    </show-create-table>
 </sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/case/ddl/drop-table.xml 
b/test/it/parser/src/main/resources/case/ddl/drop-table.xml
index d34b2f46ab0..07f3119b0d1 100644
--- a/test/it/parser/src/main/resources/case/ddl/drop-table.xml
+++ b/test/it/parser/src/main/resources/case/ddl/drop-table.xml
@@ -120,6 +120,16 @@
         </table>
     </drop-table>
 
+    <drop-table sql-case-id="drop_table_force_doris">
+        <table name="my_table" start-index="11" stop-index="18" />
+    </drop-table>
+
+    <drop-table sql-case-id="drop_table_if_exists_force_doris">
+        <table name="my_table" start-index="21" stop-index="39">
+            <owner name="example_db" start-index="21" stop-index="30" />
+        </table>
+    </drop-table>
+
     <drop-table sql-case-id="drop_table_firebird">
         <table name="t_firebird_drop" start-index="11" stop-index="25" />
     </drop-table>
diff --git a/test/it/parser/src/main/resources/sql/supported/dal/show.xml 
b/test/it/parser/src/main/resources/sql/supported/dal/show.xml
index b9fc0f3c16f..8c975b40b0c 100644
--- a/test/it/parser/src/main/resources/sql/supported/dal/show.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dal/show.xml
@@ -273,4 +273,6 @@
     <sql-case id="show_all_routine_load" value="SHOW ALL ROUTINE LOAD" 
db-types="Doris" />
     <sql-case id="show_routine_load_for_job" value="SHOW ROUTINE LOAD FOR 
test1" db-types="Doris" />
     <sql-case id="show_all_routine_load_for_job_with_db" value="SHOW ALL 
ROUTINE LOAD FOR example_db.test1" db-types="Doris" />
+    <sql-case id="show_brief_create_table_doris" value="SHOW BRIEF CREATE 
TABLE test_table" db-types="Doris" />
+    <sql-case id="show_brief_create_table_with_db_doris" value="SHOW BRIEF 
CREATE TABLE demo.test_table" db-types="Doris" />
 </sql-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/ddl/drop-table.xml 
b/test/it/parser/src/main/resources/sql/supported/ddl/drop-table.xml
index 1a80d047d56..9973e73c442 100644
--- a/test/it/parser/src/main/resources/sql/supported/ddl/drop-table.xml
+++ b/test/it/parser/src/main/resources/sql/supported/ddl/drop-table.xml
@@ -41,6 +41,8 @@
     <sql-case id="drop_table_if_exists_hive_with_db" value="DROP TABLE IF 
EXISTS test_db.t_log" db-types="Hive" />
     <sql-case id="drop_table_purge_hive_with_db" value="DROP TABLE 
test_db.t_log PURGE" db-types="Hive" />
     <sql-case id="drop_table_if_exists_purge_hive_with_db" value="DROP TABLE 
IF EXISTS test_db.t_log PURGE" db-types="Hive" />
+    <sql-case id="drop_table_force_doris" value="DROP TABLE my_table FORCE" 
db-types="Doris" />
+    <sql-case id="drop_table_if_exists_force_doris" value="DROP TABLE IF 
EXISTS example_db.my_table FORCE" db-types="Doris" />
     <sql-case id="drop_table_firebird" value="DROP TABLE t_firebird_drop" 
db-types="Firebird"/>
     <sql-case id="drop_table_sql92" value="DROP TABLE t_drop" db-types="SQL92" 
/>
     <sql-case id="drop_multiple_tables_sql92" value="DROP TABLE t_drop_a, 
t_drop_b" db-types="SQL92" />

Reply via email to