博主您好兴猩,請問下
rdd.mapPartitions(x => {
println("連接數(shù)據(jù)庫")
val res = x.map(line=>{
print("寫入數(shù)據(jù):" + line)
line
})
res
})
這段代碼中為什么不能關(guān)閉數(shù)據(jù)庫連接
Spark系列——關(guān)于 mapPartitions的誤區(qū)前言 今天 Review 了一下同事的代碼酿矢,發(fā)現(xiàn)其代碼中有非常多的 mapPartitions,問其原因陨收,他說性能比 map 更好盛杰。我說為什么性能好呢境肾?于是就有了這篇文章 網(wǎng)...