Created
October 25, 2018 11:44
-
-
Save BigAN/d7dc55596b20f310f5643de9d33d0d0f to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
3 | |
down vote | |
accepted | |
This is what you could do, split the string with pipe and explode the data using spark function | |
import org.apache.spark.sql.functions._ | |
import spark.implicits._ | |
val df = Seq(("a1", "b1", "c1|c2|c3|c4")).toDF("A", "B", "C") | |
df.withColumn("C", explode(split($"C", "\\|"))).show |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment