我在配置单元中有n(大)个小尺寸的txt文件

z8dt9xmd  于 2021-05-27  发布在  Hadoop
关注(0)|答案(1)|浏览(294)

我有n(大)个小尺寸的txt文件,我想合并成k(小)个文件

unguejic

unguejic1#

如果你有 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 子句启动多个减速机。

insert overwrite <db>.<existing_table> select * from <db>.<existing_table> sort by <col_name>;

相关问题