Description
from pyspark.sql.functions import pandas_udf from pyspark.sql.functions import col, lit from pyspark.sql.types import LongType df = spark.range(3) f = pandas_udf(lambda x, y: len(x) + y, LongType()) df.select(f(lit('text'), col('id'))).show()
from pyspark.sql.functions import udf from pyspark.sql.functions import col, lit from pyspark.sql.types import LongType df = spark.range(3) f = udf(lambda x, y: len(x) + y, LongType()) df.select(f(lit('text'), col('id'))).show()
The results of pandas_udf are different from udf.