【发布时间】:2022-01-24 08:32:01
【问题描述】:
我正在 for 循环中读取 Spark 中的数据并执行连接并将数据以附加模式写入路径。
for (partition <- partitionlist) {
var df = spark.read.parquet("path")
var df2 = df.join(anotherdf, col("col1") === col("col1"))
df2.write.mode("SaveMode.Append").partitionBy("partitionColumn").format("parquet").save("anotherpath")
}
在上面的示例代码中,我们使用的是 spark 2.X 版本。由于 spark 2 write API 不一致,是否有可能在任何迭代的情况下,如果阶段/任务重试(写入路径)并在几次重试后成功,我们是否有可能看到数据发生重试的那个for循环迭代的写入数据冗余?
编辑:spark.hadoop.mapreduce.fileoutputcommitter.algorithm.version=2 正在使用中。
【问题讨论】:
标签: apache-spark apache-spark-sql apache-spark-2.0