Skip to content

Instantly share code, notes, and snippets.

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