我有以下模式的Dataframe:
|-- data: struct (nullable = true)
| |-- asin: string (nullable = true)
| |-- customerId: long (nullable = true)
| |-- eventTime: long (nullable = true)
| |-- marketplaceId: long (nullable = true)
| |-- rating: long (nullable = true)
| |-- region: string (nullable = true)
| |-- type: string (nullable = true)
|-- uploadedDate: long (nullable = true)
我想分解结构,使所有元素(如asin、customerid、eventtime)成为dataframe中的列。我尝试过分解函数,但它在数组上工作,而不是在结构类型上。是否可以将ableDataframe转换为以下Dataframe:
|-- asin: string (nullable = true)
|-- customerId: long (nullable = true)
|-- eventTime: long (nullable = true)
|-- marketplaceId: long (nullable = true)
|-- rating: long (nullable = true)
|-- region: string (nullable = true)
|-- type: string (nullable = true)
|-- uploadedDate: long (nullable = true)
1条答案
按热度按时间aoyhnmkz1#
很简单:
告诉您选择uploadeddate,然后选择字段数据的所有子元素
例子: