DP-203 · Question #114
Drag and Drop Question You have an Apache Spark DataFrame named temperatures. A sample of the data is shown in the following table. You need to produce the following table by using a Spark SQL…
The correct answer is COLLATE; PIVOT; CAST. The correct sequence uses COLLATE to handle string comparison/ordering, PIVOT to transform row-based temperature data into a columnar format (rotating distinct values from a column into multiple columns), and CAST to convert data types (such as converting numeric temperature…
Question
Exhibits
Answer Area
Drag items
Correct arrangement
- COLLATE
- PIVOT
- CAST
Explanation
The correct sequence uses COLLATE to handle string comparison/ordering, PIVOT to transform row-based temperature data into a columnar format (rotating distinct values from a column into multiple columns), and CAST to convert data types (such as converting numeric temperature values to the appropriate type for display). PIVOT is the core operation here - it reshapes the DataFrame by turning row values (e.g., city or month names) into column headers, which is exactly what produces the target table structure from the source data.
Topics
Community Discussion
No community discussion yet for this question.

