`

hive 复杂数据结构嵌套

    博客分类:
  • hive
阅读更多
Hive

hive 除了支持基本的数据结构

hive 复杂的数据结构:

{
 array
 map
 struct
}


数据格式

221190xxx9	0401:0.30 0402:0.81 1303:0.23 1502:0.21 1503:0.11 0307:0.17 1003:0.35 	
22119xxxx2	0508:0.58 0402:0.25 0403:0.24 0405:0.30 0503:0.55 1502:0.26 0208:0.29 	
22119xxx63	0405:0.18 0408:0.22 0905:0.89 1503:0.16 0301:0.14 0307:0.12 0208:0.17 


hive 表结构设计:

create table genomeplatform.user_tags (uid string ,tag array<struct<tagid:string,weight:string>>)

ROW FORMAT DELIMITED
FIELDS TERMINATED BY '\t'
COLLECTION ITEMS TERMINATED BY ' '
MAP KEYS TERMINATED BY ':'
STORED AS TEXTFILE;


select :


100xxxx0	[{"tagname":"0101","weight":"0.44"},{"tagname":"1103","weight":"0.90"},{"tagname":"","weight":null}]
100xxxx7	[{"tagname":"0508","weight":"1.00"},{"tagname":"","weight":null}]
100xxxx9	[{"tagname":"1701","weight":"0.79"},{"tagname":"1606","weight":"0.62"},{"tagname":"","weight":null}]
130xxxx9	[{"tagname":"1503","weight":"1.00"},{"tagname":"","weight":null}]
0
0
分享到:
评论

相关推荐

Global site tag (gtag.js) - Google Analytics