Seção 1. Capítulo 9
single
Challenge: Analyzing Sales Data with Spark SQL
Deslize para mostrar o menu
Tarefa
Deslize para começar a programar
You are given a flights dataset as a list of rows. Load it into a DataFrame, register it as a temporary view, and answer the following using spark.sql(). Store results in the specified variables:
- Find the top 3 routes (unique
AirportFrom+AirportTopairs) by averageLength– store as a list of tuples[(origin, destination, avg_length), ...]intop_routes_by_length; - For each airline, find the flight with the longest
Lengthusing a window function withrow_number()– store as a DataFrame inlongest_flight_per_airlinewith columnsAirline,Flight,Length; - Count how many delayed flights (
Delay == 1) perDayOfWeek– store as a list of tuples[(day_of_week, count), ...]sorted byDayOfWeekascending indelays_by_dow.
Print all results.
Solução
Tudo estava claro?
Obrigado pelo seu feedback!
Seção 1. Capítulo 9
single
Pergunte à IA
Pergunte à IA
Pergunte o que quiser ou experimente uma das perguntas sugeridas para iniciar nosso bate-papo