Câu 83: Databricks Certified Associate Developer for Apache Spark
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 ep…
Nội dung câu hỏi
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")))
Các lựa chọn
Đáp án được giữ gọn theo nhãn A, B, C, D trong phần bình chọn tương tác.
- 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. — đáp án hiện tại
- 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.
Cộng đồng
0 bình luận công khai. Tên thành viên được ẩn một phần.