非決定論的(ユーザー定義関数)
UserDefinedFunctionを非決定論的に更新します。
構文
asNondeterministic()
戻り値
UserDefinedFunction
例
Python
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)]