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

GitHub 加速计划 / js / json
41.72 K
6.61 K
下载
适用于现代 C++ 的 JSON。
最近提交(Master分支:1 天前 )
960b763e 2 个月前
8c391e04 5 个月前
Logo

旨在为数千万中国开发者提供一个无缝且高效的云端环境,以支持学习、使用和贡献开源项目。

更多推荐