【发布时间】:2021-12-06 16:33:41
【问题描述】:
我在 Scala 中的 Spark 数据框中有一列是由于使用聚合多个列而生成的
agg(collect_list(struct(col(abc), col(aaa)).as(def)
我想将此列传递给 UDF 以进行进一步处理,以处理此聚合列中的一个索引。
当我将参数传递给我的 UDF 时:
.withColumn(def, remove
(col(xyz), col(def)))
UDF- 类型为 Seq[Row]: val removeUnstableActivations: UserDefinedFunction = udf((xyz: java.util.Date, def: Seq[Row])
我得到错误:
Exception encountered when invoking run on a nested suite - Schema for type org.apache.spark.sql.Row is not supported
我应该如何传递这些列以及UDF中列的数据类型应该是什么?
【问题讨论】:
标签: scala apache-spark apache-spark-sql