Skip to content

Instantly share code, notes, and snippets.

@NeerajBhadani
Last active May 31, 2020 14:04
Show Gist options
  • Save NeerajBhadani/b6cae0e12c1e6c14261f00718b8777ea to your computer and use it in GitHub Desktop.
Save NeerajBhadani/b6cae0e12c1e6c14261f00718b8777ea to your computer and use it in GitHub Desktop.
lead
val winSpec = Window.partitionBy("depName").orderBy("salary")
val lead_df =
empsalary.withColumn("lead", lead("salary", 2).over(winSpec))
lead_df.show()
@NeerajBhadani
Copy link
Author

changed column name from lag to lead.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment