0

I have a data frame to which I want to add a column with the values which are present in an array. I want each value in the array to be placed in the column as each row. For Example:

val partitionName= "processingdatadate";
val partitionValue= "20170528,20170529,20170530";
var parts: Array[String] = partitionValue.split(",")
var partValues = parts.toSeq 

I have a data frame 'loadParqDf' so to this I want to add a column with name 'processingdatadate'

loadParqDF = loadParqDF.withcolumn(partitionName, lit(partValues))

This method is not working because the output is not expected :

processingdatadate
----------------------------
[20170528,20170529,20170530]

I am expecting output as:

processingdatadate
------------------
20170528
20170529
20170530

0 Answers0