Index: ql/src/test/results/clientpositive/union32.q.out
===================================================================
--- ql/src/test/results/clientpositive/union32.q.out (revision 0)
+++ ql/src/test/results/clientpositive/union32.q.out (revision 0)
@@ -0,0 +1,943 @@
+PREHOOK: query: -- This tests various union queries which have columns on one side of the query
+-- being of double type and those on the other side another
+
+CREATE TABLE t1 AS SELECT * FROM src WHERE key < 10
+PREHOOK: type: CREATETABLE_AS_SELECT
+PREHOOK: Input: default@src
+POSTHOOK: query: -- This tests various union queries which have columns on one side of the query
+-- being of double type and those on the other side another
+
+CREATE TABLE t1 AS SELECT * FROM src WHERE key < 10
+POSTHOOK: type: CREATETABLE_AS_SELECT
+POSTHOOK: Input: default@src
+POSTHOOK: Output: default@t1
+PREHOOK: query: CREATE TABLE t2 AS SELECT * FROM src WHERE key < 10
+PREHOOK: type: CREATETABLE_AS_SELECT
+PREHOOK: Input: default@src
+POSTHOOK: query: CREATE TABLE t2 AS SELECT * FROM src WHERE key < 10
+POSTHOOK: type: CREATETABLE_AS_SELECT
+POSTHOOK: Input: default@src
+POSTHOOK: Output: default@t2
+PREHOOK: query: -- Test simple union with double
+EXPLAIN
+SELECT * FROM
+(SELECT CAST(key AS DOUBLE) AS key FROM t1
+UNION ALL
+SELECT CAST(key AS BIGINT) AS key FROM t2) a
+ORDER BY key
+PREHOOK: type: QUERY
+POSTHOOK: query: -- Test simple union with double
+EXPLAIN
+SELECT * FROM
+(SELECT CAST(key AS DOUBLE) AS key FROM t1
+UNION ALL
+SELECT CAST(key AS BIGINT) AS key FROM t2) a
+ORDER BY key
+POSTHOOK: type: QUERY
+ABSTRACT SYNTAX TREE:
+ (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME t1))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION TOK_DOUBLE (TOK_TABLE_OR_COL key)) key)))) (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME t2))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION TOK_BIGINT (TOK_TABLE_OR_COL key)) key))))) a)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_ORDERBY (TOK_TABSORTCOLNAMEASC (TOK_TABLE_OR_COL key)))))
+
+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:a-subquery1:t1
+ TableScan
+ alias: t1
+ Select Operator
+ expressions:
+ expr: UDFToDouble(key)
+ type: double
+ outputColumnNames: _col0
+ Union
+ Select Operator
+ expressions:
+ expr: _col0
+ type: double
+ outputColumnNames: _col0
+ Reduce Output Operator
+ key expressions:
+ expr: _col0
+ type: double
+ sort order: +
+ tag: -1
+ value expressions:
+ expr: _col0
+ type: double
+ null-subquery2:a-subquery2:t2
+ TableScan
+ alias: t2
+ Select Operator
+ expressions:
+ expr: UDFToLong(key)
+ type: bigint
+ outputColumnNames: _col0
+ Select Operator
+ expressions:
+ expr: UDFToDouble(_col0)
+ type: double
+ outputColumnNames: _col0
+ Union
+ Select Operator
+ expressions:
+ expr: _col0
+ type: double
+ outputColumnNames: _col0
+ Reduce Output Operator
+ key expressions:
+ expr: _col0
+ type: double
+ sort order: +
+ tag: -1
+ value expressions:
+ expr: _col0
+ type: double
+ Reduce Operator Tree:
+ Extract
+ 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
+
+
+PREHOOK: query: SELECT * FROM
+(SELECT CAST(key AS DOUBLE) AS key FROM t1
+UNION ALL
+SELECT CAST(key AS BIGINT) AS key FROM t2) a
+ORDER BY key
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t1
+PREHOOK: Input: default@t2
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT * FROM
+(SELECT CAST(key AS DOUBLE) AS key FROM t1
+UNION ALL
+SELECT CAST(key AS BIGINT) AS key FROM t2) a
+ORDER BY key
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t1
+POSTHOOK: Input: default@t2
+#### A masked pattern was here ####
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+2.0
+2.0
+4.0
+4.0
+5.0
+5.0
+5.0
+5.0
+5.0
+5.0
+8.0
+8.0
+9.0
+9.0
+PREHOOK: query: -- Test union with join on the left
+EXPLAIN
+SELECT * FROM
+(SELECT CAST(a.key AS BIGINT) AS key FROM t1 a JOIN t2 b ON a.key = b.key
+UNION ALL
+SELECT CAST(key AS DOUBLE) AS key FROM t2) a
+ORDER BY key
+PREHOOK: type: QUERY
+POSTHOOK: query: -- Test union with join on the left
+EXPLAIN
+SELECT * FROM
+(SELECT CAST(a.key AS BIGINT) AS key FROM t1 a JOIN t2 b ON a.key = b.key
+UNION ALL
+SELECT CAST(key AS DOUBLE) AS key FROM t2) a
+ORDER BY key
+POSTHOOK: type: QUERY
+ABSTRACT SYNTAX TREE:
+ (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_TABREF (TOK_TABNAME t1) a) (TOK_TABREF (TOK_TABNAME t2) b) (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION TOK_BIGINT (. (TOK_TABLE_OR_COL a) key)) key)))) (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME t2))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION TOK_DOUBLE (TOK_TABLE_OR_COL key)) key))))) a)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_ORDERBY (TOK_TABSORTCOLNAMEASC (TOK_TABLE_OR_COL key)))))
+
+STAGE DEPENDENCIES:
+ Stage-3 is a root stage
+ Stage-2 depends on stages: Stage-3
+ Stage-0 is a root stage
+
+STAGE PLANS:
+ Stage: Stage-3
+ Map Reduce
+ Alias -> Map Operator Tree:
+ null-subquery1:a-subquery1:a
+ TableScan
+ alias: a
+ Reduce Output Operator
+ key expressions:
+ expr: key
+ type: string
+ sort order: +
+ Map-reduce partition columns:
+ expr: key
+ type: string
+ tag: 0
+ value expressions:
+ expr: key
+ type: string
+ null-subquery1:a-subquery1:b
+ TableScan
+ alias: b
+ Reduce Output Operator
+ key expressions:
+ expr: key
+ type: string
+ sort order: +
+ Map-reduce partition columns:
+ expr: key
+ type: string
+ tag: 1
+ Reduce Operator Tree:
+ Join Operator
+ condition map:
+ Inner Join 0 to 1
+ condition expressions:
+ 0 {VALUE._col0}
+ 1
+ handleSkewJoin: false
+ outputColumnNames: _col0
+ Select Operator
+ expressions:
+ expr: UDFToLong(_col0)
+ type: bigint
+ outputColumnNames: _col0
+ Select Operator
+ expressions:
+ expr: UDFToDouble(_col0)
+ type: double
+ outputColumnNames: _col0
+ File Output Operator
+ compressed: false
+ GlobalTableId: 0
+ table:
+ input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+
+ Stage: Stage-2
+ Map Reduce
+ Alias -> Map Operator Tree:
+#### A masked pattern was here ####
+ TableScan
+ Union
+ Select Operator
+ expressions:
+ expr: _col0
+ type: double
+ outputColumnNames: _col0
+ Reduce Output Operator
+ key expressions:
+ expr: _col0
+ type: double
+ sort order: +
+ tag: -1
+ value expressions:
+ expr: _col0
+ type: double
+ null-subquery2:a-subquery2:t2
+ TableScan
+ alias: t2
+ Select Operator
+ expressions:
+ expr: UDFToDouble(key)
+ type: double
+ outputColumnNames: _col0
+ Union
+ Select Operator
+ expressions:
+ expr: _col0
+ type: double
+ outputColumnNames: _col0
+ Reduce Output Operator
+ key expressions:
+ expr: _col0
+ type: double
+ sort order: +
+ tag: -1
+ value expressions:
+ expr: _col0
+ type: double
+ Reduce Operator Tree:
+ Extract
+ 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
+
+
+PREHOOK: query: SELECT * FROM
+(SELECT CAST(a.key AS BIGINT) AS key FROM t1 a JOIN t2 b ON a.key = b.key
+UNION ALL
+SELECT CAST(key AS DOUBLE) AS key FROM t2) a
+ORDER BY key
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t1
+PREHOOK: Input: default@t2
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT * FROM
+(SELECT CAST(a.key AS BIGINT) AS key FROM t1 a JOIN t2 b ON a.key = b.key
+UNION ALL
+SELECT CAST(key AS DOUBLE) AS key FROM t2) a
+ORDER BY key
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t1
+POSTHOOK: Input: default@t2
+#### A masked pattern was here ####
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+2.0
+2.0
+4.0
+4.0
+5.0
+5.0
+5.0
+5.0
+5.0
+5.0
+5.0
+5.0
+5.0
+5.0
+5.0
+5.0
+8.0
+8.0
+9.0
+9.0
+PREHOOK: query: -- Test union with join on the right
+EXPLAIN
+SELECT * FROM
+(SELECT CAST(key AS DOUBLE) AS key FROM t2
+UNION ALL
+SELECT CAST(a.key AS BIGINT) AS key FROM t1 a JOIN t2 b ON a.key = b.key) a
+ORDER BY key
+PREHOOK: type: QUERY
+POSTHOOK: query: -- Test union with join on the right
+EXPLAIN
+SELECT * FROM
+(SELECT CAST(key AS DOUBLE) AS key FROM t2
+UNION ALL
+SELECT CAST(a.key AS BIGINT) AS key FROM t1 a JOIN t2 b ON a.key = b.key) a
+ORDER BY key
+POSTHOOK: type: QUERY
+ABSTRACT SYNTAX TREE:
+ (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME t2))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION TOK_DOUBLE (TOK_TABLE_OR_COL key)) key)))) (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_TABREF (TOK_TABNAME t1) a) (TOK_TABREF (TOK_TABNAME t2) b) (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION TOK_BIGINT (. (TOK_TABLE_OR_COL a) key)) key))))) a)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_ORDERBY (TOK_TABSORTCOLNAMEASC (TOK_TABLE_OR_COL key)))))
+
+STAGE DEPENDENCIES:
+ Stage-1 is a root stage
+ Stage-2 depends on stages: Stage-1
+ Stage-0 is a root stage
+
+STAGE PLANS:
+ Stage: Stage-1
+ Map Reduce
+ Alias -> Map Operator Tree:
+ null-subquery2:a-subquery2:a
+ TableScan
+ alias: a
+ Reduce Output Operator
+ key expressions:
+ expr: key
+ type: string
+ sort order: +
+ Map-reduce partition columns:
+ expr: key
+ type: string
+ tag: 0
+ value expressions:
+ expr: key
+ type: string
+ null-subquery2:a-subquery2:b
+ TableScan
+ alias: b
+ Reduce Output Operator
+ key expressions:
+ expr: key
+ type: string
+ sort order: +
+ Map-reduce partition columns:
+ expr: key
+ type: string
+ tag: 1
+ Reduce Operator Tree:
+ Join Operator
+ condition map:
+ Inner Join 0 to 1
+ condition expressions:
+ 0 {VALUE._col0}
+ 1
+ handleSkewJoin: false
+ outputColumnNames: _col0
+ Select Operator
+ expressions:
+ expr: UDFToLong(_col0)
+ type: bigint
+ outputColumnNames: _col0
+ Select Operator
+ expressions:
+ expr: UDFToDouble(_col0)
+ type: double
+ outputColumnNames: _col0
+ File Output Operator
+ compressed: false
+ GlobalTableId: 0
+ table:
+ input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+
+ Stage: Stage-2
+ Map Reduce
+ Alias -> Map Operator Tree:
+#### A masked pattern was here ####
+ TableScan
+ Union
+ Select Operator
+ expressions:
+ expr: _col0
+ type: double
+ outputColumnNames: _col0
+ Reduce Output Operator
+ key expressions:
+ expr: _col0
+ type: double
+ sort order: +
+ tag: -1
+ value expressions:
+ expr: _col0
+ type: double
+ null-subquery1:a-subquery1:t2
+ TableScan
+ alias: t2
+ Select Operator
+ expressions:
+ expr: UDFToDouble(key)
+ type: double
+ outputColumnNames: _col0
+ Union
+ Select Operator
+ expressions:
+ expr: _col0
+ type: double
+ outputColumnNames: _col0
+ Reduce Output Operator
+ key expressions:
+ expr: _col0
+ type: double
+ sort order: +
+ tag: -1
+ value expressions:
+ expr: _col0
+ type: double
+ Reduce Operator Tree:
+ Extract
+ 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
+
+
+PREHOOK: query: SELECT * FROM
+(SELECT CAST(key AS DOUBLE) AS key FROM t2
+UNION ALL
+SELECT CAST(a.key AS BIGINT) AS key FROM t1 a JOIN t2 b ON a.key = b.key) a
+ORDER BY key
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t1
+PREHOOK: Input: default@t2
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT * FROM
+(SELECT CAST(key AS DOUBLE) AS key FROM t2
+UNION ALL
+SELECT CAST(a.key AS BIGINT) AS key FROM t1 a JOIN t2 b ON a.key = b.key) a
+ORDER BY key
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t1
+POSTHOOK: Input: default@t2
+#### A masked pattern was here ####
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+0.0
+2.0
+2.0
+4.0
+4.0
+5.0
+5.0
+5.0
+5.0
+5.0
+5.0
+5.0
+5.0
+5.0
+5.0
+5.0
+5.0
+8.0
+8.0
+9.0
+9.0
+PREHOOK: query: -- Test union with join on the left selecting multiple columns
+EXPLAIN
+SELECT * FROM
+(SELECT CAST(a.key AS BIGINT) AS key, CAST(b.key AS DOUBLE) AS value FROM t1 a JOIN t2 b ON a.key = b.key
+UNION ALL
+SELECT CAST(key AS DOUBLE) AS key, CAST(key AS STRING) AS value FROM t2) a
+ORDER BY key
+PREHOOK: type: QUERY
+POSTHOOK: query: -- Test union with join on the left selecting multiple columns
+EXPLAIN
+SELECT * FROM
+(SELECT CAST(a.key AS BIGINT) AS key, CAST(b.key AS DOUBLE) AS value FROM t1 a JOIN t2 b ON a.key = b.key
+UNION ALL
+SELECT CAST(key AS DOUBLE) AS key, CAST(key AS STRING) AS value FROM t2) a
+ORDER BY key
+POSTHOOK: type: QUERY
+ABSTRACT SYNTAX TREE:
+ (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_TABREF (TOK_TABNAME t1) a) (TOK_TABREF (TOK_TABNAME t2) b) (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION TOK_BIGINT (. (TOK_TABLE_OR_COL a) key)) key) (TOK_SELEXPR (TOK_FUNCTION TOK_DOUBLE (. (TOK_TABLE_OR_COL b) key)) value)))) (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME t2))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION TOK_DOUBLE (TOK_TABLE_OR_COL key)) key) (TOK_SELEXPR (TOK_FUNCTION TOK_STRING (TOK_TABLE_OR_COL key)) value))))) a)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_ORDERBY (TOK_TABSORTCOLNAMEASC (TOK_TABLE_OR_COL key)))))
+
+STAGE DEPENDENCIES:
+ Stage-3 is a root stage
+ Stage-2 depends on stages: Stage-3
+ Stage-0 is a root stage
+
+STAGE PLANS:
+ Stage: Stage-3
+ Map Reduce
+ Alias -> Map Operator Tree:
+ null-subquery1:a-subquery1:a
+ TableScan
+ alias: a
+ Reduce Output Operator
+ key expressions:
+ expr: key
+ type: string
+ sort order: +
+ Map-reduce partition columns:
+ expr: key
+ type: string
+ tag: 0
+ value expressions:
+ expr: key
+ type: string
+ null-subquery1:a-subquery1:b
+ TableScan
+ alias: b
+ Reduce Output Operator
+ key expressions:
+ expr: key
+ type: string
+ sort order: +
+ Map-reduce partition columns:
+ expr: key
+ type: string
+ tag: 1
+ value expressions:
+ expr: key
+ type: string
+ Reduce Operator Tree:
+ Join Operator
+ condition map:
+ Inner Join 0 to 1
+ condition expressions:
+ 0 {VALUE._col0}
+ 1 {VALUE._col0}
+ handleSkewJoin: false
+ outputColumnNames: _col0, _col4
+ Select Operator
+ expressions:
+ expr: UDFToLong(_col0)
+ type: bigint
+ expr: UDFToDouble(_col4)
+ type: double
+ outputColumnNames: _col0, _col1
+ Select Operator
+ expressions:
+ expr: UDFToDouble(_col0)
+ type: double
+ expr: UDFToString(_col1)
+ type: string
+ outputColumnNames: _col0, _col1
+ File Output Operator
+ compressed: false
+ GlobalTableId: 0
+ table:
+ input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+
+ Stage: Stage-2
+ Map Reduce
+ Alias -> Map Operator Tree:
+#### A masked pattern was here ####
+ TableScan
+ Union
+ Select Operator
+ expressions:
+ expr: _col0
+ type: double
+ expr: _col1
+ type: string
+ outputColumnNames: _col0, _col1
+ Reduce Output Operator
+ key expressions:
+ expr: _col0
+ type: double
+ sort order: +
+ tag: -1
+ value expressions:
+ expr: _col0
+ type: double
+ expr: _col1
+ type: string
+ null-subquery2:a-subquery2:t2
+ TableScan
+ alias: t2
+ Select Operator
+ expressions:
+ expr: UDFToDouble(key)
+ type: double
+ expr: key
+ type: string
+ outputColumnNames: _col0, _col1
+ Union
+ Select Operator
+ expressions:
+ expr: _col0
+ type: double
+ expr: _col1
+ type: string
+ outputColumnNames: _col0, _col1
+ Reduce Output Operator
+ key expressions:
+ expr: _col0
+ type: double
+ sort order: +
+ tag: -1
+ value expressions:
+ expr: _col0
+ type: double
+ expr: _col1
+ type: string
+ Reduce Operator Tree:
+ Extract
+ 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
+
+
+PREHOOK: query: SELECT * FROM
+(SELECT CAST(a.key AS BIGINT) AS key, CAST(b.key AS DOUBLE) AS value FROM t1 a JOIN t2 b ON a.key = b.key
+UNION ALL
+SELECT CAST(key AS DOUBLE) AS key, CAST(key AS STRING) AS value FROM t2) a
+ORDER BY key
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t1
+PREHOOK: Input: default@t2
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT * FROM
+(SELECT CAST(a.key AS BIGINT) AS key, CAST(b.key AS DOUBLE) AS value FROM t1 a JOIN t2 b ON a.key = b.key
+UNION ALL
+SELECT CAST(key AS DOUBLE) AS key, CAST(key AS STRING) AS value FROM t2) a
+ORDER BY key
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t1
+POSTHOOK: Input: default@t2
+#### A masked pattern was here ####
+0.0 0
+0.0 0
+0.0 0
+0.0 0.0
+0.0 0.0
+0.0 0.0
+0.0 0.0
+0.0 0.0
+0.0 0.0
+0.0 0.0
+0.0 0.0
+0.0 0.0
+2.0 2.0
+2.0 2
+4.0 4
+4.0 4.0
+5.0 5.0
+5.0 5.0
+5.0 5.0
+5.0 5.0
+5.0 5.0
+5.0 5.0
+5.0 5.0
+5.0 5.0
+5.0 5.0
+5.0 5
+5.0 5
+5.0 5
+8.0 8
+8.0 8.0
+9.0 9.0
+9.0 9
+PREHOOK: query: -- Test union with join on the right selecting multiple columns
+EXPLAIN
+SELECT * FROM
+(SELECT CAST(key AS DOUBLE) AS key, CAST(key AS STRING) AS value FROM t2
+UNION ALL
+SELECT CAST(a.key AS BIGINT) AS key, CAST(b.key AS DOUBLE) AS value FROM t1 a JOIN t2 b ON a.key = b.key) a
+ORDER BY key
+PREHOOK: type: QUERY
+POSTHOOK: query: -- Test union with join on the right selecting multiple columns
+EXPLAIN
+SELECT * FROM
+(SELECT CAST(key AS DOUBLE) AS key, CAST(key AS STRING) AS value FROM t2
+UNION ALL
+SELECT CAST(a.key AS BIGINT) AS key, CAST(b.key AS DOUBLE) AS value FROM t1 a JOIN t2 b ON a.key = b.key) a
+ORDER BY key
+POSTHOOK: type: QUERY
+ABSTRACT SYNTAX TREE:
+ (TOK_QUERY (TOK_FROM (TOK_SUBQUERY (TOK_UNION (TOK_QUERY (TOK_FROM (TOK_TABREF (TOK_TABNAME t2))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION TOK_DOUBLE (TOK_TABLE_OR_COL key)) key) (TOK_SELEXPR (TOK_FUNCTION TOK_STRING (TOK_TABLE_OR_COL key)) value)))) (TOK_QUERY (TOK_FROM (TOK_JOIN (TOK_TABREF (TOK_TABNAME t1) a) (TOK_TABREF (TOK_TABNAME t2) b) (= (. (TOK_TABLE_OR_COL a) key) (. (TOK_TABLE_OR_COL b) key)))) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR (TOK_FUNCTION TOK_BIGINT (. (TOK_TABLE_OR_COL a) key)) key) (TOK_SELEXPR (TOK_FUNCTION TOK_DOUBLE (. (TOK_TABLE_OR_COL b) key)) value))))) a)) (TOK_INSERT (TOK_DESTINATION (TOK_DIR TOK_TMP_FILE)) (TOK_SELECT (TOK_SELEXPR TOK_ALLCOLREF)) (TOK_ORDERBY (TOK_TABSORTCOLNAMEASC (TOK_TABLE_OR_COL key)))))
+
+STAGE DEPENDENCIES:
+ Stage-1 is a root stage
+ Stage-2 depends on stages: Stage-1
+ Stage-0 is a root stage
+
+STAGE PLANS:
+ Stage: Stage-1
+ Map Reduce
+ Alias -> Map Operator Tree:
+ null-subquery2:a-subquery2:a
+ TableScan
+ alias: a
+ Reduce Output Operator
+ key expressions:
+ expr: key
+ type: string
+ sort order: +
+ Map-reduce partition columns:
+ expr: key
+ type: string
+ tag: 0
+ value expressions:
+ expr: key
+ type: string
+ null-subquery2:a-subquery2:b
+ TableScan
+ alias: b
+ Reduce Output Operator
+ key expressions:
+ expr: key
+ type: string
+ sort order: +
+ Map-reduce partition columns:
+ expr: key
+ type: string
+ tag: 1
+ value expressions:
+ expr: key
+ type: string
+ Reduce Operator Tree:
+ Join Operator
+ condition map:
+ Inner Join 0 to 1
+ condition expressions:
+ 0 {VALUE._col0}
+ 1 {VALUE._col0}
+ handleSkewJoin: false
+ outputColumnNames: _col0, _col4
+ Select Operator
+ expressions:
+ expr: UDFToLong(_col0)
+ type: bigint
+ expr: UDFToDouble(_col4)
+ type: double
+ outputColumnNames: _col0, _col1
+ Select Operator
+ expressions:
+ expr: UDFToDouble(_col0)
+ type: double
+ expr: _col1
+ type: double
+ outputColumnNames: _col0, _col1
+ File Output Operator
+ compressed: false
+ GlobalTableId: 0
+ table:
+ input format: org.apache.hadoop.mapred.SequenceFileInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveSequenceFileOutputFormat
+
+ Stage: Stage-2
+ Map Reduce
+ Alias -> Map Operator Tree:
+#### A masked pattern was here ####
+ TableScan
+ Union
+ Select Operator
+ expressions:
+ expr: _col0
+ type: double
+ expr: _col1
+ type: double
+ outputColumnNames: _col0, _col1
+ Reduce Output Operator
+ key expressions:
+ expr: _col0
+ type: double
+ sort order: +
+ tag: -1
+ value expressions:
+ expr: _col0
+ type: double
+ expr: _col1
+ type: double
+ null-subquery1:a-subquery1:t2
+ TableScan
+ alias: t2
+ Select Operator
+ expressions:
+ expr: UDFToDouble(key)
+ type: double
+ expr: key
+ type: string
+ outputColumnNames: _col0, _col1
+ Select Operator
+ expressions:
+ expr: _col0
+ type: double
+ expr: UDFToDouble(_col1)
+ type: double
+ outputColumnNames: _col0, _col1
+ Union
+ Select Operator
+ expressions:
+ expr: _col0
+ type: double
+ expr: _col1
+ type: double
+ outputColumnNames: _col0, _col1
+ Reduce Output Operator
+ key expressions:
+ expr: _col0
+ type: double
+ sort order: +
+ tag: -1
+ value expressions:
+ expr: _col0
+ type: double
+ expr: _col1
+ type: double
+ Reduce Operator Tree:
+ Extract
+ 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
+
+
+PREHOOK: query: SELECT * FROM
+(SELECT CAST(key AS DOUBLE) AS key, CAST(key AS STRING) AS value FROM t2
+UNION ALL
+SELECT CAST(a.key AS BIGINT) AS key, CAST(b.key AS DOUBLE) AS value FROM t1 a JOIN t2 b ON a.key = b.key) a
+ORDER BY key
+PREHOOK: type: QUERY
+PREHOOK: Input: default@t1
+PREHOOK: Input: default@t2
+#### A masked pattern was here ####
+POSTHOOK: query: SELECT * FROM
+(SELECT CAST(key AS DOUBLE) AS key, CAST(key AS STRING) AS value FROM t2
+UNION ALL
+SELECT CAST(a.key AS BIGINT) AS key, CAST(b.key AS DOUBLE) AS value FROM t1 a JOIN t2 b ON a.key = b.key) a
+ORDER BY key
+POSTHOOK: type: QUERY
+POSTHOOK: Input: default@t1
+POSTHOOK: Input: default@t2
+#### A masked pattern was here ####
+0.0 0.0
+0.0 0.0
+0.0 0.0
+0.0 0.0
+0.0 0.0
+0.0 0.0
+0.0 0.0
+0.0 0.0
+0.0 0.0
+0.0 0.0
+0.0 0.0
+0.0 0.0
+2.0 2.0
+2.0 2.0
+4.0 4.0
+4.0 4.0
+5.0 5.0
+5.0 5.0
+5.0 5.0
+5.0 5.0
+5.0 5.0
+5.0 5.0
+5.0 5.0
+5.0 5.0
+5.0 5.0
+5.0 5.0
+5.0 5.0
+5.0 5.0
+8.0 8.0
+8.0 8.0
+9.0 9.0
+9.0 9.0
Index: ql/src/test/results/clientpositive/ql_rewrite_gbtoidx.q.out
===================================================================
--- ql/src/test/results/clientpositive/ql_rewrite_gbtoidx.q.out (revision 1399780)
+++ ql/src/test/results/clientpositive/ql_rewrite_gbtoidx.q.out (working copy)
@@ -1207,20 +1207,27 @@
expr: l_orderkey
type: int
outputColumnNames: _col0, _col1
- Union
- Select Operator
- expressions:
- expr: _col0
- type: string
- expr: _col1
- type: bigint
- outputColumnNames: _col0, _col1
- File Output Operator
- compressed: false
- GlobalTableId: 0
- table:
- input format: org.apache.hadoop.mapred.TextInputFormat
- output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+ Select Operator
+ expressions:
+ expr: _col0
+ type: string
+ expr: UDFToLong(_col1)
+ type: bigint
+ outputColumnNames: _col0, _col1
+ Union
+ Select Operator
+ expressions:
+ expr: _col0
+ type: string
+ expr: _col1
+ type: bigint
+ outputColumnNames: _col0, _col1
+ 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
Index: ql/src/test/results/clientpositive/groupby_sort_1.q.out
===================================================================
--- ql/src/test/results/clientpositive/groupby_sort_1.q.out (revision 1399780)
+++ ql/src/test/results/clientpositive/groupby_sort_1.q.out (working copy)
@@ -2671,50 +2671,57 @@
expr: _col1
type: bigint
outputColumnNames: _col0, _col1
- Union
- Select Operator
- expressions:
- expr: _col0
- type: double
- expr: _col1
- type: bigint
- outputColumnNames: _col0, _col1
+ Select Operator
+ expressions:
+ expr: UDFToDouble(_col0)
+ type: double
+ expr: _col1
+ type: bigint
+ outputColumnNames: _col0, _col1
+ Union
Select Operator
expressions:
- expr: UDFToInteger(_col0)
- type: int
- expr: UDFToInteger(_col1)
- type: int
+ expr: _col0
+ type: double
+ expr: _col1
+ type: bigint
outputColumnNames: _col0, _col1
- File Output Operator
- compressed: false
- GlobalTableId: 1
+ Select Operator
+ expressions:
+ expr: UDFToInteger(_col0)
+ type: int
+ expr: UDFToInteger(_col1)
+ type: int
+ outputColumnNames: _col0, _col1
+ File Output Operator
+ compressed: false
+ GlobalTableId: 1
#### A masked pattern was here ####
- NumFilesPerFileSink: 1
+ NumFilesPerFileSink: 1
#### A masked pattern was here ####
- table:
- input format: org.apache.hadoop.mapred.TextInputFormat
- output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
- properties:
- bucket_count -1
- columns key,cnt
- columns.types int:int
+ table:
+ input format: org.apache.hadoop.mapred.TextInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+ properties:
+ bucket_count -1
+ columns key,cnt
+ columns.types int:int
#### A masked pattern was here ####
- name default.outputtbl1
- numFiles 1
- numPartitions 0
- numRows 10
- rawDataSize 30
- serialization.ddl struct outputtbl1 { i32 key, i32 cnt}
- serialization.format 1
- serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
- totalSize 40
+ name default.outputtbl1
+ numFiles 1
+ numPartitions 0
+ numRows 10
+ rawDataSize 30
+ serialization.ddl struct outputtbl1 { i32 key, i32 cnt}
+ serialization.format 1
+ serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+ totalSize 40
#### A masked pattern was here ####
- serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
- name: default.outputtbl1
- TotalFiles: 1
- GatherStats: true
- MultiFileSpray: false
+ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+ name: default.outputtbl1
+ TotalFiles: 1
+ GatherStats: true
+ MultiFileSpray: false
Needs Tagging: false
Path -> Alias:
#### A masked pattern was here ####
@@ -2897,16 +2904,16 @@
POSTHOOK: Lineage: outputtbl4.key3 SIMPLE [(t1)t1.FieldSchema(name:val, type:string, comment:null), ]
POSTHOOK: Lineage: t1.key SIMPLE [(t1)t1.FieldSchema(name:key, type:string, comment:null), ]
POSTHOOK: Lineage: t1.val SIMPLE [(t1)t1.FieldSchema(name:val, type:string, comment:null), ]
-NULL 1
-NULL 1
-NULL 1
-NULL 1
-NULL 2
1 1
2 1
+2 1
3 1
+4 1
+6 1
7 1
8 2
+14 1
+16 2
PREHOOK: query: -- group by followed by a join
EXPLAIN EXTENDED
INSERT OVERWRITE TABLE outputTbl1
@@ -3131,11 +3138,11 @@
numFiles 2
numPartitions 0
numRows 10
- rawDataSize 35
+ rawDataSize 32
serialization.ddl struct outputtbl1 { i32 key, i32 cnt}
serialization.format 1
serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
- totalSize 45
+ totalSize 42
#### A masked pattern was here ####
serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
name: default.outputtbl1
@@ -3162,11 +3169,11 @@
numFiles 2
numPartitions 0
numRows 10
- rawDataSize 35
+ rawDataSize 32
serialization.ddl struct outputtbl1 { i32 key, i32 cnt}
serialization.format 1
serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
- totalSize 45
+ totalSize 42
#### A masked pattern was here ####
serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
name: default.outputtbl1
Index: ql/src/test/results/clientpositive/skewjoinopt11.q.out
===================================================================
--- ql/src/test/results/clientpositive/skewjoinopt11.q.out (revision 1399780)
+++ ql/src/test/results/clientpositive/skewjoinopt11.q.out (working copy)
@@ -25,7 +25,7 @@
PREHOOK: query: -- This test is to verify the skew join compile optimization when the join is followed
-- by a union. Both sides of a union consist of a join, which should have used
-- skew join compile time optimization.
--- adding a order by at the end to make the results deterministic
+-- adding an order by at the end to make the results deterministic
EXPLAIN
select * from
@@ -38,7 +38,7 @@
POSTHOOK: query: -- This test is to verify the skew join compile optimization when the join is followed
-- by a union. Both sides of a union consist of a join, which should have used
-- skew join compile time optimization.
--- adding a order by at the end to make the results deterministic
+-- adding an order by at the end to make the results deterministic
EXPLAIN
select * from
Index: ql/src/test/results/clientpositive/type_widening.q.out
===================================================================
--- ql/src/test/results/clientpositive/type_widening.q.out (revision 1399780)
+++ ql/src/test/results/clientpositive/type_widening.q.out (working copy)
@@ -68,21 +68,26 @@
expr: 0
type: int
outputColumnNames: _col0
- Union
- Select Operator
- expressions:
- expr: _col0
- type: bigint
- outputColumnNames: _col0
- Reduce Output Operator
- key expressions:
+ Select Operator
+ expressions:
+ expr: UDFToLong(_col0)
+ type: bigint
+ outputColumnNames: _col0
+ Union
+ Select Operator
+ expressions:
expr: _col0
type: bigint
- sort order: +
- tag: -1
- value expressions:
- expr: _col0
- type: bigint
+ outputColumnNames: _col0
+ Reduce Output Operator
+ key expressions:
+ expr: _col0
+ type: bigint
+ sort order: +
+ tag: -1
+ value expressions:
+ expr: _col0
+ type: bigint
null-subquery2:a-subquery2:src
TableScan
alias: src
Index: ql/src/test/results/clientpositive/groupby_sort_skew_1.q.out
===================================================================
--- ql/src/test/results/clientpositive/groupby_sort_skew_1.q.out (revision 1399780)
+++ ql/src/test/results/clientpositive/groupby_sort_skew_1.q.out (working copy)
@@ -3012,50 +3012,57 @@
expr: _col1
type: bigint
outputColumnNames: _col0, _col1
- Union
- Select Operator
- expressions:
- expr: _col0
- type: double
- expr: _col1
- type: bigint
- outputColumnNames: _col0, _col1
+ Select Operator
+ expressions:
+ expr: UDFToDouble(_col0)
+ type: double
+ expr: _col1
+ type: bigint
+ outputColumnNames: _col0, _col1
+ Union
Select Operator
expressions:
- expr: UDFToInteger(_col0)
- type: int
- expr: UDFToInteger(_col1)
- type: int
+ expr: _col0
+ type: double
+ expr: _col1
+ type: bigint
outputColumnNames: _col0, _col1
- File Output Operator
- compressed: false
- GlobalTableId: 1
+ Select Operator
+ expressions:
+ expr: UDFToInteger(_col0)
+ type: int
+ expr: UDFToInteger(_col1)
+ type: int
+ outputColumnNames: _col0, _col1
+ File Output Operator
+ compressed: false
+ GlobalTableId: 1
#### A masked pattern was here ####
- NumFilesPerFileSink: 1
+ NumFilesPerFileSink: 1
#### A masked pattern was here ####
- table:
- input format: org.apache.hadoop.mapred.TextInputFormat
- output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
- properties:
- bucket_count -1
- columns key,cnt
- columns.types int:int
+ table:
+ input format: org.apache.hadoop.mapred.TextInputFormat
+ output format: org.apache.hadoop.hive.ql.io.HiveIgnoreKeyTextOutputFormat
+ properties:
+ bucket_count -1
+ columns key,cnt
+ columns.types int:int
#### A masked pattern was here ####
- name default.outputtbl1
- numFiles 1
- numPartitions 0
- numRows 10
- rawDataSize 30
- serialization.ddl struct outputtbl1 { i32 key, i32 cnt}
- serialization.format 1
- serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
- totalSize 40
+ name default.outputtbl1
+ numFiles 1
+ numPartitions 0
+ numRows 10
+ rawDataSize 30
+ serialization.ddl struct outputtbl1 { i32 key, i32 cnt}
+ serialization.format 1
+ serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+ totalSize 40
#### A masked pattern was here ####
- serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
- name: default.outputtbl1
- TotalFiles: 1
- GatherStats: true
- MultiFileSpray: false
+ serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
+ name: default.outputtbl1
+ TotalFiles: 1
+ GatherStats: true
+ MultiFileSpray: false
Needs Tagging: false
Path -> Alias:
#### A masked pattern was here ####
@@ -3238,16 +3245,16 @@
POSTHOOK: Lineage: outputtbl4.key3 SIMPLE [(t1)t1.FieldSchema(name:val, type:string, comment:null), ]
POSTHOOK: Lineage: t1.key SIMPLE [(t1)t1.FieldSchema(name:key, type:string, comment:null), ]
POSTHOOK: Lineage: t1.val SIMPLE [(t1)t1.FieldSchema(name:val, type:string, comment:null), ]
-NULL 1
-NULL 1
-NULL 1
-NULL 1
-NULL 2
1 1
2 1
+2 1
3 1
+4 1
+6 1
7 1
8 2
+14 1
+16 2
PREHOOK: query: -- group by followed by a join
EXPLAIN EXTENDED
INSERT OVERWRITE TABLE outputTbl1
@@ -3472,11 +3479,11 @@
numFiles 2
numPartitions 0
numRows 10
- rawDataSize 35
+ rawDataSize 32
serialization.ddl struct outputtbl1 { i32 key, i32 cnt}
serialization.format 1
serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
- totalSize 45
+ totalSize 42
#### A masked pattern was here ####
serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
name: default.outputtbl1
@@ -3503,11 +3510,11 @@
numFiles 2
numPartitions 0
numRows 10
- rawDataSize 35
+ rawDataSize 32
serialization.ddl struct outputtbl1 { i32 key, i32 cnt}
serialization.format 1
serialization.lib org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
- totalSize 45
+ totalSize 42
#### A masked pattern was here ####
serde: org.apache.hadoop.hive.serde2.lazy.LazySimpleSerDe
name: default.outputtbl1
Index: ql/src/test/results/compiler/plan/union.q.xml
===================================================================
--- ql/src/test/results/compiler/plan/union.q.xml (revision 1399780)
+++ ql/src/test/results/compiler/plan/union.q.xml (working copy)
@@ -92,21 +92,21 @@
- FS_665
+ FS_12