nerdexam
DatabricksDatabricks

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

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

The correct answer is A: storesDF.withColumn("openDatestring", from unixtime(col("openDate"), "EEEE, MMM d, yyyy. See the full explanation below for the reasoning.

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",

Topics

#Spark DataFrames#Date/Time Functions#from_unixtime#Column Transformations

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