Skip to content

Commit 02d107a

Browse files
committed
Fixed bug in treeAggregate using fold
1 parent 16e79e3 commit 02d107a

File tree

1 file changed

+2
-3
lines changed
  • core/src/main/scala/org/apache/spark/rdd

1 file changed

+2
-3
lines changed

core/src/main/scala/org/apache/spark/rdd/RDD.scala

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1089,9 +1089,8 @@ abstract class RDD[T: ClassTag](
10891089
(i, iter) => iter.map((i % curNumPartitions, _))
10901090
}.foldByKey(zeroValue, new HashPartitioner(curNumPartitions))(cleanCombOp).values
10911091
}
1092-
//partiallyAggregated.reduce(cleanCombOp)
1093-
// This fails:
1094-
partiallyAggregated.fold(zeroValue)(cleanCombOp)
1092+
val copiedZeroValue = Utils.clone(zeroValue, sc.env.closureSerializer.newInstance())
1093+
partiallyAggregated.fold(copiedZeroValue)(cleanCombOp)
10951094
}
10961095
}
10971096

0 commit comments

Comments
 (0)