I am trying to transpose column to rows . First to concat columns into an array Second step is to explode the array column
Explode function is not working ..
>>> filteredPaths1.select( array ( concat( col("v1.id"),lit(","),col("v2.id"),lit(",") ,col("v2.id") )).alias("test") ).printSchema()
root
|-- test: array (nullable = false)
| |-- element: string (containsNull = true)
Values in array column -
>>> filteredPaths1.select( array ( concat( col("v1.id"),lit(","),col("v2.id"),lit(",") ,col("v2.id") )).alias("test") ).show(10,False)
+--------------------------------------------------------------+ ]
|test |
+--------------------------------------------------------------+
|[Sorter_SAMPLE_CUSTOMER,Join_Source_Target,Join_Source_Target]|
+--------------------------------------------------------------+
However when trying to explode the array column it's not creating new rows , just giving the same output -
>>> filteredPaths1.select( explode (array ( concat( col("v1.id"),lit(","),col("v2.id"),lit(",") ,col("v2.id") )).alias("test") ) ).show(10,False)
+------------------------------------------------------------+ ]
|col |
+------------------------------------------------------------+
|Sorter_SAMPLE_CUSTOMER,Join_Source_Target,Join_Source_Target|
+------------------------------------------------------------+
Any reason explode is not working ?