Re: How to Exploding a Map[String,Int] column in a DataFrame (Scala)

2016-02-25 Thread Anthony Brew
Thanks guys both those answers are really helpful. Really appreciate this. On 25 Feb 2016 12:05 a.m., "Michał Zieliński" wrote: > Hi Anthony, > > Hopefully that's what you wanted :) > > case class Example(id:String, myMap: Map[String,Int]) >> val myDF = sqlContext.createDataFrame( >> Seq( >>

Re: How to Exploding a Map[String,Int] column in a DataFrame (Scala)

2016-02-24 Thread Michał Zieliński
Hi Anthony, Hopefully that's what you wanted :) case class Example(id:String, myMap: Map[String,Int]) > val myDF = sqlContext.createDataFrame( > Seq( > Example("a02d1fa5d87dce6a7", Map("Vans" -> 1, "Versace" ->2)) > ) > ) > myDF. > explode("myMap","tempSeq")((x: Map[String,Int]) => x.to

Re: How to Exploding a Map[String,Int] column in a DataFrame (Scala)

2016-02-24 Thread Michael Armbrust
You can do this using the explode function defined in org.apache.spark.sql.functions. Here is some example code . On Wed, Feb 24, 2