用json_tuple代替get_json_object

时间:2019-07-17 05:13:45

标签: sql json hive getjson lateral-join

get_json_object减慢了整个查询的速度,我想用json_tuple代替它,但横向视图不支持Join。 谁能帮助我提高get_json_object的效率或完全替代它?

我尝试用get_json_object代替json_tuple,但是无法在横向视图上执行连接。

select
l.org_id, l.listing_id, l.title, l.vertical, l.brand,l.city,l.status, l.org_name,l.vertical_spec,l.sub_category,l.category, l.created_month,
cast(get_json_object(o.offer_config, concat('$.listingDiscountBpsMap.', l.listing_id)) AS DOUBLE)/100 discount, get_json_object(ds_azt_sales_unit.props["shipping_details"],'$.available_qty') as inventory

from (select * from ds_stream_listing ds where ds.category in ("Smartphones", "Electronics", "IT & Accessories")) as l

left join ds_sqls_offer as o on l.org_id = o.owner_org_id

left join ds_azt_sales_unit on ds_azt_sales_unit.props["listing_id"] = l.listing_id

where o.event_id = 'EVNT7DT866D5YX8SLFDLZ5V314797E' and o.offer_state = 'ACTIVE' and

get_json_object(o.offer_config, concat('$.listingDiscountBpsMap.', l.listing_id))  is not NULL AND 

l.category in ("Smartphones", "Electronics", "IT & Accessories")

在使用侧面视图时,我得到了:

Could not execute query: org.apache.hive.service.cli.HiveSQLException: Error while compiling statement: FAILED: SemanticException [Error 10085]: Line 6:13 JOIN with a LATERAL VIEW is not supported 'owner_org_id'

使用get_json_object时,查询需要30多分钟才能给出任何输出。

0 个答案:

没有答案