HIVE-18100 : Some tests time out
Project: http://git-wip-us.apache.org/repos/asf/hive/repo Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/b5ba8273 Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/b5ba8273 Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/b5ba8273 Branch: refs/heads/master Commit: b5ba82738337284d5a73bfddce11beb2c88c3ce2 Parents: c7aa7b6 Author: Ashutosh Chauhan <hashut...@apache.org> Authored: Fri Nov 17 17:28:15 2017 -0800 Committer: Ashutosh Chauhan <hashut...@apache.org> Committed: Wed Nov 22 08:26:09 2017 -0800 ---------------------------------------------------------------------- .../test/resources/testconfiguration.properties | 7 +- .../queries/clientpositive/explainanalyze_1.q | 8 + .../queries/clientpositive/explainanalyze_2.q | 8 - .../queries/clientpositive/unionDistinct_1.q | 315 +- .../queries/clientpositive/unionDistinct_2.q | 23 - .../queries/clientpositive/unionDistinct_3.q | 182 + .../clientpositive/llap/explainanalyze_2.q.out | 2093 ++ .../clientpositive/llap/unionDistinct_1.q.out | 22877 +++++++---------- .../clientpositive/llap/unionDistinct_2.q.out | 108 - .../clientpositive/llap/unionDistinct_3.q.out | 2650 ++ .../clientpositive/tez/explainanalyze_1.q.out | 58 + .../clientpositive/tez/explainanalyze_2.q.out | 2151 -- .../clientpositive/tez/unionDistinct_2.q.out | 553 - 13 files changed, 14166 insertions(+), 16867 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/hive/blob/b5ba8273/itests/src/test/resources/testconfiguration.properties ---------------------------------------------------------------------- diff --git a/itests/src/test/resources/testconfiguration.properties b/itests/src/test/resources/testconfiguration.properties index 5d17733..ab3cd43 100644 --- a/itests/src/test/resources/testconfiguration.properties +++ b/itests/src/test/resources/testconfiguration.properties @@ -43,7 +43,6 @@ disabled.query.files=ql_rewrite_gbtoidx.q,\ minitez.query.files.shared=delete_orig_table.q,\ orc_merge12.q,\ orc_vectorization_ppd.q,\ - unionDistinct_2.q,\ update_orig_table.q,\ vector_join_part_col_char.q,\ vector_non_string_partition.q,\ @@ -55,7 +54,6 @@ minitez.query.files.shared=delete_orig_table.q,\ minitez.query.files=acid_vectorization_original_tez.q,\ explainuser_3.q,\ explainanalyze_1.q,\ - explainanalyze_2.q,\ explainanalyze_3.q,\ explainanalyze_4.q,\ explainanalyze_5.q,\ @@ -80,7 +78,6 @@ minillap.shared.query.files=insert_into1.q,\ orc_merge_diff_fs.q,\ parallel_colstats.q,\ parquet_types_vectorization.q,\ - unionDistinct_1.q,\ union_type_chk.q,\ cte_2.q,\ cte_4.q,\ @@ -467,7 +464,6 @@ minillap.query.files=acid_bucket_pruning.q,\ temp_table_external.q,\ table_nonprintable.q,\ llap_nullscan.q,\ - unionDistinct_1.q,\ rcfile_merge2.q,\ rcfile_merge3.q,\ rcfile_merge4.q,\ @@ -477,6 +473,7 @@ minillap.query.files=acid_bucket_pruning.q,\ dynamic_partition_pruning_2.q,\ tez_union_dynamic_partition.q,\ tez_union_dynamic_partition_2.q,\ + unionDistinct_1.q,\ load_fs2.q,\ llap_stats.q,\ multi_count_distinct_null.q @@ -540,6 +537,7 @@ minillaplocal.query.files=\ escape1.q,\ escape2.q,\ exchgpartition2lel.q,\ + explainanalyze_2.q,\ explainuser_1.q,\ explainuser_4.q,\ groupby2.q,\ @@ -801,6 +799,7 @@ minillaplocal.query.files=\ smb_mapjoin_17.q,\ groupby_resolution.q,\ windowing_windowspec2.q,\ + unionDistinct_3.q,\ vectorized_join46.q,\ vectorized_multi_output_select.q,\ partialdhj.q http://git-wip-us.apache.org/repos/asf/hive/blob/b5ba8273/ql/src/test/queries/clientpositive/explainanalyze_1.q ---------------------------------------------------------------------- diff --git a/ql/src/test/queries/clientpositive/explainanalyze_1.q b/ql/src/test/queries/clientpositive/explainanalyze_1.q index 0a33a4f..6611922 100644 --- a/ql/src/test/queries/clientpositive/explainanalyze_1.q +++ b/ql/src/test/queries/clientpositive/explainanalyze_1.q @@ -37,3 +37,11 @@ set hive.auto.convert.join.noconditionaltask.size=10000; EXPLAIN analyze SELECT x.key, y.value FROM src x JOIN src y ON (x.key = y.key); + +set hive.entity.capture.transform=true; +explain analyze +SELECT +TRANSFORM(a.key, a.value) USING 'cat' AS (tkey, tvalue) +FROM src a join src b +on a.key = b.key; + http://git-wip-us.apache.org/repos/asf/hive/blob/b5ba8273/ql/src/test/queries/clientpositive/explainanalyze_2.q ---------------------------------------------------------------------- diff --git a/ql/src/test/queries/clientpositive/explainanalyze_2.q b/ql/src/test/queries/clientpositive/explainanalyze_2.q index b764d7d..dd515ec 100644 --- a/ql/src/test/queries/clientpositive/explainanalyze_2.q +++ b/ql/src/test/queries/clientpositive/explainanalyze_2.q @@ -1,7 +1,6 @@ set hive.map.aggr=false; set hive.strict.checks.bucketing=false; - set hive.explain.user=true; explain analyze @@ -139,13 +138,6 @@ INSERT OVERWRITE TABLE DEST2 SELECT unionsrc.key, unionsrc.value, COUNT(DISTINCT explain analyze FROM UNIQUEJOIN PRESERVE src a (a.key), PRESERVE src1 b (b.key), PRESERVE srcpart c (c.key) SELECT a.key, b.key, c.key; -set hive.entity.capture.transform=true; - -explain analyze -SELECT -TRANSFORM(a.key, a.value) USING 'cat' AS (tkey, tvalue) -FROM src a join src b -on a.key = b.key; explain analyze FROM ( http://git-wip-us.apache.org/repos/asf/hive/blob/b5ba8273/ql/src/test/queries/clientpositive/unionDistinct_1.q ---------------------------------------------------------------------- diff --git a/ql/src/test/queries/clientpositive/unionDistinct_1.q b/ql/src/test/queries/clientpositive/unionDistinct_1.q index f2a0dc1..4978b56 100644 --- a/ql/src/test/queries/clientpositive/unionDistinct_1.q +++ b/ql/src/test/queries/clientpositive/unionDistinct_1.q @@ -1,3 +1,4 @@ +set hive.llap.execution.mode=auto; set hive.mapred.mode=nonstrict; set hive.explain.user=false; -- SORT_QUERY_RESULTS @@ -27,27 +28,6 @@ insert overwrite table tmptable select * from tmptable x sort by x.key; --- union11.q - - --- SORT_BEFORE_DIFF --- union case: all subqueries are a map-reduce jobs, 3 way union, same input for all sub-queries, followed by reducesink - -explain - select unionsrc.key, count(1) FROM (select 'tst1' as key, count(1) as value from src s1 - UNION DISTINCT - select 'tst2' as key, count(1) as value from src s2 - UNION DISTINCT - select 'tst3' as key, count(1) as value from src s3) unionsrc group by unionsrc.key; - - - select unionsrc.key, count(1) FROM (select 'tst1' as key, count(1) as value from src s1 - UNION DISTINCT - select 'tst2' as key, count(1) as value from src s2 - UNION DISTINCT - select 'tst3' as key, count(1) as value from src s3) unionsrc group by unionsrc.key; - - -- union12.q @@ -85,110 +65,6 @@ explain select unionsrc.key, unionsrc.value FROM (select s1.key as key, s1.value as value from src s1 UNION DISTINCT select s2.key as key, s2.value as value from src s2) unionsrc; --- union14.q - - --- SORT_BEFORE_DIFF --- union case: 1 subquery is a map-reduce job, different inputs for sub-queries, followed by reducesink - -explain - select unionsrc.key, count(1) FROM (select s2.key as key, s2.value as value from src1 s2 - UNION DISTINCT - select 'tst1' as key, cast(count(1) as string) as value from src s1) - unionsrc group by unionsrc.key; - - - - select unionsrc.key, count(1) FROM (select s2.key as key, s2.value as value from src1 s2 - UNION DISTINCT - select 'tst1' as key, cast(count(1) as string) as value from src s1) - unionsrc group by unionsrc.key; --- union15.q - - --- SORT_BEFORE_DIFF --- union case: 1 subquery is a map-reduce job, different inputs for sub-queries, followed by reducesink - -explain - select unionsrc.key, count(1) FROM (select 'tst1' as key, cast(count(1) as string) as value from src s1 - UNION DISTINCT - select s2.key as key, s2.value as value from src1 s2 - UNION DISTINCT - select s3.key as key, s3.value as value from src1 s3) unionsrc group by unionsrc.key; - - select unionsrc.key, count(1) FROM (select 'tst1' as key, cast(count(1) as string) as value from src s1 - UNION DISTINCT - select s2.key as key, s2.value as value from src1 s2 - UNION DISTINCT - select s3.key as key, s3.value as value from src1 s3) unionsrc group by unionsrc.key; - - --- union16.q - --- SORT_BEFORE_DIFF -EXPLAIN -SELECT count(1) FROM ( - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src) src; - - -SELECT count(1) FROM ( - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src UNION DISTINCT - SELECT key, value FROM src) src; -- union17.q CREATE TABLE DEST1(key STRING, value STRING) STORED AS TEXTFILE; @@ -261,76 +137,6 @@ SELECT DEST119.* FROM DEST119 SORT BY DEST119.key, DEST119.value; SELECT DEST219.* FROM DEST219 SORT BY DEST219.key, DEST219.val1, DEST219.val2; - --- union2.q - --- SORT_BEFORE_DIFF --- union case: both subqueries are map-reduce jobs on same input, followed by reduce sink - -explain - select count(1) FROM (select s1.key as key, s1.value as value from src s1 UNION DISTINCT - select s2.key as key, s2.value as value from src s2) unionsrc; - -select count(1) FROM (select s1.key as key, s1.value as value from src s1 UNION DISTINCT - select s2.key as key, s2.value as value from src s2) unionsrc; --- union20.q - --- SORT_BEFORE_DIFF --- union :map-reduce sub-queries followed by join - -explain -SELECT unionsrc1.key, unionsrc1.value, unionsrc2.key, unionsrc2.value -FROM (select 'tst1' as key, cast(count(1) as string) as value from src s1 - UNION DISTINCT - select s2.key as key, s2.value as value from src s2 where s2.key < 10) unionsrc1 -JOIN - (select 'tst1' as key, cast(count(1) as string) as value from src s3 - UNION DISTINCT - select s4.key as key, s4.value as value from src s4 where s4.key < 10) unionsrc2 -ON (unionsrc1.key = unionsrc2.key); - -SELECT unionsrc1.key, unionsrc1.value, unionsrc2.key, unionsrc2.value -FROM (select 'tst1' as key, cast(count(1) as string) as value from src s1 - UNION DISTINCT - select s2.key as key, s2.value as value from src s2 where s2.key < 10) unionsrc1 -JOIN - (select 'tst1' as key, cast(count(1) as string) as value from src s3 - UNION DISTINCT - select s4.key as key, s4.value as value from src s4 where s4.key < 10) unionsrc2 -ON (unionsrc1.key = unionsrc2.key); --- union21.q - --- SORT_BEFORE_DIFF --- union of constants, udf outputs, and columns from text table and thrift table - -explain -SELECT key, count(1) -FROM ( - SELECT '1' as key from src - UNION DISTINCT - SELECT reverse(key) as key from src - UNION DISTINCT - SELECT key as key from src - UNION DISTINCT - SELECT astring as key from src_thrift - UNION DISTINCT - SELECT lstring[0] as key from src_thrift -) union_output -GROUP BY key; - -SELECT key, count(1) -FROM ( - SELECT '1' as key from src - UNION DISTINCT - SELECT reverse(key) as key from src - UNION DISTINCT - SELECT key as key from src - UNION DISTINCT - SELECT astring as key from src_thrift - UNION DISTINCT - SELECT lstring[0] as key from src_thrift -) union_output -GROUP BY key; -- union22.q -- SORT_QUERY_RESULTS @@ -819,11 +625,8 @@ insert overwrite table t6 select * from t5; select * from t6; -drop table t1; -drop table t2; -create table t1 as select * from src where key < 10; -create table t2 as select key, count(1) as cnt from src where key < 10 group by key; +create table t9 as select key, count(1) as cnt from src where key < 10 group by key; create table t7(c1 string, cnt int); create table t8(c1 string, cnt int); @@ -833,7 +636,7 @@ from ( select key as c1, count(1) as cnt from t1 group by key UNION DISTINCT - select key as c1, cnt from t2 + select key as c1, cnt from t9 ) x insert overwrite table t7 select c1, count(1) group by c1 @@ -844,7 +647,7 @@ from ( select key as c1, count(1) as cnt from t1 group by key UNION DISTINCT - select key as c1, cnt from t2 + select key as c1, cnt from t9 ) x insert overwrite table t7 select c1, count(1) group by c1 @@ -860,13 +663,6 @@ select * from t8; -- 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 -drop table if exists t1; - -drop table if exists t2; - -CREATE TABLE t1 AS SELECT * FROM src WHERE key < 10; -CREATE TABLE t2 AS SELECT * FROM src WHERE key < 10; - -- Test simple union with double EXPLAIN SELECT * FROM @@ -1035,108 +831,5 @@ SELECT * FROM ( UNION DISTINCT SELECT key,value FROM (SELECT * FROM (SELECT * FROM src10_3) sub2 UNION DISTINCT SELECT * FROM src10_4 ) alias0 ) alias1; --- union4.q - - - --- union case: both subqueries are map-reduce jobs on same input, followed by filesink - -drop table if exists tmptable; - -create table tmptable(key string, value int); - -explain -insert overwrite table tmptable - select unionsrc.key, unionsrc.value FROM (select 'tst1' as key, count(1) as value from src s1 - UNION DISTINCT - select 'tst2' as key, count(1) as value from src s2) unionsrc; - -insert overwrite table tmptable -select unionsrc.key, unionsrc.value FROM (select 'tst1' as key, count(1) as value from src s1 - UNION DISTINCT - select 'tst2' as key, count(1) as value from src s2) unionsrc; - -select * from tmptable x sort by x.key; - - --- union5.q - - --- SORT_BEFORE_DIFF --- union case: both subqueries are map-reduce jobs on same input, followed by reduce sink - -explain - select unionsrc.key, count(1) FROM (select 'tst1' as key, count(1) as value from src s1 - UNION DISTINCT - select 'tst2' as key, count(1) as value from src s2) unionsrc group by unionsrc.key; - -select unionsrc.key, count(1) FROM (select 'tst1' as key, count(1) as value from src s1 - UNION DISTINCT - select 'tst2' as key, count(1) as value from src s2) unionsrc group by unionsrc.key; --- union6.q - - --- union case: 1 subquery is a map-reduce job, different inputs for sub-queries, followed by filesink - -drop table if exists tmptable; - -create table tmptable(key string, value string); - -explain -insert overwrite table tmptable - select unionsrc.key, unionsrc.value FROM (select 'tst1' as key, cast(count(1) as string) as value from src s1 - UNION DISTINCT - select s2.key as key, s2.value as value from src1 s2) unionsrc; - -insert overwrite table tmptable -select unionsrc.key, unionsrc.value FROM (select 'tst1' as key, cast(count(1) as string) as value from src s1 - UNION DISTINCT - select s2.key as key, s2.value as value from src1 s2) unionsrc; - -select * from tmptable x sort by x.key, x.value; - - --- union7.q - - - --- SORT_BEFORE_DIFF --- union case: 1 subquery is a map-reduce job, different inputs for sub-queries, followed by reducesink - -explain - select unionsrc.key, count(1) FROM (select 'tst1' as key, cast(count(1) as string) as value from src s1 - UNION DISTINCT - select s2.key as key, s2.value as value from src1 s2) unionsrc group by unionsrc.key; - -select unionsrc.key, count(1) FROM (select 'tst1' as key, cast(count(1) as string) as value from src s1 - UNION DISTINCT - select s2.key as key, s2.value as value from src1 s2) unionsrc group by unionsrc.key; - - --- union8.q - --- SORT_BEFORE_DIFF --- union case: all subqueries are a map-only jobs, 3 way union, same input for all sub-queries, followed by filesink - -explain - select unionsrc.key, unionsrc.value FROM (select s1.key as key, s1.value as value from src s1 UNION DISTINCT - select s2.key as key, s2.value as value from src s2 UNION DISTINCT - select s3.key as key, s3.value as value from src s3) unionsrc; - -select unionsrc.key, unionsrc.value FROM (select s1.key as key, s1.value as value from src s1 UNION DISTINCT - select s2.key as key, s2.value as value from src s2 UNION DISTINCT - select s3.key as key, s3.value as value from src s3) unionsrc; --- union9.q - --- SORT_BEFORE_DIFF --- union case: all subqueries are a map-only jobs, 3 way union, same input for all sub-queries, followed by reducesink - -explain - select count(1) FROM (select s1.key as key, s1.value as value from src s1 UNION DISTINCT - select s2.key as key, s2.value as value from src s2 UNION DISTINCT - select s3.key as key, s3.value as value from src s3) unionsrc; - select count(1) FROM (select s1.key as key, s1.value as value from src s1 UNION DISTINCT - select s2.key as key, s2.value as value from src s2 UNION DISTINCT - select s3.key as key, s3.value as value from src s3) unionsrc; http://git-wip-us.apache.org/repos/asf/hive/blob/b5ba8273/ql/src/test/queries/clientpositive/unionDistinct_2.q ---------------------------------------------------------------------- diff --git a/ql/src/test/queries/clientpositive/unionDistinct_2.q b/ql/src/test/queries/clientpositive/unionDistinct_2.q index 324bf68..da47d38 100644 --- a/ql/src/test/queries/clientpositive/unionDistinct_2.q +++ b/ql/src/test/queries/clientpositive/unionDistinct_2.q @@ -6,21 +6,6 @@ CREATE TABLE u2 as select key, value from src order by key limit 3; CREATE TABLE u3 as select key, value from src order by key desc limit 5; -select * from u1; - -select * from u2; - -select * from u3; - -select key, value from -( -select key, value from u1 -union all -select key, value from u2 -union all -select key as key, value from u3 -) tab; - select key, value from ( select key, value from u1 @@ -57,14 +42,6 @@ union select key as key, value from u3 ) tab; -select distinct * from -( -select key, value from u1 -union all -select key, value from u2 -union all -select key as key, value from u3 -) tab; select distinct * from ( http://git-wip-us.apache.org/repos/asf/hive/blob/b5ba8273/ql/src/test/queries/clientpositive/unionDistinct_3.q ---------------------------------------------------------------------- diff --git a/ql/src/test/queries/clientpositive/unionDistinct_3.q b/ql/src/test/queries/clientpositive/unionDistinct_3.q new file mode 100644 index 0000000..e3cf236 --- /dev/null +++ b/ql/src/test/queries/clientpositive/unionDistinct_3.q @@ -0,0 +1,182 @@ +set hive.mapred.mode=nonstrict; +set hive.explain.user=false; + +-- union2.q + +-- union case: both subqueries are map-reduce jobs on same input, followed by reduce sink + +explain + select count(1) FROM (select s1.key as key, s1.value as value from src s1 UNION DISTINCT + select s2.key as key, s2.value as value from src s2) unionsrc; + +select count(1) FROM (select s1.key as key, s1.value as value from src s1 UNION DISTINCT + select s2.key as key, s2.value as value from src s2) unionsrc; + +-- union6.q + + + +-- union case: 1 subquery is a map-reduce job, different inputs for sub-queries, followed by filesink + +drop table if exists tmptable; + +create table tmptable(key string, value string); + +explain +insert overwrite table tmptable + select unionsrc.key, unionsrc.value FROM (select 'tst1' as key, cast(count(1) as string) as value from src s1 + UNION DISTINCT + select s2.key as key, s2.value as value from src1 s2) unionsrc; + +insert overwrite table tmptable +select unionsrc.key, unionsrc.value FROM (select 'tst1' as key, cast(count(1) as string) as value from src s1 + UNION DISTINCT + select s2.key as key, s2.value as value from src1 s2) unionsrc; + +select * from tmptable x sort by x.key, x.value; + +drop table if exists tmptable; + + +-- union8.q + +-- union case: all subqueries are a map-only jobs, 3 way union, same input for all sub-queries, followed by filesink + +explain + select unionsrc.key, unionsrc.value FROM (select s1.key as key, s1.value as value from src s1 UNION DISTINCT + select s2.key as key, s2.value as value from src s2 UNION DISTINCT + select s3.key as key, s3.value as value from src s3) unionsrc; + +select unionsrc.key, unionsrc.value FROM (select s1.key as key, s1.value as value from src s1 UNION DISTINCT + select s2.key as key, s2.value as value from src s2 UNION DISTINCT + select s3.key as key, s3.value as value from src s3) unionsrc; + +-- union11.q + + +-- union case: all subqueries are a map-reduce jobs, 3 way union, same input for all sub-queries, followed by reducesink + +explain + select unionsrc.key, count(1) FROM (select 'tst1' as key, count(1) as value from src s1 + UNION DISTINCT + select 'tst2' as key, count(1) as value from src s2 + UNION DISTINCT + select 'tst3' as key, count(1) as value from src s3) unionsrc group by unionsrc.key; + + + select unionsrc.key, count(1) FROM (select 'tst1' as key, count(1) as value from src s1 + UNION DISTINCT + select 'tst2' as key, count(1) as value from src s2 + UNION DISTINCT + select 'tst3' as key, count(1) as value from src s3) unionsrc group by unionsrc.key; + +-- union14.q + + +-- union case: 1 subquery is a map-reduce job, different inputs for sub-queries, followed by reducesink + +explain + select unionsrc.key, count(1) FROM (select s2.key as key, s2.value as value from src1 s2 + UNION DISTINCT + select 'tst1' as key, cast(count(1) as string) as value from src s1) + unionsrc group by unionsrc.key; + + + + select unionsrc.key, count(1) FROM (select s2.key as key, s2.value as value from src1 s2 + UNION DISTINCT + select 'tst1' as key, cast(count(1) as string) as value from src s1) + unionsrc group by unionsrc.key; +-- union15.q + + +-- union case: 1 subquery is a map-reduce job, different inputs for sub-queries, followed by reducesink + +explain + select unionsrc.key, count(1) FROM (select 'tst1' as key, cast(count(1) as string) as value from src s1 + UNION DISTINCT + select s2.key as key, s2.value as value from src1 s2 + UNION DISTINCT + select s3.key as key, s3.value as value from src1 s3) unionsrc group by unionsrc.key; + + select unionsrc.key, count(1) FROM (select 'tst1' as key, cast(count(1) as string) as value from src s1 + UNION DISTINCT + select s2.key as key, s2.value as value from src1 s2 + UNION DISTINCT + select s3.key as key, s3.value as value from src1 s3) unionsrc group by unionsrc.key; + +-- union16.q + +EXPLAIN +SELECT count(1) FROM ( + SELECT key, value FROM src UNION DISTINCT + SELECT key, value FROM src UNION DISTINCT + SELECT key, value FROM src UNION DISTINCT + SELECT key, value FROM src UNION DISTINCT + SELECT key, value FROM src) src; + + +SELECT count(1) FROM ( + SELECT key, value FROM src UNION DISTINCT + SELECT key, value FROM src UNION DISTINCT + SELECT key, value FROM src UNION DISTINCT + SELECT key, value FROM src UNION DISTINCT + SELECT key, value FROM src) src; + +-- union20.q + +-- union :map-reduce sub-queries followed by join + +explain +SELECT unionsrc1.key, unionsrc1.value, unionsrc2.key, unionsrc2.value +FROM (select 'tst1' as key, cast(count(1) as string) as value from src s1 + UNION DISTINCT + select s2.key as key, s2.value as value from src s2 where s2.key < 10) unionsrc1 +JOIN + (select 'tst1' as key, cast(count(1) as string) as value from src s3 + UNION DISTINCT + select s4.key as key, s4.value as value from src s4 where s4.key < 10) unionsrc2 +ON (unionsrc1.key = unionsrc2.key); + +SELECT unionsrc1.key, unionsrc1.value, unionsrc2.key, unionsrc2.value +FROM (select 'tst1' as key, cast(count(1) as string) as value from src s1 + UNION DISTINCT + select s2.key as key, s2.value as value from src s2 where s2.key < 10) unionsrc1 +JOIN + (select 'tst1' as key, cast(count(1) as string) as value from src s3 + UNION DISTINCT + select s4.key as key, s4.value as value from src s4 where s4.key < 10) unionsrc2 +ON (unionsrc1.key = unionsrc2.key); +-- union21.q + +-- union of constants, udf outputs, and columns from text table and thrift table + +explain +SELECT key, count(1) +FROM ( + SELECT '1' as key from src + UNION DISTINCT + SELECT reverse(key) as key from src + UNION DISTINCT + SELECT key as key from src + UNION DISTINCT + SELECT astring as key from src_thrift + UNION DISTINCT + SELECT lstring[0] as key from src_thrift +) union_output +GROUP BY key; + +SELECT key, count(1) +FROM ( + SELECT '1' as key from src + UNION DISTINCT + SELECT reverse(key) as key from src + UNION DISTINCT + SELECT key as key from src + UNION DISTINCT + SELECT astring as key from src_thrift + UNION DISTINCT + SELECT lstring[0] as key from src_thrift +) union_output +GROUP BY key; +