如何在Hive中将空格分隔的文件作为收集项加载?

时间:2018-10-21 00:19:22

标签: hive

我是蜂巢新手,在加载空间文件时遇到问题 分隔为数组。  我的源文件:

   Manjeet,1 1 1 1 1 5 10 20 10 10 10 20 5 5 10 1 1 1 1 1 5 10 10 10
   Ron,1 1 1 1 1 5 10 20 10 10 10 10
   Ron,1 1 5 1 10 5 10 20 10 20 1 1 10 10 10
   Pat,1 1 1 1 1 5 10 20 10 10 10 10 10 10

我尝试了以下命令:

  create table teller
  (Name string, Bill array<string>)
  Row format delimited
  Fields terminated by ','
  Collection items terminated by ''
  Lines terminated by '\n'
  Stored as textfile
  location '/user/training/hive/Bank';

我明白了:

  Manjeet ["1 1 1 1 1 5 10 20 10 10 10 20 5 5 10 1 1 1 1 1 5 10 10 10"]
  Ron     ["1 1 1 1 1 5 10 20 10 10 10 10"]
  Ron     ["1 1 5 1 10 5 10 20 10 20 1 1 10 10 10"]
  Pat     ["1 1 1 1 1 5 10 20 10 10 10 10 10 10"]

我希望结果像

  Manjeet ["1","1","1","1","1", "5"} and so on...

0 个答案:

没有答案