【发布时间】:2021-06-10 23:53:37
【问题描述】:
我有一张这样的桌子
| id | obj | |||
|---|---|---|---|---|
| 1 | {"is_from_shopping_bag":true,"products":[{"price":{"amount":"18.00","currency":"USD","offset":100,"amount_with_offset":"1800"},"product_id":"1234","quantity":1}],"source":"cart"} | |||
| 2 | {"is_from_shopping_bag":false,"products":[{"price":{"amount":"80.00","currency":"USD","offset":100,"amount_with_offset":"8000"},"product_id":"2345","quantity":1}],"source":"pdp"} | |||
我正在 Hive 中执行 sql 查询以获取“货币”字段。
目前我可以运行
SELECT
JSON_EXTRACT( obj, '$.products')
FROM my_table
返回
| obj | |||
|---|---|---|---|
| [{"price":{"amount":"18.00","currency":"USD","offset":100,"amount_with_offset":"1800"},"product_id":"1234","quantity":1}] | |||
| [{"price":{"amount":"80.00","currency":"USD","offset":100,"amount_with_offset":"8000"},"product_id":"2345","quantity":1}] | |||
如何更深入地获得货币?
【问题讨论】: