nerdexam
Databricks

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

Which of the following code blocks returns a DataFrame containing a column openDateString, a string representation of Java's SimpleDateFormat? Note that column openDate is of type integer and represen

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

Data Transformation and Manipulation using Spark DataFrames

Question

Which of the following code blocks returns a DataFrame containing a column openDateString, a string representation of Java's SimpleDateFormat? Note that column openDate is of type integer and represents a date in the UNIX epoch format - the number of seconds since midnight on January 1st, 1970. An example of Java's SimpleDateFormat is "Sunday, Dec 4, 2008 1:05 pm". A sample of storesDF is displayed below:

Options

  • AstoresDF.withColumn("openDatestring", from unixtime(col("openDate"), "EEEE, MMM d, yyyy
  • BstoresDF.withColumn("openDateString", from_unixtime(col("openDate"), "EEEE, MMM d, yyyy
  • CstoresDF.withColumn("openDateString", date(col("openDate"), "EEEE, MMM d, yyyy h:mm a"))
  • DstoresDF.newColumn(col("openDateString"), from_unixtime("openDate", "EEEE, MMM d, yyyy
  • EstoresDF.withColumn("openDateString", date(col("openDate"), "EEEE, MMM d, yyyy h:mm a",

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

#Spark DataFrames#Date/Time Functions#from_unixtime#Column Transformations
Full DATABRICKS-CERTIFIED-ASSOCIATE-DEVELOPER-FOR-APACHE-SPARK Practice