You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by na...@apache.org on 2009/04/15 23:38:13 UTC

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

Author: namit
Date: Wed Apr 15 21:38:12 2009
New Revision: 765376

URL: http://svn.apache.org/viewvc?rev=765376&view=rev
Log:
HIVE-415. Fix long query parsing problems. (Namit Jain via zshao)


Added:
    hadoop/hive/trunk/ql/src/test/queries/clientpositive/union16.q
    hadoop/hive/trunk/ql/src/test/results/clientpositive/union16.q.out
Modified:
    hadoop/hive/trunk/CHANGES.txt
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g
    hadoop/hive/trunk/ql/src/test/results/clientpositive/union10.q.out
    hadoop/hive/trunk/ql/src/test/results/clientpositive/union11.q.out
    hadoop/hive/trunk/ql/src/test/results/clientpositive/union12.q.out
    hadoop/hive/trunk/ql/src/test/results/clientpositive/union15.q.out
    hadoop/hive/trunk/ql/src/test/results/clientpositive/union3.q.out
    hadoop/hive/trunk/ql/src/test/results/clientpositive/union8.q.out
    hadoop/hive/trunk/ql/src/test/results/clientpositive/union9.q.out

Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=765376&r1=765375&r2=765376&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Wed Apr 15 21:38:12 2009
@@ -51,6 +51,8 @@
 
     HIVE-413. Fix multi-table insert. (Namit Jain via zshao)
 
+    HIVE-415. Fix long query parsing problems. (Namit Jain via zshao)
+
 Release 0.3.0 - Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g?rev=765376&r1=765375&r2=765376&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/parse/Hive.g Wed Apr 15 21:38:12 2009
@@ -511,7 +511,7 @@
 
 // select statement select ... from ... where ... group by ... order by ...
 queryStatementExpression
-    : queryStatement (queryOperator^ queryStatementExpression)*
+    : queryStatement (queryOperator^ queryStatement)*
     ;
 
 queryStatement

Added: hadoop/hive/trunk/ql/src/test/queries/clientpositive/union16.q
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/queries/clientpositive/union16.q?rev=765376&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/queries/clientpositive/union16.q (added)
+++ hadoop/hive/trunk/ql/src/test/queries/clientpositive/union16.q Wed Apr 15 21:38:12 2009
@@ -0,0 +1,63 @@
+EXPLAIN
+SELECT count(1) FROM (
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src) src;
+
+
+SELECT count(1) FROM (
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src UNION ALL
+  SELECT key, value FROM src) src;

Modified: hadoop/hive/trunk/ql/src/test/results/clientpositive/union10.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientpositive/union10.q.out?rev=765376&r1=765375&r2=765376&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientpositive/union10.q.out (original)
+++ hadoop/hive/trunk/ql/src/test/results/clientpositive/union10.q.out Wed Apr 15 21:38:12 2009
@@ -1,5 +1,5 @@
 ABSTRACT SYNTAX TREE:
-  (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF src s1)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 'tst1' key) (TOK_SELEXPR (TOK_FUNCTION count 1) value)))) (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF src s2)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 'tst2' key) (TOK_SELEXPR (TOK_FUNCTION count 1) value)))) (TOK_QUERY (TOK_FROM (TOK_TABREF src s3)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 'tst3' key) (TOK_SELEXPR (TOK_FUNCTION count 1) value)))))) unionsrc)) (TOK_INSERT (TOK_DESTINATION (TOK_TAB tmptable)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF unionsrc key)) (TOK_SELEXPR (TOK_COLREF unionsrc value)))))
+  (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF src s1)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 'tst1' key) (TOK_SELEXPR (TOK_FUNCTION count 1) value)))) (TOK_QUERY (TOK_FROM (TOK_TABREF src s2)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 'tst2' key) (TOK_SELEXPR (TOK_FUNCTION count 1) value))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src s3)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 'tst3' key) (TOK_SELEXPR (TOK_FUNCTION count 1) value))))) unionsrc)) (TOK_INSERT (TOK_DESTINATION (TOK_TAB tmptable)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF unionsrc key)) (TOK_SELEXPR (TOK_COLREF unionsrc value)))))
 
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -16,7 +16,7 @@
   Stage: Stage-1
     Map Reduce
       Alias -> Map Operator Tree:
