api="TopicHeatTrend"
hadoop dfs -mkdir /jzytest/hive${api}/
 hive -e 'create external table if not exists jzy'$api'json

distribute map<string,map<string,int>>, 
heatTrend array<struct<channel:string,heat:int,list:array<struct<heat:int,time:string>>>>, 
topData map<string,array<struct<list:array<map<string,string>>,source:string>>>
)
partitioned by (topic_id string,dt string)
row format serde "org.apache.hive.hcatalog.data.JsonSerDe"
LOCATION "hdfs:///jzytest/hive'$api'/";'

原数据格式:

结果:

总结:

1.list对应array,map对应map,json对应struct

2.使用struct时要注意key对应

参考:https://blog.csdn.net/jzy3711/article/details/84246075

https://blog.csdn.net/jzy3711/article/details/84257589

原数据样例下载:https://download.csdn.net/download/jzy3711/10794293

https://download.csdn.net/user/jzy3711/uploads

Logo

AtomGit 是由开放原子开源基金会联合 CSDN 等生态伙伴共同推出的新一代开源与人工智能协作平台。平台坚持“开放、中立、公益”的理念,把代码托管、模型共享、数据集托管、智能体开发体验和算力服务整合在一起,为开发者提供从开发、训练到部署的一站式体验。

更多推荐