PageRenderTime 5ms CodeModel.GetById 2ms app.highlight 0ms RepoModel.GetById 2ms app.codeStats 0ms

/tags/release-0.0.0-rc0/hive/external/ql/src/test/queries/clientpositive/union10.q

#
text | 25 lines | 17 code | 8 blank | 0 comment | 0 complexity | 845ed7574dfb023bb86093ea661f8e46 MD5 | raw file
 1set hive.map.aggr = true;
 2
 3-- union case: all subqueries are a map-reduce jobs, 3 way union, same input for all sub-queries, followed by filesink
 4
 5create table tmptable(key string, value int);
 6
 7explain 
 8insert overwrite table tmptable
 9  select unionsrc.key, unionsrc.value FROM (select 'tst1' as key, count(1) as value from src s1
10                                        UNION  ALL  
11                                            select 'tst2' as key, count(1) as value from src s2
12                                        UNION ALL
13                                            select 'tst3' as key, count(1) as value from src s3) unionsrc;
14
15
16insert overwrite table tmptable
17  select unionsrc.key, unionsrc.value FROM (select 'tst1' as key, count(1) as value from src s1
18                                        UNION  ALL  
19                                            select 'tst2' as key, count(1) as value from src s2
20                                        UNION ALL
21                                            select 'tst3' as key, count(1) as value from src s3) unionsrc;
22
23
24select * from tmptable x sort by x.key;
25