-        null-subquery2-subquery1:unionsrc-subquery2-subquery1:s2 
+        null-subquery1-subquery1:unionsrc-subquery1-subquery1:s1 
             Select Operator
               Group By Operator
                 aggregations:
@@ -35,7 +35,7 @@
           mode: mergepartial
           Select Operator
             expressions:
-                  expr: 'tst2'
+                  expr: 'tst1'
                   type: string
                   expr: 0
                   type: bigint
@@ -130,7 +130,7 @@
   Stage: Stage-3
     Map Reduce
       Alias -> Map Operator Tree:
-        null-subquery1:unionsrc-subquery1:s1 
+        null-subquery1-subquery2:unionsrc-subquery1-subquery2:s2 
             Select Operator
               Group By Operator
                 aggregations:
@@ -149,7 +149,7 @@
           mode: mergepartial
           Select Operator
             expressions:
-                  expr: 'tst1'
+                  expr: 'tst2'
                   type: string
                   expr: 0
                   type: bigint
@@ -164,7 +164,7 @@
   Stage: Stage-4
     Map Reduce
       Alias -> Map Operator Tree:
-        null-subquery2-subquery2:unionsrc-subquery2-subquery2:s3 
+        null-subquery2:unionsrc-subquery2:s3 
             Select Operator
               Group By Operator
                 aggregations:

Modified: hadoop/hive/trunk/ql/src/test/results/clientpositive/union11.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientpositive/union11.q.out?rev=765376&r1=765375&r2=765376&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientpositive/union11.q.out (original)
+++ hadoop/hive/trunk/ql/src/test/results/clientpositive/union11.q.out Wed Apr 15 21:38:12 2009
@@ -1,5 +1,5 @@
 ABSTRACT SYNTAX TREE:
-  (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF src s1)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 'tst1' key) (TOK_SELEXPR (TOK_FUNCTION count 1) value)))) (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF src s2)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 'tst2' key) (TOK_SELEXPR (TOK_FUNCTION count 1) value)))) (TOK_QUERY (TOK_FROM (TOK_TABREF src s3)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 'tst3' key) (TOK_SELEXPR (TOK_FUNCTION count 1) value)))))) unionsrc)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF unionsrc key)) (TOK_SELEXPR (TOK_FUNCTION count 1))) (TOK_GROUPBY (TOK_COLREF unionsrc key))))
+  (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF src s1)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 'tst1' key) (TOK_SELEXPR (TOK_FUNCTION count 1) value)))) (TOK_QUERY (TOK_FROM (TOK_TABREF src s2)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 'tst2' key) (TOK_SELEXPR (TOK_FUNCTION count 1) value))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src s3)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 'tst3' key) (TOK_SELEXPR (TOK_FUNCTION count 1) value))))) unionsrc)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF unionsrc key)) (TOK_SELEXPR (TOK_FUNCTION count 1))) (TOK_GROUPBY (TOK_COLREF unionsrc key))))
 
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -14,7 +14,7 @@
   Stage: Stage-1
     Map Reduce
       Alias -> Map Operator Tree:
-        null-subquery2-subquery1:unionsrc-subquery2-subquery1:s2 
+        null-subquery1-subquery1:unionsrc-subquery1-subquery1:s1 
             Select Operator
               Group By Operator
                 aggregations:
@@ -33,7 +33,7 @@
           mode: mergepartial
           Select Operator
             expressions:
-                  expr: 'tst2'
+                  expr: 'tst1'
                   type: string
                   expr: 0
                   type: bigint
@@ -135,7 +135,7 @@
   Stage: Stage-3
     Map Reduce
       Alias -> Map Operator Tree:
-        null-subquery1:unionsrc-subquery1:s1 
+        null-subquery1-subquery2:unionsrc-subquery1-subquery2:s2 
             Select Operator
               Group By Operator
                 aggregations:
