我想读取一个源文件并将数据写入带有附加标识列的 Spark scala 中的 .Csv 文件

i want read a source file and write data into .Csv file in Spark scala with additional identity columns

我想读取一个 CSV 文件并存储到一个 csv 文件中,其中包含一些额外的列,例如自动生成的列、标识列、加载日期时间。

我正在使用 spark 2.0。

您可以使用 withColumn 方法将列添加到 DataFrame。 https://spark.apache.org/docs/latest/api/scala/index.html#org.apache.spark.sql.Dataset@withColumn(colName:String,col:org.apache.spark.sql.Column):org.apache.spark.sql.DataFrame