外建表 test7 数据放在 /nginx/log4
~# hadoop fs -du -s -h /nginx/log4/*
58.5 M 175.4 M /nginx/log4/000000_0.gz
58.5 M 175.4 M /nginx/log4/000000_1.gz
58.5 M 175.4 M /nginx/log4/000000_2.gz
58.5 M 175.4 M /nginx/log4/000000_3.gz
想法是,把这些文件合并压缩为128M大小的文件,减少文件数量,
运算后,应该生成两个文件 128M + 106M
# hive 表执行
set hive.exec.compress.output=true;
set mapred.output.compress=true;
set mapred.output.compression.codec=org.apache.hadoop.io.compress.GzipCodec;
set io.compression.codecs=org.apache.hadoop.io.compress.GzipCodec;
set hive.merge.size.per.task=134217728;
set mapred.max.split.size=134217728;
create table test8 as select * from test7;
生成的test8 的数据目录在 /hive/test8
~# hadoop fs -du -s -h /hive/test8/*
116.2 M 348.5 M /hive/test8/000000_0.gz
58.1 M 174.2 M /hive/test8/000001_0.gz
58.1 M 174.2 M /hive/test8/000002_0.gz
问题来了,为什么没有按照预想的那样,合并成128M 的gz文件和 100多M的gz文件?