Details
-
Bug
-
Status: Resolved
-
Major
-
Resolution: Incomplete
-
2.4.0
-
None
Description
Steps to reproduce
from typing import Optional from pyspark.sql.functions import expr def f(x: Optional[int]) -> Optional[int]: return x + 1 if x is not None else None spark.udf.register('f', f, "integer") df = (spark .createDataFrame([(1, [1, 2, 3])], ("id", "xs")) .withColumn("xsinc", expr("transform(xs, x -> f(x))"))) df.show() # +---+---------+-----+ # | id| xs|xsinc| # +---+---------+-----+ # | 1|[1, 2, 3]| [,,]| # +---+---------+-----+