I hit a snag earlier, trying to do some transformations within Spark Dataframes.
Let's say I have a dataframe of schema :
root
|-- coordinates: array (nullable = true)
| |-- element: double (containsNull = true)
|-- userid: string (nullable = true)
|-- pubuid: string (nullable = true)
I would like to get rid of the array(double) in coordinates, and instead get a DF with row that look like
"coordinates(0),coordinates(1)", userid, pubuid
or something like
coordinates(0), coordinates(1), userid, pubuid .
With Scala I could do
coordinates.mkString(",")
but in DataFrames coordinates resolves to a java.util.List.
So far I worked around the issue, by reading into an RDD, transforming then building a new DF. But I was wondering if there's a more elegant way to do that with Dataframes.
Thanks for your help.