I have two lists as follows:
InputColumns:
List(col1, col2, col3, col4, col5, col6, col7, col8, col9, col10, col11, col12, col13)
InputData:
List(
Map(col2 -> dummy string, col7 -> 2016-01-01, col11 -> 2011-01-01),
Map(col2 -> dummy string, col7 -> 2018-01-01, col11 -> 2018-01-01),
Map(col2 -> dummy string, col7 -> 2018-04-01, col11 -> 2018-04-01),
Map(col2 -> dummy string, col7 -> 2016-01-01, col11 -> 2016-01-01)
)
What I am trying to do is generate a string after I iterate through them both. so if the colX names match then give it the value in the Map else give it the value NULL.
So in the example above I would loop through 4 times, creating 4 strings that would return:
(Null, dummy string, Null, Null, Null, Null,2016-01-01, Null) ..etc..
I thought of starting as follows. loop through my list of input columns and then loop through each key of my input data but I feel I'm a fair way off.
inputColumns.foreach(column => {
inputData.foreach{ case (k,v) =>
// I get a constructor cannot be instantiated to expected type error
}
})
col1, ...,col13?