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 6c8f38113f3 Merge parser-sql-statement-hive and 
parser-sql-statement-mysql (#36228)
6c8f38113f3 is described below

commit 6c8f38113f35adcfe479147a272de80dfb718ca0
Author: Liang Zhang <zhangli...@apache.org>
AuthorDate: Sat Aug 9 23:29:32 2025 +0800

    Merge parser-sql-statement-hive and parser-sql-statement-mysql (#36228)
    
    * Merge parser-sql-statement-hive and parser-sql-statement-mysql
    
    * Merge parser-sql-statement-hive and parser-sql-statement-mysql
---
 parser/sql/dialect/hive/pom.xml                    |  2 +-
 .../statement/type/HiveDALStatementVisitor.java    |  4 +-
 .../statement/type/HiveDMLStatementVisitor.java    |  8 ++--
 parser/sql/statement/type/hive/pom.xml             | 36 -----------------
 .../statement/hive/dal/HiveUseStatement.java       | 36 -----------------
 .../statement/hive/dml/HiveLoadDataStatement.java  | 45 ----------------------
 parser/sql/statement/type/pom.xml                  |  1 -
 .../src/main/resources/case/dal/use-database.xml   |  8 +++-
 .../resources/sql/supported/dal/use-database.xml   |  4 +-
 9 files changed, 15 insertions(+), 129 deletions(-)

diff --git a/parser/sql/dialect/hive/pom.xml b/parser/sql/dialect/hive/pom.xml
index f9f41a66c1d..40a8dff1544 100644
--- a/parser/sql/dialect/hive/pom.xml
+++ b/parser/sql/dialect/hive/pom.xml
@@ -38,7 +38,7 @@
         </dependency>
         <dependency>
             <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-parser-sql-statement-hive</artifactId>
+            <artifactId>shardingsphere-parser-sql-statement-mysql</artifactId>
             <version>${project.version}</version>
         </dependency>
         
diff --git 
a/parser/sql/dialect/hive/src/main/java/org/apache/shardingsphere/sql/parser/hive/visitor/statement/type/HiveDALStatementVisitor.java
 
b/parser/sql/dialect/hive/src/main/java/org/apache/shardingsphere/sql/parser/hive/visitor/statement/type/HiveDALStatementVisitor.java
index 6a451499f62..78f8f09af67 100644
--- 
a/parser/sql/dialect/hive/src/main/java/org/apache/shardingsphere/sql/parser/hive/visitor/statement/type/HiveDALStatementVisitor.java
+++ 
b/parser/sql/dialect/hive/src/main/java/org/apache/shardingsphere/sql/parser/hive/visitor/statement/type/HiveDALStatementVisitor.java
@@ -23,7 +23,7 @@ import 
org.apache.shardingsphere.sql.parser.api.visitor.statement.type.DALStatem
 import 
org.apache.shardingsphere.sql.parser.autogen.HiveStatementParser.UseContext;
 import 
org.apache.shardingsphere.sql.parser.hive.visitor.statement.HiveStatementVisitor;
 import 
org.apache.shardingsphere.sql.parser.statement.core.value.identifier.IdentifierValue;
-import 
org.apache.shardingsphere.sql.parser.statement.hive.dal.HiveUseStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.mysql.dal.MySQLUseStatement;
 
 /**
  * DAL statement visitor for Hive.
@@ -37,6 +37,6 @@ public final class HiveDALStatementVisitor extends 
HiveStatementVisitor implemen
     @Override
     public ASTNode visitUse(final UseContext ctx) {
         String database = null == ctx.DEFAULT() ? new 
IdentifierValue(ctx.identifier().getText()).getValue() : "default";
-        return new HiveUseStatement(getDatabaseType(), database);
+        return new MySQLUseStatement(getDatabaseType(), database);
     }
 }
diff --git 
a/parser/sql/dialect/hive/src/main/java/org/apache/shardingsphere/sql/parser/hive/visitor/statement/type/HiveDMLStatementVisitor.java
 
b/parser/sql/dialect/hive/src/main/java/org/apache/shardingsphere/sql/parser/hive/visitor/statement/type/HiveDMLStatementVisitor.java
index ee62be0320f..69a3d0343c4 100644
--- 
a/parser/sql/dialect/hive/src/main/java/org/apache/shardingsphere/sql/parser/hive/visitor/statement/type/HiveDMLStatementVisitor.java
+++ 
b/parser/sql/dialect/hive/src/main/java/org/apache/shardingsphere/sql/parser/hive/visitor/statement/type/HiveDMLStatementVisitor.java
@@ -66,6 +66,8 @@ import 
org.apache.shardingsphere.sql.parser.autogen.HiveStatementParser.JsonFunc
 import 
org.apache.shardingsphere.sql.parser.autogen.HiveStatementParser.LimitClauseContext;
 import 
org.apache.shardingsphere.sql.parser.autogen.HiveStatementParser.LimitOffsetContext;
 import 
org.apache.shardingsphere.sql.parser.autogen.HiveStatementParser.LimitRowCountContext;
+import 
org.apache.shardingsphere.sql.parser.autogen.HiveStatementParser.LoadDataStatementContext;
+import 
org.apache.shardingsphere.sql.parser.autogen.HiveStatementParser.LoadStatementContext;
 import 
org.apache.shardingsphere.sql.parser.autogen.HiveStatementParser.LockClauseContext;
 import 
org.apache.shardingsphere.sql.parser.autogen.HiveStatementParser.LockClauseListContext;
 import 
org.apache.shardingsphere.sql.parser.autogen.HiveStatementParser.MatchExpressionContext;
@@ -187,9 +189,7 @@ import 
org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.Nu
 import 
org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.OtherLiteralValue;
 import 
org.apache.shardingsphere.sql.parser.statement.core.value.literal.impl.StringLiteralValue;
 import 
org.apache.shardingsphere.sql.parser.statement.core.value.parametermarker.ParameterMarkerValue;
-import 
org.apache.shardingsphere.sql.parser.autogen.HiveStatementParser.LoadDataStatementContext;
-import 
org.apache.shardingsphere.sql.parser.autogen.HiveStatementParser.LoadStatementContext;
-import 
org.apache.shardingsphere.sql.parser.statement.hive.dml.HiveLoadDataStatement;
+import 
org.apache.shardingsphere.sql.parser.statement.mysql.dml.MySQLLoadDataStatement;
 
 import java.math.BigDecimal;
 import java.util.ArrayList;
@@ -1417,6 +1417,6 @@ public final class HiveDMLStatementVisitor extends 
HiveStatementVisitor implemen
     
     @Override
     public ASTNode visitLoadDataStatement(final LoadDataStatementContext ctx) {
-        return new HiveLoadDataStatement(getDatabaseType(), 
(SimpleTableSegment) visit(ctx.tableName()));
+        return new MySQLLoadDataStatement(getDatabaseType(), 
(SimpleTableSegment) visit(ctx.tableName()));
     }
 }
diff --git a/parser/sql/statement/type/hive/pom.xml 
b/parser/sql/statement/type/hive/pom.xml
deleted file mode 100644
index 814eb3b9783..00000000000
--- a/parser/sql/statement/type/hive/pom.xml
+++ /dev/null
@@ -1,36 +0,0 @@
-<?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.
-  -->
-
-<project xmlns="http://maven.apache.org/POM/4.0.0"; 
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"; 
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 
http://maven.apache.org/xsd/maven-4.0.0.xsd";>
-    <modelVersion>4.0.0</modelVersion>
-    <parent>
-        <groupId>org.apache.shardingsphere</groupId>
-        <artifactId>shardingsphere-parser-sql-statement-type</artifactId>
-        <version>5.5.3-SNAPSHOT</version>
-    </parent>
-    <artifactId>shardingsphere-parser-sql-statement-hive</artifactId>
-    <name>${project.artifactId}</name>
-    
-    <dependencies>
-        <dependency>
-            <groupId>org.apache.shardingsphere</groupId>
-            <artifactId>shardingsphere-parser-sql-statement-core</artifactId>
-            <version>${project.version}</version>
-        </dependency>
-    </dependencies>
-</project>
diff --git 
a/parser/sql/statement/type/hive/src/main/java/org/apache/shardingsphere/sql/parser/statement/hive/dal/HiveUseStatement.java
 
b/parser/sql/statement/type/hive/src/main/java/org/apache/shardingsphere/sql/parser/statement/hive/dal/HiveUseStatement.java
deleted file mode 100644
index 728812bd804..00000000000
--- 
a/parser/sql/statement/type/hive/src/main/java/org/apache/shardingsphere/sql/parser/statement/hive/dal/HiveUseStatement.java
+++ /dev/null
@@ -1,36 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.shardingsphere.sql.parser.statement.hive.dal;
-
-import lombok.Getter;
-import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
-import 
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dal.DALStatement;
-
-/**
- * Use database statement for Hive.
- */
-@Getter
-public final class HiveUseStatement extends DALStatement {
-    
-    private final String database;
-    
-    public HiveUseStatement(final DatabaseType databaseType, final String 
database) {
-        super(databaseType);
-        this.database = database;
-    }
-}
diff --git 
a/parser/sql/statement/type/hive/src/main/java/org/apache/shardingsphere/sql/parser/statement/hive/dml/HiveLoadDataStatement.java
 
b/parser/sql/statement/type/hive/src/main/java/org/apache/shardingsphere/sql/parser/statement/hive/dml/HiveLoadDataStatement.java
deleted file mode 100644
index 86c3d4e9083..00000000000
--- 
a/parser/sql/statement/type/hive/src/main/java/org/apache/shardingsphere/sql/parser/statement/hive/dml/HiveLoadDataStatement.java
+++ /dev/null
@@ -1,45 +0,0 @@
-/*
- * 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.
- */
-
-package org.apache.shardingsphere.sql.parser.statement.hive.dml;
-
-import lombok.Getter;
-
-import org.apache.shardingsphere.infra.database.core.type.DatabaseType;
-import 
org.apache.shardingsphere.sql.parser.statement.core.segment.generic.table.SimpleTableSegment;
-import 
org.apache.shardingsphere.sql.parser.statement.core.statement.attribute.SQLStatementAttributes;
-import 
org.apache.shardingsphere.sql.parser.statement.core.statement.attribute.type.TableSQLStatementAttribute;
-import 
org.apache.shardingsphere.sql.parser.statement.core.statement.type.dml.DMLStatement;
-
-/**
- * Load data statement for Hive.
- */
-@Getter
-public final class HiveLoadDataStatement extends DMLStatement {
-    
-    private final SimpleTableSegment table;
-    
-    public HiveLoadDataStatement(final DatabaseType databaseType, final 
SimpleTableSegment table) {
-        super(databaseType);
-        this.table = table;
-    }
-    
-    @Override
-    public SQLStatementAttributes getAttributes() {
-        return new SQLStatementAttributes(new 
TableSQLStatementAttribute(table));
-    }
-}
diff --git a/parser/sql/statement/type/pom.xml 
b/parser/sql/statement/type/pom.xml
index ee18e426080..2d12dd59ea9 100644
--- a/parser/sql/statement/type/pom.xml
+++ b/parser/sql/statement/type/pom.xml
@@ -32,6 +32,5 @@
         <module>mysql</module>
         <module>sqlserver</module>
         <module>oracle</module>
-        <module>hive</module>
     </modules>
 </project>
diff --git a/test/it/parser/src/main/resources/case/dal/use-database.xml 
b/test/it/parser/src/main/resources/case/dal/use-database.xml
index 5d507a6d57b..49972c7744e 100644
--- a/test/it/parser/src/main/resources/case/dal/use-database.xml
+++ b/test/it/parser/src/main/resources/case/dal/use-database.xml
@@ -17,6 +17,10 @@
   -->
 
 <sql-parser-test-cases>
-    <use sql-case-id="use_databasename_hive" />
-    <use sql-case-id="use_default_hive" />
+    <use sql-case-id="use_database">
+        <database name="test_db" />
+    </use>
+    <use sql-case-id="use_default">
+        <database name="default" />
+    </use>
 </sql-parser-test-cases>
diff --git 
a/test/it/parser/src/main/resources/sql/supported/dal/use-database.xml 
b/test/it/parser/src/main/resources/sql/supported/dal/use-database.xml
index 01938298345..ad1ceb336b1 100644
--- a/test/it/parser/src/main/resources/sql/supported/dal/use-database.xml
+++ b/test/it/parser/src/main/resources/sql/supported/dal/use-database.xml
@@ -17,6 +17,6 @@
   -->
 
 <sql-cases>
-    <sql-case id="use_databasename_hive" value="USE test_db;" db-types="Hive" 
/>
-    <sql-case id="use_default_hive" value="USE DEFAULT;" db-types="Hive" />
+    <sql-case id="use_database" value="USE test_db;" db-types="MySQL,Hive" />
+    <sql-case id="use_default" value="USE DEFAULT;" db-types="Hive" />
 </sql-cases>

Reply via email to