spark-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Vikas Garg <sperry...@gmail.com>
Subject Spark Dataset withColumn issue
Date Thu, 12 Nov 2020 14:26:08 GMT
In Spark Datase, if we add additional column using
withColumn
then the column is added in the last.

e.g.
val ds1 = ds.select("Col1", "Col3").withColumn("Col2", lit("sample"))

the the order of columns is >> Col1  |  Col3  |  Col2

I want the order to be  >> Col1  |  Col2  |  Col3

How can I achieve this?

Mime
View raw message