hive建表设置如果为null_Hive创建空表,即使有很多文件

I put some files into hdfs (/path/to/directory/) which contain data like following;

63 EB44863EA74AA0C5D3ECF3D678A7DF59

62 FABBC9ED9719A5030B2F6A4591EDB180

59 6BF6D40AF15DE2D7E295EAFB9574BBF8

All of them named as _user_hive_warehouse_file_name_000XYZ_A. These files had downloaded from another hdfs.

I'm trying to create external table via Hive;

CREATE EXTERNAL TABLE users(

id int,

user string

)

ROW FORMAT DELIMITED FIELDS TERMINATED BY '\t'

LOCATION '/path/to/directory/';

It says;

OK

Time taken: 0.098 seconds

select * from users; returns empty.

select count(1) from users; returns 0.

Hive creates the table successfully, but it's always empty. If I put another file like another.txt, that contains the sample data mentioned above, select count(1) from users; returns 3.

What am I missing, why the table is empty?

Environment:

JDK 7

Hadoop 2.6.0

Hive 0.14.0

Ubuntu 14.04

解决方案

I think you are encountering an issue that is peripherally discussed in HIVE-6431. In particular, this comment is the important one:

By default, FileInputFormat(which is the super class of various formats) in hadoop ignores file name starts with "_" or ".", and hard to walk around this in hive codebase.

The workaround is probably to avoid using filenames that begin with _ or .

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

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

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

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值