Câu 49: Databricks Certified Associate Developer for Apache Spark
The code block shown below contains an error. The code block is intended to return a DataFrame containing a column openDateString, a string representation of Java’s SimpleDateFormat. Identify the error. Note that column openDate is of type integer and represents a date in the UNIX epoch format – the number of seconds…
Nội dung câu hỏi
The code block shown below contains an error. The code block is intended to return a DataFrame containing a column openDateString, a string representation of Java’s SimpleDateFormat. 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. An example of Java’s SimpleDateFormat is "Sunday, Dec 4, 2008 1:05 PM".A sample of storesDF is displayed below: Code block:storesDF.withColumn("openDateString", from_unixtime(col("openDate"), "EEE, MMM d, yyyy h:mm a", TimestampType()))
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 from_unixtime() operation only accepts two parameters – the TimestampTime() arguments not necessary. — đáp án hiện tại
- B. The from_unixtime() operation only works if column openDate is of type long rather than integer – column openDate must first be converted.
- C. The second argument to from_unixtime() is not correct – it should be a variant of TimestampType() rather than a string.
- D. The from_unixtime() operation automatically places the input column in java’s SimpleDateFormat – there is no need for a second or third argument.
- E. The column openDate must first be converted to a timestamp, and then the Date() function can be used to reformat to java’s SimpleDateFormat.
Cộng đồng
0 bình luận công khai. Tên thành viên được ẩn một phần.