Databricks Certified Associate Developer for Apache Spark — Question 129

Which of the following code blocks creates and registers a SQL UDF named "ASSESS_PERFORMANCE" using the Scala function assessPerformance() and applies it to column customerSatisfaction in table stores?

Answer options

Correct answer: A

Explanation

Option A is correct because it properly registers the UDF 'ASSESS_PERFORMANCE' and uses it in a SQL query to select customer satisfaction along with the result of the UDF. The other options either fail to execute the SQL query that applies the UDF to the column or use incorrect syntax that does not meet the requirement of the question.