Использование transform
:
val df = Seq((1, Seq(1)), (1, Seq(2)), (2, Seq(3, 4))).toDF
df.selectExpr("*", "transform(_2, x -> hash(x)) AS _3").show
+---+------+--------------------+
| _1| _2| _3|
+---+------+--------------------+
| 1| [1]| [-559580957]|
| 1| [2]| [1765031574]|
| 2|[3, 4]|[-1823081949, -39...|
+---+------+--------------------+