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 cba4767eacd Add more test cases on Hive SQL parser (#37686)
cba4767eacd is described below
commit cba4767eacd65a16e57093adf7c785f6d2ca1ddb
Author: Haoran Meng <[email protected]>
AuthorDate: Fri Jan 9 12:32:40 2026 +0800
Add more test cases on Hive SQL parser (#37686)
---
.../src/main/resources/case/dal/dal-hive.xml | 42 ++++++++++++
.../src/main/resources/case/ddl/hive-ddl.xml | 80 ++++++++++++++++++++++
.../main/resources/sql/supported/dal/dal-hive.xml | 24 +++++++
.../main/resources/sql/supported/ddl/hive-ddl.xml | 34 +++++++++
4 files changed, 180 insertions(+)
diff --git a/test/it/parser/src/main/resources/case/dal/dal-hive.xml
b/test/it/parser/src/main/resources/case/dal/dal-hive.xml
new file mode 100644
index 00000000000..f31821f02c9
--- /dev/null
+++ b/test/it/parser/src/main/resources/case/dal/dal-hive.xml
@@ -0,0 +1,42 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<sql-parser-test-cases>
+ <use sql-case-id="hive_use_db">
+ <database name="test_db" start-index="3" stop-index="9" />
+ </use>
+
+ <use sql-case-id="hive_use_default">
+ <database name="default" start-index="3" stop-index="9" />
+ </use>
+
+ <show-databases sql-case-id="hive_show_databases">
+ <filter start-index="15" stop-index="26">
+ <like pattern="test*" start-delimiter="'" end-delimiter="'"
start-index="15" stop-index="26" />
+ </filter>
+ </show-databases>
+
+ <show-tables sql-case-id="hive_show_tables">
+ <from start-index="15" stop-index="21">
+ <database name="test_db" start-index="15" stop-index="21" />
+ </from>
+ <filter start-index="23" stop-index="27">
+ <like pattern="t_*" start-delimiter="'" end-delimiter="'"
start-index="23" stop-index="27" />
+ </filter>
+ </show-tables>
+</sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/case/ddl/hive-ddl.xml
b/test/it/parser/src/main/resources/case/ddl/hive-ddl.xml
new file mode 100644
index 00000000000..908bdb80f7f
--- /dev/null
+++ b/test/it/parser/src/main/resources/case/ddl/hive-ddl.xml
@@ -0,0 +1,80 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<sql-parser-test-cases>
+ <!-- Database -->
+ <create-database sql-case-id="hive_create_database">
+ <database-name name="test_db" start-index="29" stop-index="35" />
+ <if-not-exists start-index="16" stop-index="28" />
+ </create-database>
+
+ <drop-database sql-case-id="hive_drop_database">
+ <database-name name="test_db" start-index="24" stop-index="30" />
+ <if-exists start-index="14" stop-index="22" />
+ </drop-database>
+
+ <!-- Table -->
+ <create-table sql-case-id="hive_create_table_simple">
+ <table name="t_order" start-index="27" stop-index="33" />
+ <column-definition type="INT" start-index="36" stop-index="41">
+ <column name="id" />
+ </column-definition>
+ <column-definition type="STRING" start-index="44" stop-index="54">
+ <column name="name" />
+ </column-definition>
+ </create-table>
+
+ <create-table sql-case-id="hive_create_table_partitioned">
+ <table name="t_log" start-index="13" stop-index="17" />
+ <column-definition type="INT" start-index="20" stop-index="25">
+ <column name="id" />
+ </column-definition>
+ </create-table>
+
+ <drop-table sql-case-id="hive_drop_table">
+ <table name="t_order" start-index="21" stop-index="27" />
+ <if-exists start-index="11" stop-index="19" />
+ </drop-table>
+
+ <truncate sql-case-id="hive_truncate_table">
+ <table name="t_order" start-index="15" stop-index="21" />
+ </truncate>
+
+ <alter-table sql-case-id="hive_msck_repair">
+ <table name="t_order" start-index="18" stop-index="24" />
+ </alter-table>
+
+ <!-- View -->
+ <create-view sql-case-id="hive_create_view" view-definition="CREATE VIEW
v_order AS SELECT * FROM t_order">
+ <view name="v_order" start-index="12" stop-index="18" />
+ <select>
+ <projections start-index="30" stop-index="30">
+ <shorthand-projection start-index="30" stop-index="30" />
+ </projections>
+ <from>
+ <simple-table name="t_order" start-index="37" stop-index="43"
/>
+ </from>
+ </select>
+ </create-view>
+
+ <drop-view sql-case-id="hive_drop_view">
+ <view name="v_order" start-index="20" stop-index="26" />
+ <if-exists start-index="10" stop-index="18" />
+ </drop-view>
+
+</sql-parser-test-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/dal/dal-hive.xml
b/test/it/parser/src/main/resources/sql/supported/dal/dal-hive.xml
new file mode 100644
index 00000000000..ff5e2e29393
--- /dev/null
+++ b/test/it/parser/src/main/resources/sql/supported/dal/dal-hive.xml
@@ -0,0 +1,24 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<sql-cases>
+ <sql-case id="hive_use_db" value="USE test_db" db-types="Hive" />
+ <sql-case id="hive_use_default" value="USE DEFAULT" db-types="Hive" />
+ <sql-case id="hive_show_databases" value="SHOW DATABASES LIKE 'test*'"
db-types="Hive" />
+ <sql-case id="hive_show_tables" value="SHOW TABLES IN test_db 't_*'"
db-types="Hive" />
+</sql-cases>
diff --git a/test/it/parser/src/main/resources/sql/supported/ddl/hive-ddl.xml
b/test/it/parser/src/main/resources/sql/supported/ddl/hive-ddl.xml
new file mode 100644
index 00000000000..67ccc21daf9
--- /dev/null
+++ b/test/it/parser/src/main/resources/sql/supported/ddl/hive-ddl.xml
@@ -0,0 +1,34 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ ~ Licensed to the Apache Software Foundation (ASF) under one or more
+ ~ contributor license agreements. See the NOTICE file distributed with
+ ~ this work for additional information regarding copyright ownership.
+ ~ The ASF licenses this file to You under the Apache License, Version 2.0
+ ~ (the "License"); you may not use this file except in compliance with
+ ~ the License. You may obtain a copy of the License at
+ ~
+ ~ http://www.apache.org/licenses/LICENSE-2.0
+ ~
+ ~ Unless required by applicable law or agreed to in writing, software
+ ~ distributed under the License is distributed on an "AS IS" BASIS,
+ ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ ~ See the License for the specific language governing permissions and
+ ~ limitations under the License.
+ -->
+
+<sql-cases>
+ <!-- Database -->
+ <sql-case id="hive_create_database" value="CREATE DATABASE IF NOT EXISTS
test_db" db-types="Hive" />
+ <sql-case id="hive_drop_database" value="DROP DATABASE IF EXISTS test_db"
db-types="Hive" />
+
+ <!-- Table -->
+ <sql-case id="hive_create_table_simple" value="CREATE TABLE IF NOT EXISTS
t_order (id INT, name STRING)" db-types="Hive" />
+ <sql-case id="hive_create_table_partitioned" value="CREATE TABLE t_log (id
INT) PARTITIONED BY (dt STRING)" db-types="Hive" />
+ <sql-case id="hive_drop_table" value="DROP TABLE IF EXISTS t_order"
db-types="Hive" />
+ <sql-case id="hive_truncate_table" value="TRUNCATE TABLE t_order"
db-types="Hive" />
+ <sql-case id="hive_msck_repair" value="MSCK REPAIR TABLE t_order"
db-types="Hive" />
+
+ <!-- View -->
+ <sql-case id="hive_create_view" value="CREATE VIEW v_order AS SELECT *
FROM t_order" db-types="Hive" />
+ <sql-case id="hive_drop_view" value="DROP VIEW IF EXISTS v_order"
db-types="Hive" />
+</sql-cases>