@@ -154,7 +154,7 @@
           mode: mergepartial
           Select Operator
             expressions:
-                  expr: 'tst1'
+                  expr: 'tst2'
                   type: string
                   expr: 0
                   type: bigint
@@ -169,7 +169,7 @@
   Stage: Stage-4
     Map Reduce
       Alias -> Map Operator Tree:
-        null-subquery2-subquery2:unionsrc-subquery2-subquery2:s3 
+        null-subquery2:unionsrc-subquery2:s3 
             Select Operator
               Group By Operator
                 aggregations:

Modified: hadoop/hive/trunk/ql/src/test/results/clientpositive/union12.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientpositive/union12.q.out?rev=765376&r1=765375&r2=765376&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientpositive/union12.q.out (original)
+++ hadoop/hive/trunk/ql/src/test/results/clientpositive/union12.q.out Wed Apr 15 21:38:12 2009
@@ -1,5 +1,5 @@
 ABSTRACT SYNTAX TREE:
-  (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF src s1)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 'tst1' key) (TOK_SELEXPR (TOK_FUNCTION count 1) value)))) (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF src1 s2)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 'tst2' key) (TOK_SELEXPR (TOK_FUNCTION count 1) value)))) (TOK_QUERY (TOK_FROM (TOK_TABREF srcbucket s3)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 'tst3' key) (TOK_SELEXPR (TOK_FUNCTION count 1) value)))))) unionsrc)) (TOK_INSERT (TOK_DESTINATION (TOK_TAB tmptable)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF unionsrc key)) (TOK_SELEXPR (TOK_COLREF unionsrc value)))))
+  (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF src s1)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 'tst1' key) (TOK_SELEXPR (TOK_FUNCTION count 1) value)))) (TOK_QUERY (TOK_FROM (TOK_TABREF src1 s2)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 'tst2' key) (TOK_SELEXPR (TOK_FUNCTION count 1) value))))) (TOK_QUERY (TOK_FROM (TOK_TABREF srcbucket s3)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 'tst3' key) (TOK_SELEXPR (TOK_FUNCTION count 1) value))))) unionsrc)) (TOK_INSERT (TOK_DESTINATION (TOK_TAB tmptable)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF unionsrc key)) (TOK_SELEXPR (TOK_COLREF unionsrc value)))))
 
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -16,7 +16,7 @@
   Stage: Stage-1
     Map Reduce
       Alias -> Map Operator Tree:
-        null-subquery2-subquery1:unionsrc-subquery2-subquery1:s2 
+        null-subquery1-subquery1:unionsrc-subquery1-subquery1:s1 
             Select Operator
               Group By Operator
                 aggregations:
@@ -35,7 +35,7 @@
           mode: mergepartial
           Select Operator
             expressions:
-                  expr: 'tst2'
+                  expr: 'tst1'
                   type: string
                   expr: 0
                   type: bigint
@@ -130,7 +130,7 @@
   Stage: Stage-3
     Map Reduce
       Alias -> Map Operator Tree:
-        null-subquery1:unionsrc-subquery1:s1 
+        null-subquery1-subquery2:unionsrc-subquery1-subquery2:s2 
             Select Operator
               Group By Operator
                 aggregations:
@@ -149,7 +149,7 @@
           mode: mergepartial
           Select Operator
             expressions:
-                  expr: 'tst1'
+                  expr: 'tst2'
                   type: string
                   expr: 0
                   type: bigint
@@ -164,7 +164,7 @@
   Stage: Stage-4
     Map Reduce
       Alias -> Map Operator Tree:
-        null-subquery2-subquery2:unionsrc-subquery2-subquery2:s3 
+        null-subquery2:unionsrc-subquery2:s3 
             Select Operator
               Group By Operator
                 aggregations:

Modified: hadoop/hive/trunk/ql/src/test/results/clientpositive/union15.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientpositive/union15.q.out?rev=765376&r1=765375&r2=765376&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientpositive/union15.q.out (original)
+++ hadoop/hive/trunk/ql/src/test/results/clientpositive/union15.q.out Wed Apr 15 21:38:12 2009
@@ -1,5 +1,5 @@
 ABSTRACT SYNTAX TREE:
