我在hive中编写了insert overwrite partition来将分区中的所有文件合并到更大的文件中,
SQL:
SET hive.exec.compress.output=true;
set hive.merge.smallfiles.avgsize=2560000000;
set hive.merge.mapredfiles=true;
set hive.merge.mapfiles =true;
SET mapreduce.max.split.size=256000000;
SET mapreduce.min.split.size=256000000;
SET mapreduce.output.fileoutputformat.compress.type =BLOCK;
SET hive.hadoop.supports.splittable.combineinputformat=true;
SET mapreduce.output.fileoutputformat.compress.codec=${v_compression_codec};
INSERT OVERWRITE TABLE ${source_database}.${table_name} PARTITION (${line}) \n SELECT ${prepare_sel_columns} \n from ${source_database}.${table_name} \n WHERE ${partition_where_clause};\n"
使用上面的设置我得到压缩输出,但生成输出文件所需的时间太长。
即使它只运行地图作业,也需要花费很多时间。
从hive端寻找任何进一步的设置,以调整Insert以更快地运行。
度量。
15 GB文件==>花10分钟。
答案 0 :(得分:1)
SET hive.exec.compress.output=true; SET mapreduce.input.fileinputformat.split.minsize=512000000; SET mapreduce.input.fileinputformat.split.maxsize=5120000000; SET mapreduce.output.fileoutputformat.compress.type =BLOCK; SET hive.hadoop.supports.splittable.combineinputformat=true; SET mapreduce.output.fileoutputformat.compress.codec=${v_compression_codec};
上述设置帮助很多,持续时间从10分钟下降到1分钟。