Skip to content

Instantly share code, notes, and snippets.

@NeerajBhadani
Created May 25, 2020 15:13
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save NeerajBhadani/7a10e5082225f7d0f47109c564eb368c to your computer and use it in GitHub Desktop.
lag
val winSpec = Window.partitionBy("depName").orderBy("salary")
val lag_df =
empsalary.withColumn("lag", lag("salary", 2).over(winSpec))
lag_df.show()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment