LZ名約山炮

博客园 首页 新随笔 联系 订阅 管理

原因:

  默认情况下 hive.input.format=org.apache.hadoop.hive.ql.io.CombineHiveInputFormat(切片),此设置的功能是将输入目录的小文件进行切片合并,但是误将lzo.index文件也作为数据,故导致读数不准。

解决:

  不使用CombineHiveInputFormat,使用HiveInputFormat即可,set hive.input.format=org.apache.hadoop.hive.ql.io.HiveInputFormat,此设置默认使用表中设置的inputformat进行切片来读数据,使用表的数据格式,这样就不会将索引文件也作为数据处理了

  我们可以在Hive的配置文件中设置(/opt/module/hive/conf/hive-site.xml),设置完成后重启Hive即可

vim /opt/module/hive/conf/hive-site.xml
<!-- 修改CombineHiveInputFormat为HiveInputFormat  -->
<property>
    <name>hive.input.format</name>
    <value>org.apache.hadoop.hive.ql.io.HiveInputFormat</value>
</property>
</configuration>
posted on 2021-06-28 18:36  LZ名約山炮  阅读(111)  评论(0编辑  收藏  举报