-  (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF src s1)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 'tst1' key) (TOK_SELEXPR (TOK_FUNCTION TOK_STRING (TOK_FUNCTION count 1)) value)))) (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF src1 s2)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF s2 key) key) (TOK_SELEXPR (TOK_COLREF s2 value) value)))) (TOK_QUERY (TOK_FROM (TOK_TABREF src1 s3)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF s3 key) key) (TOK_SELEXPR (TOK_COLREF s3 value) value)))))) unionsrc)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF unionsrc key)) (TOK_SELEXPR (TOK_FUNCTION count 1))) (TOK_GROUPBY (TOK_COLREF unionsrc key))))
+  (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF src s1)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 'tst1' key) (TOK_SELEXPR (TOK_FUNCTION TOK_STRING (TOK_FUNCTION count 1)) value)))) (TOK_QUERY (TOK_FROM (TOK_TABREF src1 s2)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF s2 key) key) (TOK_SELEXPR (TOK_COLREF s2 value) value))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src1 s3)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF s3 key) key) (TOK_SELEXPR (TOK_COLREF s3 value) value))))) unionsrc)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF unionsrc key)) (TOK_SELEXPR (TOK_FUNCTION count 1))) (TOK_GROUPBY (TOK_COLREF unionsrc key))))
 
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -14,25 +14,41 @@
   Stage: Stage-1
     Map Reduce
       Alias -> Map Operator Tree:
-        null-subquery2-subquery1:unionsrc-subquery2-subquery1:s2 
+        null-subquery1-subquery1:unionsrc-subquery1-subquery1:s1 
             Select Operator
-              expressions:
-                    expr: key
-                    type: string
-                    expr: value
-                    type: string
-              File Output Operator
-                compressed: false
-                GlobalTableId: 0
-                table:
-                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                    name: binary_table
+              Group By Operator
+                aggregations:
+                      expr: count(1)
+                mode: hash
+                Reduce Output Operator
+                  sort order: 
+                  tag: -1
+                  value expressions:
+                        expr: 0
+                        type: bigint
+      Reduce Operator Tree:
+        Group By Operator
+          aggregations:
+                expr: count(VALUE.0)
+          mode: mergepartial
+          Select Operator
+            expressions:
+                  expr: 'tst1'
+                  type: string
+                  expr: UDFToString(0)
+                  type: string
+            File Output Operator
+              compressed: false
+              GlobalTableId: 0
+              table:
+                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                  name: binary_table
 
   Stage: Stage-2
     Map Reduce
       Alias -> Map Operator Tree:
-        /Users/char/Documents/workspace/Hive/build/ql/tmp/756644345/279222463.10004 
+        /data/users/zshao/tools/deploy-trunk-apache-hive/build/ql/tmp/1034387168/10333486.10004 
           Union
             Group By Operator
               aggregations:
@@ -53,7 +69,7 @@
                 value expressions:
                       expr: 1
                       type: bigint
-        /Users/char/Documents/workspace/Hive/build/ql/tmp/756644345/279222463.10003 
+        /data/users/zshao/tools/deploy-trunk-apache-hive/build/ql/tmp/1034387168/10333486.10002 
           Union
             Group By Operator
               aggregations:
@@ -74,7 +90,7 @@
                 value expressions:
                       expr: 1
                       type: bigint
-        /Users/char/Documents/workspace/Hive/build/ql/tmp/756644345/279222463.10002 
+        /data/users/zshao/tools/deploy-trunk-apache-hive/build/ql/tmp/1034387168/10333486.10003 
           Union
             Group By Operator
               aggregations:
@@ -119,41 +135,25 @@
   Stage: Stage-3
     Map Reduce
       Alias -> Map Operator Tree:
-        null-subquery1:unionsrc-subquery1:s1 
+        null-subquery1-subquery2:unionsrc-subquery1-subquery2:s2 
             Select Operator
