PageRenderTime 33ms CodeModel.GetById 10ms RepoModel.GetById 1ms 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
Possible License(s): Apache-2.0, BSD-3-Clause, JSON, CPL-1.0
  1. set hive.map.aggr = true;
  2. -- union case: all subqueries are a map-reduce jobs, 3 way union, same input for all sub-queries, followed by filesink
  3. create table tmptable(key string, value int);
  4. explain
  5. insert overwrite table tmptable
  6. select unionsrc.key, unionsrc.value FROM (select 'tst1' as key, count(1) as value from src s1
  7. UNION ALL
  8. select 'tst2' as key, count(1) as value from src s2
  9. UNION ALL
  10. select 'tst3' as key, count(1) as value from src s3) unionsrc;
  11. insert overwrite table tmptable
  12. select unionsrc.key, unionsrc.value FROM (select 'tst1' as key, count(1) as value from src s1
  13. UNION ALL
  14. select 'tst2' as key, count(1) as value from src s2
  15. UNION ALL
  16. select 'tst3' as key, count(1) as value from src s3) unionsrc;
  17. select * from tmptable x sort by x.key;