nerdexam
DatabricksDatabricks

DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK · Question #23

DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK Question #23: Real Exam Question with Answer & Explanation

Sign in or unlock DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK to reveal the answer and full explanation for question #23. The question stem and answer options stay visible for context.

Implementing User-Defined Functions (UDFs) in PySpark

Question

The code block shown below contains an error. The code block is intended to create a Python UDF assessPerformanceUDF() using the integer-returning Python function assessPerformance() and apply it to column customerSatisfaction in DataFrame storesDF. Identify the error. Code block: assessPerformanceUDF - udf(assessPerformance) storesDF.withColumn("result", assessPerformanceUDF(col("customerSatisfaction")))

Options

  • AThe assessPerformance() operation is not properly registered as a UDF.
  • BThe withColumn() operation is not appropriate here - UDFs should be applied by iterating over
  • CUDFs can only be applied vie SQL and not through the DataFrame API.
  • DThe return type of the assessPerformanceUDF() is not specified in the udf() operation.
  • EThe assessPerformance() operation should be used on column customerSatisfaction rather than

Unlock DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK to see the answer

You've previewed enough free DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK questions. Unlock DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK for full answers, explanations, the timed quiz mode, progress tracking, and the master PDF. Question stem and options stay visible so you can still see what's on the exam.

Topics

#PySpark UDFs#DataFrame API#Spark Data Types#Error Identification
Full DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK PracticeBrowse All DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK Questions