-              Group By Operator
-                aggregations:
-                      expr: count(1)
-                mode: hash
-                Reduce Output Operator
-                  sort order: 
-                  tag: -1
-                  value expressions:
-                        expr: 0
-                        type: bigint
-      Reduce Operator Tree:
-        Group By Operator
-          aggregations:
-                expr: count(VALUE.0)
-          mode: mergepartial
-          Select Operator
-            expressions:
-                  expr: 'tst1'
-                  type: string
-                  expr: UDFToString(0)
-                  type: string
-            File Output Operator
-              compressed: false
-              GlobalTableId: 0
-              table:
-                  input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                  output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                  name: binary_table
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              File Output Operator
+                compressed: false
+                GlobalTableId: 0
+                table:
+                    input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                    output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                    name: binary_table
 
   Stage: Stage-4
     Map Reduce
       Alias -> Map Operator Tree:
-        null-subquery2-subquery2:unionsrc-subquery2-subquery2:s3 
+        null-subquery2:unionsrc-subquery2:s3 
             Select Operator
               expressions:
                     expr: key

Added: hadoop/hive/trunk/ql/src/test/results/clientpositive/union16.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientpositive/union16.q.out?rev=765376&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientpositive/union16.q.out (added)
+++ hadoop/hive/trunk/ql/src/test/results/clientpositive/union16.q.out Wed Apr 15 21:38:12 2009
@@ -0,0 +1,483 @@
+ABSTRACT SYNTAX TREE:
+  (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (
 TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF k
 ey)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FI
 LE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_
 INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF key)) (TOK_SELEXPR (TOK_COLREF value)))))) src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION count 1)))))
+
+STAGE DEPENDENCIES:
+  Stage-1 is a root stage
+  Stage-0 is a root stage
+
+STAGE PLANS:
+  Stage: Stage-1
+    Map Reduce
+      Alias -> Map Operator Tree:
+        null-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery2:src-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery2:src-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1:src-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+        null-subquery1-subquery1-subquery2:src-subquery1-subquery1-subquery2:src 
+            Select Operator
+              expressions:
+                    expr: key
+                    type: string
+                    expr: value
+                    type: string
+              Union
+                Group By Operator
+                  aggregations:
+                        expr: count(1)
+                  mode: hash
+                  Reduce Output Operator
+                    sort order: 
+                    tag: -1
+                    value expressions:
+                          expr: 0
+                          type: bigint
+      Reduce Operator Tree:
+        Group By Operator
+          aggregations:
+                expr: count(VALUE.0)
+          mode: mergepartial
+          Select Operator
+            expressions:
+                  expr: 0
+                  type: bigint
+            File Output Operator
+              compressed: false
+              GlobalTableId: 0
+              table:
+                  input format: org.apache.hadoop.mapred.TextInputFormat
+                  output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+
+  Stage: Stage-0
+    Fetch Operator
+      limit: -1
+
+
+12500

Modified: hadoop/hive/trunk/ql/src/test/results/clientpositive/union3.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientpositive/union3.q.out?rev=765376&r1=765375&r2=765376&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientpositive/union3.q.out (original)
+++ hadoop/hive/trunk/ql/src/test/results/clientpositive/union3.q.out Wed Apr 15 21:38:12 2009
@@ -1,24 +1,24 @@
 ABSTRACT SYNTAX TREE:
-  (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_LIMIT 1))) s1)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 1 id)) (TOK_CLUSTERBY (TOK_COLREF id)))) (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_LIMIT 1))) s1)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 2 id)) (TOK_CLUSTERBY (TOK_COLREF id)))) (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_LIMIT 1))) s2)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 3 id)))) (TOK_QUERY (TOK_FROM (TOK_S
 UBQUERY (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_LIMIT 1))) s2)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 4 id))))))) a)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF))))
