Apache spark 使用';选择结构类型列';在PySpark中的列名中

Apache spark 使用';选择结构类型列';在PySpark中的列名中,apache-spark,pyspark,apache-spark-sql,Apache Spark,Pyspark,Apache Spark Sql,如何选择PySpark中的“cat.item.category”列?模式如下: root |-- result: struct (nullable = true) | |-- active: string (nullable = true) | |-- cat_item.category: struct (nullable = true) | | |-- display_value: string (nullable = true) | | |--

如何选择PySpark中的
“cat.item.category”
列?模式如下:

root
 |-- result: struct (nullable = true)
 |    |-- active: string (nullable = true)
 |    |-- cat_item.category: struct (nullable = true)
 |    |    |-- display_value: string (nullable = true)
 |    |    |-- link: string (nullable = true)
 |    |-- number: string (nullable = true)
 |    |-- sys_id: string (nullable = true)
我尝试了以下操作,但出现了一个错误

df22 = df22.select("result.active", "result.cat_item.category.display_value", "result.cat_item.category.link", "result.number", "result.sys_id")

如何选择结构列?

字段名包含一个点
,您需要使用backtick`对其进行转义:

df22.select("result.`cat_item.category`.display_value")