Databricks Certified Associate Developer for Apache Spark — Question 34

The code block shown below should create and register a SQL UDF named "ASSESS_PERFORMANCE" using the Python function assessPerformance() and apply it to column customerSatisfaction in table stores. Choose the response that correctly fills in the numbered blanks within the code block to complete this task.
Code block:
spark._1_._2_(_3_, _4_)
spark.sql("SELECT customerSatisfaction, _5_(customerSatisfaction) AS result FROM stores")

Answer options

Correct answer: A

Explanation

Option A is correct because it properly uses 'udf' to create a user-defined function, 'register' to register it with the name 'ASSESS_PERFORMANCE', and applies the function correctly in the SQL statement. The other options either misuse quotes or incorrectly order the function and registration steps, making them invalid for the intended operation.