Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@NeerajBhadani
Created May 25, 2020 10:19
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 NeerajBhadani/4b49278fc7ac1d21dd9055891b9b018e to your computer and use it in GitHub Desktop.
Save NeerajBhadani/4b49278fc7ac1d21dd9055891b9b018e to your computer and use it in GitHub Desktop.
arr_slice_posexplode
// create an array column with few values to explode.
val temp_df = df.withColumn("slice_col", slice($"array_col2", 1, 2))
.drop("array_col2")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment