-
-
Save ppillay/94cd617ecd369b3ffd17e627fae94d2c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
case class FlightDetails(year: Int, month: Int, day_of_month: Int, airline_Id: Int, origin: String, dest: Int, delay: Double) | |
val ds = df.as[FlightDetails] | |
def averageDelay = typedAvg[FlightDetails](_.delay) | |
.name("average_delay") | |
val resultDS = ds.filter(_.delay > 0) | |
.groupByKey(x => (x.origin, x.dest) ) | |
.agg(averageDelay) | |
.sort($"average_delay".desc) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment