2017-03-26 14 views
3

をハイブに:私は、外部表を作成したデータをロードし*、私はnull値を持って選択しロードNULL値は、私は次の行を持っているの.txtファイルを持っているテーブル

Steve,1 1 1 1 1 5 10 20 10 10 10 10 

。ヌルの代わりに数値を表示する方法を助けてください。私は非常に助けを感謝します!

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

これは、整数は、スペースではなくタブ

bashの

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> 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] 
+0

それは働いた!ありがとうございました!!! – user7770852

+0

歓迎します:-)答えを受け入れることを忘れないでください –

関連する問題