我有n(大)个小尺寸的txt文件,我想合并成k(小)个文件
unguejic1#
如果你有 hive table 最重要的是 txt files 然后使用
hive table
txt files
insert overwrite <db>.<existing_table> select * from <db>.<existing_table> order by <col_name>;
配置单元支持选择和覆盖同一个表,order by子句将 force to run 1 reducer 这将导致在目录中只创建一个文件。但是如果你有大量的数据 order by 子句执行不好,则使用 sort by (or) clustered by 子句启动多个减速机。
force to run 1 reducer
order by
sort by (or) clustered by
insert overwrite <db>.<existing_table> select * from <db>.<existing_table> sort by <col_name>;
1条答案
按热度按时间unguejic1#
如果你有
hive table
最重要的是txt files
然后使用配置单元支持选择和覆盖同一个表,order by子句将
force to run 1 reducer
这将导致在目录中只创建一个文件。但是如果你有大量的数据
order by
子句执行不好,则使用sort by (or) clustered by
子句启动多个减速机。