What I need to do?
Create schema for a DataFrame that should look like this:
root
|-- doubleColumn: double (nullable = false)
|-- longColumn: long (nullable = false)
|-- col0: double (nullable = true)
|-- col1: double (nullable = true)
...
Columns with prefix col can vary in number. Their names are stored in an array ar: Array[String].
My attempt
val schema = StructType(
StructField("doubleColumn", DoubleType, false) ::
StructField("longColumn", LongType, false) ::
ar.map(item => StructField(item, DoubleType, true)) // how to reduce it?
Nil
)
I have a problem with the commented line (4), I don't know, how to pass this array.