【发布时间】:2019-09-28 03:17:13
【问题描述】:
我在 Hive 中有一个表,它有一个架构:
root
|-- startdate: string (nullable = true)
|-- enddate: string (nullable = true)
|-- items: array (nullable = true)
| |-- element: struct (containsNull = true)
| | |-- _id: string (nullable = true)
| | |-- name: string (nullable = true)
| | |-- .......: string (nullable = true)
| | |-- otherfields: string (nullable = true)
我只想从 items 数组字段中获取 _id 和 name 列,即:
|-- items: array (nullable = true)
| |-- element: struct (containsNull = true)
| | |-- _id: string (nullable = true)
| | |-- name: string (nullable = true)
有没有一种方法可以做到这一点,而无需在 Spark 本身中进行额外的转换,以便只从 Hive 中检索实际的列?
我使用的是 Spark 2.2。
【问题讨论】:
标签: apache-spark hive apache-spark-sql