Note
Access to this page requires authorization. You can try signing in or changing directories.
Access to this page requires authorization. You can try changing directories.
Updates the UserDefinedFunction to nondeterministic.
Syntax
asNondeterministic()
Returns
UserDefinedFunction
Examples
import random
from pyspark.sql.functions import udf
from pyspark.sql.types import IntegerType
random_udf = udf(lambda: random.randint(0, 100), IntegerType()).asNondeterministic()
new_random_udf = spark.udf.register("random_udf", random_udf)
spark.sql("SELECT random_udf()").collect()
# [Row(random_udf()=82)]