我將Json數據插入Hive。這是格式 -Hive json數據爆炸選項不爆炸數組
A1 Array <
struct <
product array <
struct <
dim1 array < struct <> >
dim2 array < struct <> >
>
>
>>
在從表條款我使用的爆炸:
Lateral view outer explode(A1.product) t1 as prod Lateral view outer explode(prod.dim1) t2 as prod_d1 Lateral view outer explode(prod.dim2) t3 as prod_d2
的樣本數據:
A1["product":[{"productsku":"p_dmf_qs:click: page load","v2productname":"Quality Score - click: page load","v2productcategory":"DMF","productvariant":"(not set)","productbrand":"xxxx","productrevenue":"1000","localproductrevenue":null,"productprice":"100","productquantity":"1","productrefundamount":null,"productlistname":"(not set)","dim1":[],"dim2":[]}]]
我的呼喚在SELECT語句T2和T3作爲prod_d1和prod_d2,我得到了結果中的結構,而不是數組。 請幫幫我。它是一個嵌套結構。如果我沒有第一個產品陣列,我可以將它簡單地稱爲A1.dim1和A1.dim2作爲兩個爆炸函數。請幫助我。
請添加表定義+小數據樣本(少數行) –
更新我的問題中的示例數據。好心檢查。謝謝 – Bala