I am new spark and python and facing this difficulty of building a schema from a metadata file that can be applied to my data file.
Scenario: Metadata File for the Data file(csv
val columns: Array[String] = df1.columns
val reorderedColumnNames: Array[String] = df2.columns //or do the reordering you want
val result: DataFrame = dataFrame.select(reorderedColumnNames.head, reorderedColumnNames.tail: _*)