我想要从json中提取并在hql中计数

zqdjd7g9  于 2021-06-25  发布在  Hive
关注(0)|答案(0)|浏览(274)

我想从json中提取并在hqljson中计数

{
    "online_pay": 1,
    "is_settle": 1,
    "period": "00:00-23:59",
    "policy_detail": [{
        "price": 10.0,
        "discounts": [{
            "agent_charge": 0.0,
            "code": 1,
            "mt_charge": 0.0,
            "type": "default",
            "poi_charge": 1.0,
            "discount": 1.0
        }]
    }, {
        "price": 15.0,
        "discounts": [{
            "agent_charge": 0.0,
            "code": 1,
            "mt_charge": 0.0,
            "type": "default",
            "poi_charge": 2.0,
            "discount": 2.0
        }]
    }, {
        "price": 20.0,
        "discounts": [{
            "agent_charge": 0.0,
            "code": 1,
            "mt_charge": 0.0,
            "type": "default",
            "poi_charge": 3.0,
            "discount": 3.0
        }]
    }, 
    "type": 2
}

我试过了

regexp_extract(detail,'price\"\:[0-9]+')

但这只会给我带来价格:10.0我想要那么多

暂无答案!

目前还没有任何答案,快来回答吧!

相关问题