我试图创建这样的模式:
root
|-- _ehid: string (nullable = true)
|-- duration: double (nullable = true)
|-- list: array (nullable = true)
| |-- element: array (containsNull = true)
| | |-- element: string (containsNull = true)
|-- request.id: string (nullable = true)
但我只能创造一个:
root
|-- _ehid: string (nullable = true)
|-- duration: double (nullable = true)
|-- list: array (nullable = true)
| |-- element: struct (containsNull = true)
| | |-- element: string (nullable = true)
|-- request.id: string (nullable = true)
对于元素,我看到的是结构类型而不是数组。当我试图通过df.show(10)查看我的df时,我只看到空值
我的剧本:
schema = StructType([
StructField("_ehid", StringType(), True),
StructField("duration", DoubleType(), True),
StructField("list", ArrayType(StructType([
StructField("element", StringType())
])), True),
StructField("request.id", StringType(), True)])
直接使用
StringType
:相关问题 更多 >
编程相关推荐