hive compaction using insert overwrite partition

Viewed 5835

Trying to address the small files problem by compacting the files under hive partitions by Insert overwrite partition command in hadoop.

Query :

SET hive.exec.compress.output=true;
SET mapred.max.split.size=256000000;
SET mapred.output.compression.type=BLOCK;
SET mapred.output.compression.codec=org.apache.hadoop.io.compress.SnappyCodec;
set hive.merge.mapredfiles=true;
set hive.merge.size.per.task=256000000;
set hive.merge.smallfiles.avgsize=256000000;


INSERT OVERWRITE TABLE tbl1 PARTITION (year=2016, month=03, day=11) 
SELECT col1,col2,col3  from tbl1  
WHERE year=2016 and  month=03 and  day=11;

Input Files:

For testing purpose I have three files under the hive partition (2016/03/11) in HDFS with the size of 40 MB each.

2016/03/11/file1.csv

2016/03/11/file2.csv

2016/03/11/file3.csv

Example my block size is 128 , So I would like to create only one output files. But I am getting 3 different compressed files.

Please help me to get the hive configuration to restrict the output file size. If I am not using the compression I am getting the single file.

Hive Version : 1.1

1 Answers
Related