QuestionQ24
VerifiedUsing Spark SQLA data engineer is working with the num_df DataFrame:
num_df = spark.range(5).toDF(“num”)
The engineer is using the Python UDF:
def cubefunc(val):
return val ** 3
Which code fragment registers and invokes this UDF as a Spark SQL function for use with the num_df DataFrame?
Community Discussion