您可以选择
data.bar.baz为
bar.baz:
df.show()+-------+| data|+-------+|[3,[2]]|+-------+df.printSchema()root |-- data: struct (nullable = false) | |-- foo: long (nullable = true) | |-- bar: struct (nullable = false) | | |-- baz: long (nullable = true)
在pyspark中:
import pyspark.sql.functions as Fdf.select(F.col("data.foo").alias("foo"), F.col("data.bar.baz").alias("bar.baz")).show()+---+-------+|foo|bar.baz|+---+-------+| 3| 2|+---+-------+
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)