1
我產生火花的數據集有沒有辦法在Spark數據集中保留變量的順序?
Dataset<myBeanClass> myDataset = myDataFrame.as(Encoders.bean(myBeanClass.class));
在這一點上,它的模式看起來像,
root
|-- name: string (nullable = true)
|-- age: string (nullable = true)
|-- gender: string (nullable = true)
執行地圖改造後,
Dataset<myBeanClass> resultDataset = myDataset.map(new MapFunction<myBeanClass,myBeanClass>() {
@Override
public myBeanClass call(myBeanClass v1) throws Exception {
// some code
return v1;
}
}, Encoders.bean(myBeanClass.class));
架構變得
root
|-- age: string (nullable = true)
|-- gender: string (nullable = true)
|-- name: string (nullable = true)
也注意到this示例中的相同行爲。有沒有辦法保留訂單?