Databricks Certified Associate Developer For Apache Spark 30 · Free Practice Question Medium

Question 4

The code block shown below contains an error. Identify the error.

  • A

    We need to add quotes when using udf in sql. Proper usage should be:

    spark.sql(“select id, “squared(id)” as id_squared from test”)

  • B

    We need to use function ‘square’ instead of ‘squared’ in the sql command. Proper command should be:

    spark.sql(“select id, square(id) as id_squared from test”)

  • C There is no error in the code.
  • D

    We are not referring to right database. Proper command should be:

    spark.sql(“select id, squared(id) as id_squared from temp_test”)

  • E There is no column id created in the database.
Reveal correct answer

Correct answer: B

Explanation

We need to use the registered name in the sql statement. You will have similar questions in the exam, read carefully all the questions !

Discussion

Think the marked answer is wrong, or have a better explanation? Share it below — comments appear after review.

You must be logged in to post a comment.

Preparing For

Your Certification?

255+ certifications
Detailed explanations
Free PDF samples

Has All The Questions You Need