hive中json格式数据解析

1.在hive中创建源表

use default;
create table if not exists testdata(
mongo_data string
);

2.插入json格式数据

insert into testdata(mongo_data) VALUES(‘{“project_type”: [“5”], “project_uncode”: “MjIwMjE2MDEwODQ5MTM3”, “project_name”: “大企业带动中小企业融通发展项目\t\t”, “enterprise_name”: “东方电气集团东方锅炉股份有限公司”, “social_credit_code”: “915103006207291851”, “legal_representative”: “林光平”, “corporate_phone”: “028-87898567”, “unit_nature”: [“2”], “main_contents”: “自2020年12月16日起截至2021年12月31日,东方锅炉及省内子企业通过原材料和零部件采购、生产扩散、日常经营服务外包等采购方式,带动省内中小型企业共83家参与公司发展,累计采购产品/服务总金额57606万元。”, “location”: {“detail”: “五星街黄桷坪路150号”, “region”: [{“code”: “510000”, “name”: “四川省”}, {“code”: “510300”, “name”: “自贡市”}, {“code”: “510302”, “name”: “自流井区”}]}, “industry”: [“02”], “key_areas”: [“99”], “key_areas_02”: [“99”], “key_areas_99”: [“99”], “contacts”: “文砚博”, “contact_information”: “13980962639”, “years”: 2022, “fieldvzpzn23yn”: “项目申报单位概况”, “registered_capital”: null, “company_location”: {“detail”: “”, “region”: [{“code”: “510000”, “name”: “四川省”}, null, null]}, “whether1”: “选项一”, “number_of_employees”: null, “total_assets”: null, “leverage”: null, “shareholder”: [{“num”: null, “shareholding_ratio”: 0}], “production_scale”: [{“sales_revenue”: null, “market_share”: 0, “export_volume”: null}], “fieldaa5xfuxpj”: “申报单位技术创新开发情况”, “num_techician”: null, “proportion”: null, “technical_personnel”: null, “total_r_d_invest_two”: null, “r_d_equip_invest_two”: null, “fieldbok2ymofs”: “项目基本信息”, “projectstate”: [], “end_time”: null, “production_time”: null, “energyuse_year”: null, “field2wmuow93h”: “项目投资(万元)”, “total_investment”: null, “fixed_investment”: null, “device_investment”: null, “raise_independently”: null, “financing”: null, “investment_completed”: null, “fixed_assets”: null, “device_assets”: null, “field0rkzwqdkq”: “融资需求(万元)”, “fieldcgqkrfdgc”: “项目达产后的预期经济效益(万元)”, “expected_sales_reven”: null, “profit”: null, “tax_revenue”: null, “new_employment”: null, “cooperative_unit”: [{“own_funds”: null, “other_funds”: null, “equity_financing”: null, “loans”: null, “total_investment1”: null}], “status”: [“1”], “key_flag”: [“0”], “declare_status”: [], “user_level”: [“1”], “area_qu”: “510302”, “abuts_county”: [“否”], “location_country”: “自流井区”, “location_city”: “自贡市”, “start_end_time”: “2022-02至2022-02”, “coding”: “2022510302000099”}’);

3.验证存储的数据格式是否是json格式

select get_json_object(mongo_data,‘ . c o m p a n y l o c a t i o n . r e g i o n [ 0 ] . n a m e ′ ) a

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值