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 89 discussion

The code block shown below contains an error. The code block intended to return a DataFrame containing a column dayOfYear, an integer representation of the day of the year from column openDate from DataFrame storesDF. Identify the error.

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.

A sample of storesDF is displayed below:



Code block:

storesDF.withColumn("dayOfYear", dayofyear(col("openDate")))

  • A. The dayofyear() operation cannot extract the day of year from a column of type integer – column openDate must first be converted to type Timestamp.
  • B. The dayofyear() operation takes a quoted column name rather than a Column object as its first argument – the first argument should be "openDate".
  • C. The dayofyear() operation cannot extract the day of year from a column of type integer – column openDate must first be converted to type Date.
  • D. The dayofyear() operation is not applicable in a withColumn() call – the newColumn() operation must be used instead.
  • E. There is no dayofyear() operation – the day of year number must be extracted using substring utilities.
Show Suggested Answer Hide Answer
Suggested Answer: A 🗳️

Comments

Chosen Answer:
This is a voting comment (?). It is better to Upvote an existing comment if you don't have anything to add.
Switch to a voting comment New
tangerine141
9 months, 1 week ago
Selected Answer: A
A is correct
upvoted 1 times
...
newusername
1 year ago
Selected Answer: A
A is correct
upvoted 1 times
...
kaisa1234
1 year, 2 months ago
But question 50 is the same question and states that the code block with an error is the correct
upvoted 1 times
newusername
1 year ago
the answer there is wrong. I posted the correct one.
upvoted 1 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 ...