Certified Associate Developer for Apache Spark Exam QuestionsBrowse all questions from this exam

Certified Associate Developer for Apache Spark Exam - Question 170


The code block shown below contains an error. The code block is intended to create and register a SQL UDF named "ASSESS_PERFORMANCE" using the Python function assessPerformance() and apply it to column customerSatistfaction in table stores. Identify the error.

Code block:

spark.udf.register("ASSESS_PERFORMANCE", assessPerformance)

spark.sql("SELECT customerSatisfaction, assessPerformance(customerSatisfaction) AS result FROM stores")

Show Answer
Correct Answer: E

The error in the code block is that the wrong SQL function is used to compute the column result. Instead of assessPerformance, the registered UDF name ASSESS_PERFORMANCE should be used in the SQL query.

Discussion

1 comment
Sign in to comment
Sowwy1Option: E
Apr 10, 2024

E. The wrong SQL function is used to compute column result — it should be ASSESS_PERFORMANCE instead of assessPerformance.