Câu 36: Databricks Certified Associate Developer for Apache Spark
The code block shown below contains an error. The code block is intended to create a Python UDF assessPerformanceUDF() using the integer-returning Python function assessPerformance() and apply it to column customerSatisfaction in DataFrame storesDF. Identify the error. Code block:assessPerformanceUDF – udf(assessPerfo…
Nội dung câu hỏi
The code block shown below contains an error. The code block is intended to create a Python UDF assessPerformanceUDF() using the integer-returning Python function assessPerformance() and apply it to column customerSatisfaction in DataFrame storesDF. Identify the error. Code block:assessPerformanceUDF – udf(assessPerformance)storesDF.withColumn("result", assessPerformanceUDF(col("customerSatisfaction")))
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 assessPerformance() operation is not properly registered as a UDF.
- B. The withColumn() operation is not appropriate here – UDFs should be applied by iterating over rows instead.
- C. UDFs can only be applied vie SQL and not through the DataFrame API.
- D. The return type of the assessPerformanceUDF() is not specified in the udf() operation. — đáp án hiện tại
- E. The assessPerformance() operation should be used on column customerSatisfaction rather than the assessPerformanceUDF() operation.
Cộng đồng
0 bình luận công khai. Tên thành viên được ẩn một phần.