将csv数据加载到配置单元表时出错

wn9m85ua  于 2021-05-29  发布在  Hadoop
关注(0)|答案(1)|浏览(405)

我有一个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

我使用以下命令创建一个配置单元表,

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;

但是,当我尝试在创建的表中执行select查询时,得到的只是空值。我错过了什么?
配置单元版本是配置单元1.2.1

pgvzfuti

pgvzfuti1#

我的错误是在表创建中。修改如下

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

相关问题