+  (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_UNION (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_LIMIT 1))) s1)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 1 id)) (TOK_CLUSTERBY (TOK_COLREF id)))) (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_LIMIT 1))) s1)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 2 id)) (TOK_CLUSTERBY (TOK_COLREF id))))) (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_LIMIT 1))) s2)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 3 id))))) (TOK_QUERY (TOK_FROM (TOK
 _SUBQUERY (TOK_QUERY (TOK_FROM (TOK_TABREF src)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_LIMIT 1))) s2)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR 4 id))))) a)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF))))
 
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
-  Stage-2 depends on stages: Stage-1
-  Stage-3 depends on stages: Stage-2, Stage-4, Stage-6, Stage-7
+  Stage-2 depends on stages: Stage-1, Stage-3, Stage-5, Stage-7
+  Stage-3 is a root stage
+  Stage-2 depends on stages: Stage-1, Stage-3, Stage-5, Stage-7
   Stage-4 is a root stage
-  Stage-3 depends on stages: Stage-2, Stage-4, Stage-6, Stage-7
-  Stage-5 is a root stage
-  Stage-6 depends on stages: Stage-5
-  Stage-3 depends on stages: Stage-2, Stage-4, Stage-6, Stage-7
-  Stage-7 is a root stage
-  Stage-3 depends on stages: Stage-2, Stage-4, Stage-6, Stage-7
+  Stage-5 depends on stages: Stage-4
+  Stage-2 depends on stages: Stage-1, Stage-3, Stage-5, Stage-7
+  Stage-6 is a root stage
+  Stage-7 depends on stages: Stage-6
+  Stage-2 depends on stages: Stage-1, Stage-3, Stage-5, Stage-7
   Stage-0 is a root stage
 
 STAGE PLANS:
   Stage: Stage-1
     Map Reduce
       Alias -> Map Operator Tree:
-        null-subquery2-subquery1:a-subquery2-subquery1:s1:src 
+        null-subquery2:a-subquery2:s2:src 
             Select Operator
               expressions:
                     expr: key
@@ -39,7 +39,7 @@
           Limit
             Select Operator
               expressions:
-                    expr: 2
+                    expr: 4
                     type: int
               File Output Operator
                 compressed: false
@@ -52,33 +52,7 @@
   Stage: Stage-2
     Map Reduce
       Alias -> Map Operator Tree:
-        /Users/char/Documents/workspace/Hive/build/ql/tmp/156638389/398032648.10002 
-          Reduce Output Operator
-            key expressions:
-                  expr: 0
-                  type: int
-            sort order: +
-            Map-reduce partition columns:
-                  expr: 0
-                  type: int
-            tag: -1
-            value expressions:
-                  expr: 0
-                  type: int
-      Reduce Operator Tree:
-        Extract
-          File Output Operator
-            compressed: false
-            GlobalTableId: 0
-            table:
-                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
-                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
-                name: binary_table
-
-  Stage: Stage-3
-    Map Reduce
-      Alias -> Map Operator Tree:
-        /Users/char/Documents/workspace/Hive/build/ql/tmp/156638389/398032648.10004 
+        /data/users/zshao/tools/deploy-trunk-apache-hive/build/ql/tmp/150085610/141128926.10005 
           Union
             Select Operator
               expressions:
@@ -90,7 +64,7 @@
                 table:
                     input format: org.apache.hadoop.mapred.TextInputFormat
                     output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-        /Users/char/Documents/workspace/Hive/build/ql/tmp/156638389/398032648.10007 
+        /data/users/zshao/tools/deploy-trunk-apache-hive/build/ql/tmp/150085610/141128926.10003 
           Union
             Select Operator
               expressions:
@@ -102,7 +76,7 @@
                 table:
                     input format: org.apache.hadoop.mapred.TextInputFormat
                     output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-        /Users/char/Documents/workspace/Hive/build/ql/tmp/156638389/398032648.10006 
+        /data/users/zshao/tools/deploy-trunk-apache-hive/build/ql/tmp/150085610/141128926.10007 
           Union
             Select Operator
               expressions:
@@ -114,7 +88,7 @@
                 table:
                     input format: org.apache.hadoop.mapred.TextInputFormat
                     output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-        /Users/char/Documents/workspace/Hive/build/ql/tmp/156638389/398032648.10003 
