LeetQuiz Logo
Privacy Policy•contact@leetquiz.com
© 2025 LeetQuiz All rights reserved.
Databricks Certified Associate Developer for Apache Spark

Databricks Certified Associate Developer for Apache Spark

Get started today

Ultimate access to all questions.


The code block below contains an error. It is intended to create a Scala UDF assessPerformanceUDF() and apply it to the integer column customerSatisfaction in DataFrame storesDF. Identify the error.

Code block:

val assessPerformanceUDF = udf((customerSatisfaction: Int) => 
  customerSatisfaction match {
    case x if x < 20 => 1
    case x if x > 80 => 3
    case _ => 2
  }
)
storesDF.withColumn("result", assessPerformanceUDF(col("customerSatisfaction")))

Exam-Like




Powered ByGPT-5