I'm trying to pivot a Spark DF columns into rows like the example below.
scala> df.show() +----+--------------------+ |year| String| +----+--------------------+ |ina|List(Apple, 136, Train ...)...| |inb|List(Orange, 4.36, car ...)...| |ina|List(Apple,34, plane ...)...| +----+--------------------+ And create an output DF as:
+----+-------------+-------------+ |year|key|String| +----+-------------+-------------+ |ina|Apple |136 | |inb|Car |4.36 | |ina|Orange |34 | How can I get the desired output? using explode?
Many thanks!