0
我有一个火花dataframe
与许多列。使用Spark和斯卡拉,我想按指定的顺序选择列,但我不想硬编码所需的顺序。在伪代码中,我想要做类似的事情:重新排列火花柱的顺序
val colNames = df.columns
val newOrder = colNames(colNames.length) ++ colNames(0:colNames.length-1)
df.select(newOrder)
我该怎么做?谢谢!