Skip to content

Instantly share code, notes, and snippets.

@NeerajBhadani
Created May 25, 2020 15:02
Show Gist options
  • Save NeerajBhadani/d9b7235eb22d9822b636cdb212179faa to your computer and use it in GitHub Desktop.
Save NeerajBhadani/d9b7235eb22d9822b636cdb212179faa to your computer and use it in GitHub Desktop.
Window Aggregate function
val agg_sal = empsalary
.withColumn("max_salary", max("salary").over(byDepName))
.withColumn("min_salary", min("salary").over(byDepName))
agg_sal.select("depname", "max_salary", "min_salary")
.dropDuplicates()
.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment