Skip to content

Commit

Permalink
[FLINK-23995][hive] Fix bug of table name parser when using Hive dialect
Browse files Browse the repository at this point in the history
This closes apache#16999
  • Loading branch information
luoyuxia authored and beyond1920 committed Jun 28, 2022
1 parent 4a82df0 commit 42fc071
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -1151,7 +1151,8 @@ public boolean doPhase1(
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();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,14 @@ public void testInsert() throws Exception {
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
Expand Down

0 comments on commit 42fc071

Please sign in to comment.