You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by zs...@apache.org on 2008/12/09 03:17:45 UTC

svn commit: r724577 - in /hadoop/hive/trunk: ./ ql/src/java/org/apache/hadoop/hive/ql/parse/ ql/src/test/queries/clientnegative/ ql/src/test/results/clientnegative/

Author: zshao
Date: Mon Dec  8 18:17:44 2008
New Revision: 724577

URL: http://svn.apache.org/viewvc?rev=724577&view=rev
Log:
HIVE-92. Fixed union all for non-embedded query. (Namit Jain through zshao)

Added:
    hadoop/hive/trunk/ql/src/test/queries/clientnegative/union.q
    hadoop/hive/trunk/ql/src/test/results/clientnegative/union.q.out
Modified:
    hadoop/hive/trunk/CHANGES.txt
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ErrorMsg.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java

Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=724577&r1=724576&r2=724577&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Mon Dec  8 18:17:44 2008
@@ -33,6 +33,8 @@
 
   BUG FIXES
 
+    HIVE-92. Fixed union all for non-embedded query. (Namit Jain through zshao)
+
     HIVE-93. Dynamic serde to handle _-prefixed column names in DDL.
     (Pete Wyckoff through zshao)
 

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ErrorMsg.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ErrorMsg.java?rev=724577&r1=724576&r2=724577&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ErrorMsg.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/ErrorMsg.java Mon Dec  8 18:17:44 2008
@@ -65,6 +65,7 @@
   TABLE_ALIAS_NOT_ALLOWED("Table Alias not Allowed in Sampling Clause"),
   CLUSTERBY_DISTRIBUTEBY_CONFLICT("Cannot have both Cluster By and Distribute By Clauses"),
   CLUSTERBY_SORTBY_CONFLICT("Cannot have both Cluster By and Sort By Clauses"),
+  UNION_NOTIN_SUBQ("Top level Union is not supported currently; use a subquery for the union"),
   NON_BUCKETED_TABLE("Sampling Expression Needed for Non-Bucketed Table");
 
   private String mesg;

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java?rev=724577&r1=724576&r2=724577&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/SemanticAnalyzer.java Mon Dec  8 18:17:44 2008
@@ -409,6 +409,13 @@
           qbp.setDestLimit(ctx_1.dest, new Integer(ast.getChild(0).getText()));
         }
         break;
+
+      case HiveParser.TOK_UNION:
+        // currently, we dont support subq1 union subq2 - the user has to explicitly say: 
+        // select * from (subq1 union subq2) subqalias
+        if (!qbp.getIsSubQ())
+          throw new SemanticException(ErrorMsg.UNION_NOTIN_SUBQ.getMsg());
+
       default:
         skipRecursion = false;
         break;

Added: hadoop/hive/trunk/ql/src/test/queries/clientnegative/union.q
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/queries/clientnegative/union.q?rev=724577&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/queries/clientnegative/union.q (added)
+++ hadoop/hive/trunk/ql/src/test/queries/clientnegative/union.q Mon Dec  8 18:17:44 2008
@@ -0,0 +1,4 @@
+explain
+select s1.key as key, s1.value as value from src s1
+  UNION  ALL  
+select s2.key as key, s2.value as value from src s2;

Added: hadoop/hive/trunk/ql/src/test/results/clientnegative/union.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientnegative/union.q.out?rev=724577&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientnegative/union.q.out (added)
+++ hadoop/hive/trunk/ql/src/test/results/clientnegative/union.q.out Mon Dec  8 18:17:44 2008
@@ -0,0 +1 @@
+FAILED: Error in semantic analysis: Top level Union is not supported currently; use a subquery for the union