【发布时间】:2019-02-27 12:48:25
【问题描述】:
我有 2 个数据框:
|data |
|--------------|
|[1,Rob,12] |
|[2,Jeremy,11] |
|[3,Bart,14] |
scala> data.printSchema()
root
|-- data: array (nullable = true)
| |-- element: string (containsNull = true)
和
|headers |
|----------------|
|[id,name,deptid]|
scala> headers.printSchema()
root
|-- headers: array (nullable = true)
| |-- element: string (containsNull = true)
问题:如何使用标头 DF 和数据 DF 创建具有以下格式的输出数据帧?
| id | name | deptid|
|----| ------|-------|
| 1 | Rob | 12 |
| 2 | Jeremy| 11 |
| 3 | Bart | 14 |
【问题讨论】:
标签: arrays scala apache-spark dataframe apache-spark-sql