【问题标题】:How to 'filter' an array of structs in Hive without exploding?如何在不爆炸的情况下“过滤”Hive 中的结构数组?
【发布时间】:2022-12-29 05:58:05
【问题描述】:

假设我在 Hive 表中有此数据:


fname | lname | records |
------|-------|---------|
 John |  Doe  | [{"name": "John", "lname": "Doe", "age": 55}, {"name": "Jacky", "lname": "Collins", "age": 67}] |
 Jane |  Doe  | [{"name": "John", "lname": "Doe", "age": 55}, {"name": "Jacky", "lname": "Collins", "age": 67}] |

我想获得 records.age 以匹配 fnamelname 而不会爆炸 records 列。有没有办法做到这一点?

结果将是:

fname | lname | age  |
------|-------|------|
 John |  Doe  | 55   |
 Jane |  Doe  | NULL |

【问题讨论】:

  • 你确定你的预期结果吗?为什么简的年龄为空?
  • @KoushikRoy 我是这么认为的。因为 Jane Doe 不在records 列中。

标签: hive hiveql


【解决方案1】:

我现在的感觉——不可能:(

任何人?

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-07-24
    • 1970-01-01
    • 1970-01-01
    • 2022-01-24
    • 2021-07-21
    • 1970-01-01
    • 1970-01-01
    • 2017-02-05
    相关资源
    最近更新 更多