You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@flink.apache.org by ja...@apache.org on 2022/08/16 13:01:15 UTC

[flink] branch master updated: [FLINK-27386][hive] Fix assert exception when specific join hint in union statement (#19583)

This is an automated email from the ASF dual-hosted git repository.

jark 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 24ac1215883 [FLINK-27386][hive] Fix assert exception when specific join hint in union statement (#19583)
24ac1215883 is described below

commit 24ac1215883a5121e2f714277c56eaa8152c7e9b
Author: yuxia Luo <lu...@alumni.sjtu.edu.cn>
AuthorDate: Tue Aug 16 21:01:03 2022 +0800

    [FLINK-27386][hive] Fix assert exception when specific join hint in union statement (#19583)
---
 .../flink/table/planner/delegation/hive/copy/HiveASTParseUtils.java   | 3 +++
 .../java/org/apache/flink/connectors/hive/HiveDialectQueryITCase.java | 4 +++-
 2 files changed, 6 insertions(+), 1 deletion(-)

diff --git a/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/copy/HiveASTParseUtils.java b/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/copy/HiveASTParseUtils.java
index 688c4d7e12a..b0f298a5740 100644
--- a/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/copy/HiveASTParseUtils.java
+++ b/flink-connectors/flink-connector-hive/src/main/java/org/apache/flink/table/planner/delegation/hive/copy/HiveASTParseUtils.java
@@ -179,6 +179,9 @@ public class HiveASTParseUtils {
         HashSet<String> aliases = new HashSet<>();
         for (int i = 0; i < select.getChildCount(); ++i) {
             Tree selExpr = select.getChild(i);
+            if (selExpr.getType() == HiveASTParser.QUERY_HINT) {
+                continue;
+            }
             assert selExpr.getType() == HiveASTParser.TOK_SELEXPR;
             assert selExpr.getChildCount() > 0;
             // Examine the last child. It could be an alias.
diff --git a/flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectQueryITCase.java b/flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectQueryITCase.java
index a27920475e3..6ccd3b0ff86 100644
--- a/flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectQueryITCase.java
+++ b/flink-connectors/flink-connector-hive/src/test/java/org/apache/flink/connectors/hive/HiveDialectQueryITCase.java
@@ -172,7 +172,9 @@ public class HiveDialectQueryITCase {
                                 "select salary,sum(cnt) over (order by salary)/sum(cnt) over "
                                         + "(order by salary ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED FOLLOWING) from"
                                         + " (select salary,count(*) as cnt from employee group by salary) a",
-                                "select a, one from binary_t lateral view explode(ab) abs as one where a > 0"));
+                                "select a, one from binary_t lateral view explode(ab) abs as one where a > 0",
+                                "select /*+ mapjoin(dest) */ foo.x from foo join dest on foo.x = dest.x union"
+                                        + " all select /*+ mapjoin(dest) */ foo.x from foo join dest on foo.y = dest.y"));
         if (HiveVersionTestUtil.HIVE_230_OR_LATER) {
             toRun.add(
                     "select weekofyear(current_timestamp()), dayofweek(current_timestamp()) from src limit 1");