Skip to content

Instantly share code, notes, and snippets.

@ppillay
Created June 16, 2017 04:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ppillay/10333efeead6382b9cb3bdb3632b8db8 to your computer and use it in GitHub Desktop.
Save ppillay/10333efeead6382b9cb3bdb3632b8db8 to your computer and use it in GitHub Desktop.
df.createOrReplaceTempView("flights")
val resultSQL = spark.sql("""SELECT origin, dest, avg(delay)
FROM flights
WHERE delay > 0
GROUP BY origin, dest
ORDER BY avg(delay) desc""")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment