Hive和MapReduce将多级子目录作为输入

默认在hive中,输入的数据只能有一级,比如

create external table if not exists test(id string, name string) row format delimited fields terminated by ',' location '/stb/test'

那么只能加载test目录下的数据,比如test/11.log,test/22.log。不能加载test/11/11.log,test/22/22.log。

所以在hive中,需要设置使得能迭代加载目录。设置如下2个属性

set hive.mapred.supports.subdirectories=true;

set mapreduce.input.fileinputformat.input.dir.recursive=true;

这样就可以迭代加载子目录的数据了。

因为hive底层还是mapreduce。所以mapreduce如果想要迭代加载子目录的属性,也需要设置如下属性:

mapreduce.input.fileinputformat.input.dir.recursive=true

参考:MapReduce和Hive支持递归子目录作为输入

 

转载于:https://my.oschina.net/cjun/blog/664304

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值