Welcome to ExamTopics
ExamTopics Logo
- Expert Verified, Online, Free.
exam questions

Exam Certified Associate Developer for Apache Spark All Questions

View all questions & answers for the Certified Associate Developer for Apache Spark exam

Exam Certified Associate Developer for Apache Spark topic 1 question 83 discussion

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?

  • A. spark.udf.register("ASSESS_PERFORMANCE", assessPerformance)
    spark.sql("SELECT customerSatisfaction, ASSESS_PERFORMANCE(customerSatisfaction) AS result FROM stores")
  • B. spark.udf.register("ASSESS_PERFORMANCE", assessPerformance)
  • C. spark.udf.register("ASSESS_PERFORMANCE", assessPerformance)
    spark.sql("SELECT customerSatisfaction, assessPerformance(customerSatisfaction) AS result FROM stores")
  • D. spark.udf.register("ASSESS_PERFORMANCE", assessPerformance)
    storesDF.withColumn("result", assessPerformance(col("customerSatisfaction")))
  • E. spark.udf.register("ASSESS_PERFORMANCE", assessPerformance)
    storesDF.withColumn("result", ASSESS_PERFORMANCE(col("customerSatisfaction")))
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?) , you can switch to a simple comment.
Switch to a voting comment New
nadegetiedjo
7 months ago
column customerSatisfaction haven't quoted in A so Ithink that the good answer is E
upvoted 1 times
carlosmps
5 months ago
Option E is incorrect because it attempts to use the SQL UDF name directly in the DataFrame API, which is not supported without using expr or callUDF.
upvoted 1 times
...
...
Sowwy1
7 months, 3 weeks ago
A is correct
upvoted 2 times
...
Community vote distribution
A (35%)
C (25%)
B (20%)
Other
Most Voted
A voting comment increases the vote count for the chosen answer by one.

Upvoting a comment with a selected answer will also increase the vote count towards that answer by one. So if you see a comment that you already agree with, you can upvote it instead of posting a new comment.

SaveCancel
Loading ...