将CSV数据加载到Hive表时出现错误

5
我有一个CSV文件,其中的行格式如下:
1, 11812, 15273, "2016-05-22T111647.800 US/Eastern", 82971850, 0
1, 11812, 7445, "2016-05-22T113640.200 US/Eastern", 82971928, 0
1, 11654, 322, "2016-05-22T113845.773 US/Eastern", 82971934, 0
1, 11722, 0, "2016-05-22T113929.541 US/Eastern", 82971940, 0

我使用以下命令创建Hive表:
create table event_history(status tinyint, condition smallint,
machine_id int, time timestamp, ident int, state tinyint)

我正在尝试使用以下命令将CSV文件加载到表格中:

load data local inpath "/home/ubuntu/events.csv" into table event_history;

当我尝试在创建的表中执行选择查询时,我得到的都是NULL值。我错过了什么吗? Hive版本是Hive 1.2.1。
1个回答

8

我的错误在于表格创建中。通过以下更改进行了修正。

create table event_history(status tinyint, condition smallint, machine_id int,
time timestamp, drqs int, state tinyint) ROW FORMAT DELIMITED FIELDS TERMINATED BY ',';

网页内容由stack overflow 提供, 点击上面的
可以查看英文原文,
原文链接