You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ji...@apache.org on 2022/06/28 10:20:14 UTC
[flink] branch master updated: [FLINK-23995][hive] Fix bug of table name parser when using Hive dialect
This is an automated email from the ASF dual-hosted git repository.
jingzhang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/flink.git
The following commit(s) were added to refs/heads/master by this push:
new 42fc0711e68 [FLINK-23995][hive] Fix bug of table name parser when using Hive dialect
42fc0711e68 is described below
commit 42fc0711e683a09e32865a69ef69cc9bcd09b8f1
Author: yuxia Luo <lu...@alibaba-inc.com>
AuthorDate: Thu Aug 26 19:59:08 2021 +0800
[FLINK-23995][hive] Fix bug of table name parser when using Hive dialect
This closes #16999
---
.../planner/delegation/hive/copy/HiveParserSemanticAnalyzer.java | 3 ++-
.../java/org/apache/flink/connectors/hive/HiveDialectITCase.java | 8 ++++++++
2 files changed, 10 insertions(+), 1 deletion(-)
diff --git a/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/copy/HiveParserSemanticAnalyzer.java b/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/copy/HiveParserSemanticAnalyzer.java
index 11ea60d6eaf..591421dde7e 100644
--- a/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/copy/HiveParserSemanticAnalyzer.java
+++ b/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/copy/HiveParserSemanticAnalyzer.java
@@ -1151,7 +1151,8 @@ public class HiveParserSemanticAnalyzer {
if (destination.getChildCount() == 2
&& tab.getChildCount() == 2
&& destination.getChild(1).getType() == HiveASTParser.TOK_IFNOTEXISTS) {
- String name = tab.getChild(0).getChild(0).getText();
+ String name =
+ getUnescapedName((HiveParserASTNode) tab.getChild(0)).toLowerCase();
Tree partitions = tab.getChild(1);
int numChildren = partitions.getChildCount();
diff --git a/flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectITCase.java b/flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectITCase.java
index 9ca1dcc9eb8..babdd750b9d 100644
--- a/flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectITCase.java
+++ b/flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectITCase.java
@@ -350,6 +350,14 @@ public class HiveDialectITCase {
assertThat(results.toString())
.isEqualTo(
"[+I[1, 0, static], +I[1, 1, a], +I[1, 2, b], +I[1, 3, c], +I[2, 0, static], +I[2, 1, b], +I[3, 0, static], +I[3, 1, c]]");
+ tableEnv.executeSql(
+ "insert overwrite table default.dest2 partition (p1=1,p2='static') if not exists select x from src")
+ .await();
+ results = queryResult(tableEnv.sqlQuery("select * from dest2 order by x,p1,p2"));
+ assertThat(results.toString())
+ .isEqualTo(
+ "[+I[1, 0, static], +I[1, 1, a], +I[1, 1, static], +I[1, 2, b], +I[1, 3, c], +I[2, 0, static],"
+ + " +I[2, 1, b], +I[2, 1, static], +I[3, 0, static], +I[3, 1, c], +I[3, 1, static]]");
}
@Test