import org.apache.spark.sql.functions._
import org.apache.spark.sql.DataFrame
val exampleDF = Seq(("A", 1, "X"), ("B", 2, "Y"), ("C", 3, "Z")).toDF("col1", "col2", "col3")
// 使用函数explode和collect_list将多列合并成一列
val columnsAsRows = exampleDF.select(explode(array(exampleDF.columns.map(col): _*)).as("BP"))
// 显示生成的新DataFrame
columnsAsRows.show()
待补充