原因介绍
1.在把本地数据load到hive中的表时,若出现数据位NULL,是因为没有指定列分隔符。
2.由于hive默认的分隔符是/u0001(Ctrl+A),为了平滑迁移,需要在创建表格时指定数据的分割符号
解决方法
1.创建表时指定使用’\t’(Tab)作为分隔符
create table users(id int, name string) row format delimited fields terminated by ‘\t’;
2.本地数据必须使用同样的分隔符’\t’(Tab)隔开
结果展示
1.load data local inpath ‘/usr/local/users.txt’ into table users;
2.select * from users;
问题解决!