将空值加载到Hive表中

3
我有一个 .txt 文件,其中包含以下行:
Steve,1 1 1 1 1 5 10 20 10 10 10 10

当我创建一个外部表,加载数据并选择*时,我得到了空值。请帮忙显示数字值而不是null。非常感谢您的帮助!
create external table Teller(Name string, Bill array<int>)
row format delimited
fields terminated by ','
collection items terminated by '\t'
stored as textfile
location '/user/training/hive/Teller';

load data local inpath'/home/training/hive/input/*.txt' overwrite into table Teller;

输出:
Steve   [null]
1个回答

1
似乎整数之间用空格隔开而不是制表符
终端命令行
hdfs dfs -mkdir -p /user/training/hive/Teller
echo Steve,1 1 1 1 1 5 10 20 10 10 10 10 | hdfs dfs -put - /user/training/hive/Teller/data.txt

hive

hive> create external table Teller(Name string, Bill array<int>)
    > row format delimited
    > fields terminated by ','
    > collection items terminated by ' '
    > stored as textfile
    > location '/user/training/hive/Teller';
OK
Time taken: 0.417 seconds
hive> select * from teller;
OK
Steve   [1,1,1,1,1,5,10,20,10,10,10,10]

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