impala-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From he...@apache.org
Subject [2/7] incubator-impala git commit: IMPALA-1478: Improve error message when subquery is used in the ON clause
Date Tue, 15 Aug 2017 17:59:37 GMT
IMPALA-1478: Improve error message when subquery is used in the
             ON clause

Fix: Print the error stating that "Suquery not allowed in the ON clause"
     Add test case for testing the failure when a subquery is used in
     the ON clause.

Change-Id: I0d1dc47987de7ea04402e1ead31d81cddf2f96f2
Reviewed-on: http://gerrit.cloudera.org:8080/7588
Reviewed-by: Bharath Vissapragada <bharathv@cloudera.com>
Tested-by: Impala Public Jenkins


Project: http://git-wip-us.apache.org/repos/asf/incubator-impala/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-impala/commit/b9880cef
Tree: http://git-wip-us.apache.org/repos/asf/incubator-impala/tree/b9880cef
Diff: http://git-wip-us.apache.org/repos/asf/incubator-impala/diff/b9880cef

Branch: refs/heads/master
Commit: b9880cefbe97be2f5c7ed706a9b570c8b3234e34
Parents: dfb158b
Author: Pranay Singh <psingh@cloudera.com>
Authored: Fri Aug 4 10:42:08 2017 -0700
Committer: Impala Public Jenkins <impala-public-jenkins@gerrit.cloudera.org>
Committed: Tue Aug 15 04:27:36 2017 +0000

----------------------------------------------------------------------
 fe/src/main/java/org/apache/impala/analysis/TableRef.java       | 4 ++++
 .../test/java/org/apache/impala/analysis/AnalyzeStmtsTest.java  | 5 +++++
 2 files changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/b9880cef/fe/src/main/java/org/apache/impala/analysis/TableRef.java
----------------------------------------------------------------------
diff --git a/fe/src/main/java/org/apache/impala/analysis/TableRef.java b/fe/src/main/java/org/apache/impala/analysis/TableRef.java
index d5bb0fe..4dc9e34 100644
--- a/fe/src/main/java/org/apache/impala/analysis/TableRef.java
+++ b/fe/src/main/java/org/apache/impala/analysis/TableRef.java
@@ -530,6 +530,10 @@ public class TableRef implements ParseNode {
         throw new AnalysisException(
             "analytic expression not allowed in ON clause: " + toSql());
       }
+      if (onClause_.contains(Subquery.class)) {
+        throw new AnalysisException(
+            "Subquery is not allowed in ON clause: " + toSql());
+      }
       Set<TupleId> onClauseTupleIds = Sets.newHashSet();
       List<Expr> conjuncts = onClause_.getConjuncts();
       // Outer join clause conjuncts are registered for this particular table ref

http://git-wip-us.apache.org/repos/asf/incubator-impala/blob/b9880cef/fe/src/test/java/org/apache/impala/analysis/AnalyzeStmtsTest.java
----------------------------------------------------------------------
diff --git a/fe/src/test/java/org/apache/impala/analysis/AnalyzeStmtsTest.java b/fe/src/test/java/org/apache/impala/analysis/AnalyzeStmtsTest.java
index cff7563..b22ca81 100644
--- a/fe/src/test/java/org/apache/impala/analysis/AnalyzeStmtsTest.java
+++ b/fe/src/test/java/org/apache/impala/analysis/AnalyzeStmtsTest.java
@@ -1355,6 +1355,11 @@ public class AnalyzeStmtsTest extends AnalyzerTest {
         "join functional.alltypes b on (a.bigint_col = " +
         "lag(b.int_col) over(order by a.bigint_col))",
         "analytic expression not allowed in ON clause");
+    AnalysisError(
+        "select a.int_col from functional.alltypes a " +
+        "join functional.alltypes b on (a.id = b.id) and " +
+        "a.int_col < (select min(id) from functional.alltypes c)",
+        "Subquery is not allowed in ON clause");
     // unknown column
     AnalysisError(
         "select a.int_col from functional.alltypes a " +


Mime
View raw message