【发布时间】:2022-01-21 23:35:42
【问题描述】:
所以我有一个 Hive 数据样本:
| costumer | xx_var | yy_var | branchflow |
|---|---|---|---|
| {"customer_no":"239230293892839892","acct":["2324325","23425345"]} | 23 | 3 | [{"acctno":"2324325","value":[1,2,3,4,5,6,6,6,4]},{"acctno":"23425345","value":[1,2,3,4,5,6,6,6,99,4]}] |
我想把它变成这样的东西:
| costumer_no | acct | xx_var | yy_var | branchflow |
|---|---|---|---|---|
| 239230293892839892 | 2324325 | 23 | 3 | [1,2,3,4,5,6,6,6,4] |
| 239230293892839892 | 23425345 | 23 | 3 | [1,2,3,4,5,6,6,6,99,4] |
我已尝试使用此查询,但输出格式错误。
SELECT customer.customer_no,
acct,
xx_var,
yy_var,
bi_acctno,
values_bi
FROM struct_test LATERAL VIEW explode(customer.acct) acct AS acctno
LATERAL VIEW explode(brancflow.acctno) bia as bi_acctno
LATERAL VIEW explode(brancflow.value) biv as values_bi
where bi_acctno = acctno
有人知道如何解决这个问题吗?
【问题讨论】: