Skip to content

Instantly share code, notes, and snippets.

@onastavchuk
Created November 2, 2017 16:38
Show Gist options
  • Save onastavchuk/e4ff95f95a42aa4c07039d52260e9cb6 to your computer and use it in GitHub Desktop.
Save onastavchuk/e4ff95f95a42aa4c07039d52260e9cb6 to your computer and use it in GitHub Desktop.
val days = df.select(
col("host"),
month(col("time")).alias("month"),
dayofmonth(col("time")).alias("day")
).distinct()
days.groupBy("month", "day")
.count()
.sort(desc("count"))
.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment