gpt4 book ai didi

apache - Hive在处理小数据表插入时是否有问题?

转载 作者:行者123 更新时间:2023-12-02 21:31:07 26 4
gpt4 key购买 nike

有人告诉我,任何配置任务作业都会消耗32 GB的内存或群集中的大量内存,而执行琐碎的行插入操作会导致创建许多小文件。

这是真的?

使用Hive插入少量数据本来就是错误的吗?

最佳答案

小文件本身可能是Hadoop的问题。当您在配置单元中插入单独的行时,每一行将保存到不同的文件。每次插入操作需要几秒钟。您可以在以下示例中看到。我已将3行插入到 hive 表中,并创建了3个2字节文件。您应该避免在Hive中插入少量数据。这可能会导致诸如名称节点的内存不足之类的问题,因为文件的元数据将存储在内存中。

create table testing (t int);
insert into table testing values (1);
insert into table testing values (2);
insert into table testing values (3);

dfs -ls /apps/hive/warehouse/testing;
-rwxrwxrwx 1 root hdfs 2 2015-12-08 23:59 /apps/hive/warehouse/testing/000000_0
-rwxrwxrwx 1 root hdfs 2 2015-12-08 23:59 /apps/hive/warehouse/testing/000000_0_copy_1
-rwxrwxrwx 1 root hdfs 2 2015-12-08 23:59 /apps/hive/warehouse/testing/000000_0_copy_2

关于apache - Hive在处理小数据表插入时是否有问题?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/34167741/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com