CREATE external TABLE `mongodb_dingtalk.mongodb_test`(
`companyName` string,
`sources` array<struct<contact:string,contactJob:string,site:string,source:string,sourceHref:string>>
)
STORED BY 'com.mongodb.hadoop.hive.MongoStorageHandler'
WITH SERDEPROPERTIES('mongo.columns.mapping'='{"companyName":"companyName","contactName":"contactName","content":"content","type":"type","numStatus":"numStatus","sources":"sources"}')
TBLPROPERTIES('mongo.uri'='mongodb://ip:21000/companyName.test');
insert overwrite table mongodb_dingtalk.mongodb_test
select companyname,
collect_set(named_struct('contact',companyname,'contactjob',contactjob,'site',site,'source',source,'sourceHref',sourceHref)) as sources
from mongodb_dingtalk.hive_companycontact_20210904 where companyname = 'xxxxxx' group by companyname;
Hive之向一个array中装载多个struct
最新推荐文章于 2022-08-19 15:05:25 发布
2090

被折叠的 条评论
为什么被折叠?



