PageRenderTime 8ms CodeModel.GetById 1ms app.highlight 2ms RepoModel.GetById 1ms app.codeStats 0ms

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

#
text | 56 lines | 38 code | 18 blank | 0 comment | 0 complexity | 0d7159b2b1817fa52f9d9c0d26e7b76f MD5 | raw file
 1set hive.merge.mapfiles=false;
 2set hive.merge.mapredfiles=false;
 3set hive.input.format=org.apache.hadoop.hive.ql.io.HiveInputFormat;
 4set hive.exec.dynamic.partition=true;
 5set hive.exec.dynamic.partition.mode=nonstrict;
 6
 7create table merge_src as 
 8select key, value from srcpart where ds is not null;
 9
10create table merge_src_part (key string, value string) partitioned by (ds string);
11insert overwrite table merge_src_part partition(ds) select key, value, ds from srcpart where ds is not null;
12
13set hive.merge.mapfiles=true;
14set hive.merge.mapredfiles=true;
15
16explain extended
17create table merge_src2 as 
18select key, value from merge_src;
19
20create table merge_src2 as 
21select key, value from merge_src;
22
23select * from merge_src2;
24
25create table merge_src_part2 like merge_src_part;
26
27
28explain extended 
29insert overwrite table merge_src_part2 partition(ds)
30select key, value, ds from merge_src_part
31where ds is not null;
32 
33insert overwrite table merge_src_part2 partition(ds)
34select key, value, ds from merge_src_part
35where ds is not null;
36
37show partitions merge_src_part2;
38
39select * from merge_src_part2 where ds is not null;
40
41drop table merge_src_part2;
42
43create table merge_src_part2 like merge_src_part;
44
45explain extended
46from (select * from merge_src_part where ds is not null distribute by ds) s
47insert overwrite table merge_src_part2 partition(ds)
48select key, value, ds;
49
50from (select * from merge_src_part where ds is not null distribute by ds) s
51insert overwrite table merge_src_part2 partition(ds)
52select key, value, ds;
53
54show partitions merge_src_part2;
55
56select * from merge_src_part2 where ds is not null;