nerdexam
DatabricksDatabricks

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

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

The correct answer is B: assessPerformanceUDF = udf(assessPerformance, IntegerType()) storesDF.withColumn("result",. See the full explanation below for the reasoning.

Implementing User-Defined Functions (UDFs) in PySpark

Question

Which of the following code blocks creates a Python UDF assessPerformanceUDF() using the integer-returning Python function assessPerformance() and applies it to Column customerSatisfaction in DataFrame storesDF?

Options

  • AassessPerformanceUDF = udf(assessPerformance, IntegerType) storesDF.withColumn("result",
  • BassessPerformanceUDF = udf(assessPerformance, IntegerType()) storesDF.withColumn("result",
  • CassessPerformanceUDF - udf(assessPerformance) storesDF.withColumn("result",
  • DassessPerformanceUDF = udf(assessPerformance) storesDF.withColumn("result",
  • EassessPerformanceUDF = udf(assessPerformance, IntegerType()) storesDF.withColumn("result",

Topics

#PySpark UDFs#DataFrame Transformations#Spark SQL Data Types#Python for Spark

Community Discussion

No community discussion yet for this question.

Full DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK PracticeBrowse All DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK Questions