Hive 복잡 한 데이터 구조 삽입

1523 단어 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}]

좋은 웹페이지 즐겨찾기