美文网首页
txt 文件存HIVE出现多列并一列现象

txt 文件存HIVE出现多列并一列现象

作者: 丙吉 | 来源:发表于2021-07-16 14:54 被阅读0次

今天想把个小文件存到HIVE上,结果 出现了这个情况,中间把原来的 空格分隔符,换成\t, 或
,或',' 都没有达到自己想要的效果.

image.png
image.png

原来自己在建表的时候图省事,没有指定分隔;

create table a(areacode string, y_m_d string, hour string, count int) ;

找了好半天的原因哟,结果终于找到了问题.

后把原来的表删除,重新建表,在后面加上row format...:

create table a(areacode string, y_m_d string, hour string, count int) row format delimited fields terminated by ',';

# 把txt表传入表中
load data local inpath'/root/a_count.txt' into table a;

结果如下:


image.png

相关文章

网友评论

      本文标题:txt 文件存HIVE出现多列并一列现象

      本文链接:https://www.haomeiwen.com/subject/bhkbpltx.html