+        /data/users/zshao/tools/deploy-trunk-apache-hive/build/ql/tmp/150085610/141128926.10002 
           Union
             Select Operator
               expressions:
@@ -127,10 +101,10 @@
                     input format: org.apache.hadoop.mapred.TextInputFormat
                     output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
 
-  Stage: Stage-4
+  Stage: Stage-3
     Map Reduce
       Alias -> Map Operator Tree:
-        null-subquery2-subquery2-subquery2:a-subquery2-subquery2-subquery2:s2:src 
+        null-subquery1-subquery2:a-subquery1-subquery2:s2:src 
             Select Operator
               expressions:
                     expr: key
@@ -151,7 +125,7 @@
           Limit
             Select Operator
               expressions:
-                    expr: 4
+                    expr: 3
                     type: int
               File Output Operator
                 compressed: false
@@ -161,10 +135,10 @@
                     output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                     name: binary_table
 
-  Stage: Stage-5
+  Stage: Stage-4
     Map Reduce
       Alias -> Map Operator Tree:
-        null-subquery1:a-subquery1:s1:src 
+        null-subquery1-subquery1-subquery1:a-subquery1-subquery1-subquery1:s1:src 
             Select Operator
               expressions:
                     expr: key
@@ -195,10 +169,10 @@
                     output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                     name: binary_table
 
-  Stage: Stage-6
+  Stage: Stage-5
     Map Reduce
       Alias -> Map Operator Tree:
-        /Users/char/Documents/workspace/Hive/build/ql/tmp/156638389/398032648.10005 
+        /data/users/zshao/tools/deploy-trunk-apache-hive/build/ql/tmp/150085610/141128926.10004 
           Reduce Output Operator
             key expressions:
                   expr: 0
@@ -221,10 +195,10 @@
                 output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                 name: binary_table
 
-  Stage: Stage-7
+  Stage: Stage-6
     Map Reduce
       Alias -> Map Operator Tree:
-        null-subquery2-subquery2-subquery1:a-subquery2-subquery2-subquery1:s2:src 
+        null-subquery1-subquery1-subquery2:a-subquery1-subquery1-subquery2:s1:src 
             Select Operator
               expressions:
                     expr: key
@@ -245,7 +219,7 @@
           Limit
             Select Operator
               expressions:
-                    expr: 3
+                    expr: 2
                     type: int
               File Output Operator
                 compressed: false
@@ -255,6 +229,32 @@
                     output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
                     name: binary_table
 
+  Stage: Stage-7
+    Map Reduce
+      Alias -> Map Operator Tree:
+        /data/users/zshao/tools/deploy-trunk-apache-hive/build/ql/tmp/150085610/141128926.10006 
+          Reduce Output Operator
+            key expressions:
+                  expr: 0
+                  type: int
+            sort order: +
+            Map-reduce partition columns:
+                  expr: 0
+                  type: int
+            tag: -1
+            value expressions:
+                  expr: 0
+                  type: int
+      Reduce Operator Tree:
+        Extract
+          File Output Operator
+            compressed: false
+            GlobalTableId: 0
+            table:
+                input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+                output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+                name: binary_table
+
   Stage: Stage-0
     Fetch Operator
       limit: -1

Modified: hadoop/hive/trunk/ql/src/test/results/clientpositive/union8.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientpositive/union8.q.out?rev=765376&r1=765375&r2=765376&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientpositive/union8.q.out (original)
+++ hadoop/hive/trunk/ql/src/test/results/clientpositive/union8.q.out Wed Apr 15 21:38:12 2009
@@ -1,5 +1,5 @@
 ABSTRACT SYNTAX TREE:
