Section 1. Chapter 6
single
Challenge: Analyzing a Text File with RDDs
Swipe to show menu
Task
Swipe to start coding
Download the flights dataset and load it into a Spark DataFrame, then convert it to an RDD. Using only RDD transformations and actions – no DataFrame methods – complete the following:
- Count the total number of flights in the dataset and store it in
total_flights; - Filter flights where
DEPARTURE_DELAYis greater than 30 minutes, count them, and store the result indelayed_count; - From the delayed flights, extract unique airlines and store the sorted list in
delayed_airlines; - Find the maximum
DISTANCEvalue usingreduce()and store it inmax_distance.
Solution
Everything was clear?
Thanks for your feedback!
Section 1. Chapter 6
single
Ask AI
Ask AI
Ask anything or try one of the suggested questions to begin our chat