I'm new to Spark and I'm struggling to convert a column of Array[Double] to n columns. For example, I want to convert this
+------------------+
| vector|
+------------------+
| [19.224, 46.9505]|
+------------------+
to this:
+-----------------+------------------+
| vector1| vector2|
+-----------------+------------------+
| 19.224| 46.9505|
+-----------------+------------------+
Possibly applying the original schema
that I've stored before.
I've tried the explode
sql utility but it spreads all the values on a single column like this
+------------------+
| vector3|
+------------------+
| 19.224|
| 46.9505|
+------------------+
Is there a way to do this without using udfs?
Any help will be appreciated