-  (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF src s1)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF s1 key) key) (TOK_SELEXPR (TOK_COLREF s1 value) value)))) (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF src s2)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF s2 key) key) (TOK_SELEXPR (TOK_COLREF s2 value) value)))) (TOK_QUERY (TOK_FROM (TOK_TABREF src s3)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF s3 key) key) (TOK_SELEXPR (TOK_COLREF s3 value) value)))))) unionsrc)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF unionsrc key)) (TOK_SELEXPR (TOK_COLREF unionsrc value)))))
+  (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF src s1)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF s1 key) key) (TOK_SELEXPR (TOK_COLREF s1 value) value)))) (TOK_QUERY (TOK_FROM (TOK_TABREF src s2)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF s2 key) key) (TOK_SELEXPR (TOK_COLREF s2 value) value))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src s3)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF s3 key) key) (TOK_SELEXPR (TOK_COLREF s3 value) value))))) unionsrc)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF unionsrc key)) (TOK_SELEXPR (TOK_COLREF unionsrc value)))))
 
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -9,7 +9,7 @@
   Stage: Stage-1
     Map Reduce
       Alias -> Map Operator Tree:
-        null-subquery2-subquery1:unionsrc-subquery2-subquery1:s2 
+        null-subquery1-subquery1:unionsrc-subquery1-subquery1:s1 
             Select Operator
               expressions:
                     expr: key
@@ -29,7 +29,7 @@
                     table:
                         input format: org.apache.hadoop.mapred.TextInputFormat
                         output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-        null-subquery1:unionsrc-subquery1:s1 
+        null-subquery1-subquery2:unionsrc-subquery1-subquery2:s2 
             Select Operator
               expressions:
                     expr: key
@@ -49,7 +49,7 @@
                     table:
                         input format: org.apache.hadoop.mapred.TextInputFormat
                         output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
-        null-subquery2-subquery2:unionsrc-subquery2-subquery2:s3 
+        null-subquery2:unionsrc-subquery2:s3 
             Select Operator
               expressions:
                     expr: key

Modified: hadoop/hive/trunk/ql/src/test/results/clientpositive/union9.q.out
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/test/results/clientpositive/union9.q.out?rev=765376&r1=765375&r2=765376&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/test/results/clientpositive/union9.q.out (original)
+++ hadoop/hive/trunk/ql/src/test/results/clientpositive/union9.q.out Wed Apr 15 21:38:12 2009
@@ -1,5 +1,5 @@
 ABSTRACT SYNTAX TREE:
-  (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF src s1)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF s1 key) key) (TOK_SELEXPR (TOK_COLREF s1 value) value)))) (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF src s2)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF s2 key) key) (TOK_SELEXPR (TOK_COLREF s2 value) value)))) (TOK_QUERY (TOK_FROM (TOK_TABREF src s3)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF s3 key) key) (TOK_SELEXPR (TOK_COLREF s3 value) value)))))) unionsrc)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION count 1)))))
+  (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF src s1)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF s1 key) key) (TOK_SELEXPR (TOK_COLREF s1 value) value)))) (TOK_QUERY (TOK_FROM (TOK_TABREF src s2)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF s2 key) key) (TOK_SELEXPR (TOK_COLREF s2 value) value))))) (TOK_QUERY (TOK_FROM (TOK_TABREF src s3)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_COLREF s3 key) key) (TOK_SELEXPR (TOK_COLREF s3 value) value))))) unionsrc)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION count 1)))))
 
 STAGE DEPENDENCIES:
   Stage-1 is a root stage
@@ -9,7 +9,7 @@
   Stage: Stage-1
     Map Reduce
       Alias -> Map Operator Tree:
-        null-subquery2-subquery1:unionsrc-subquery2-subquery1:s2 
+        null-subquery1-subquery1:unionsrc-subquery1-subquery1:s1 
             Select Operator
               expressions:
                     expr: key
@@ -27,7 +27,7 @@
                     value expressions:
                           expr: 0
                           type: bigint
-        null-subquery1:unionsrc-subquery1:s1 
+        null-subquery1-subquery2:unionsrc-subquery1-subquery2:s2 
             Select Operator
               expressions:
                     expr: key
@@ -45,7 +45,7 @@
                     value expressions:
                           expr: 0
                           type: bigint
-        null-subquery2-subquery2:unionsrc-subquery2-subquery2:s3 
+        null-subquery2:unionsrc-subquery2:s3 
             Select Operator
               expressions:
                     expr: key