Github user kmadhugit commented on a diff in the pull request:
https://github.com/apache/spark/pull/7168#discussion_r34147691
--- Diff: core/src/main/scala/org/apache/spark/rdd/RDD.scala ---
@@ -1078,7 +1078,9 @@ abstract class RDD[T: ClassTag](
val scale = math.max(math.ceil(math.pow(numPartitions, 1.0 /
depth)).toInt, 2)
// If creating an extra level doesn't help reduce
// the wall-clock time, we stop tree aggregation.
- while (numPartitions > scale + numPartitions / scale) {
+
+ // Don't trigger treeAggregation for 5 partitions
+ while (numPartitions > 5 && (numPartitions > scale + numPartitions /
scale)) {
--- End diff --
The tree is not formed as someone would expected it to be..
As per the current code,
treeAggregate num Partitions = 27 Depth = 3 scale = 3 Tree =>
(27)=>(9)=>(3)=>(1)
treeAggregate num Partitions = 16 Depth = 3 scale = 3 Tree =>
(16)=>(5)=>(1)=>(1)
treeAggregate num Partitions = 8 Depth = 3 scale = 2 Tree => (8)=>(4)=>(1)
We are trying to fix the second one as
treeAggregate num Partitions = 16 Depth = 3 scale = 3 Tree => (16)=>(5)=>(1)
Don't we need to fix it as given below to honor the given depth?
treeAggregate num Partitions = 16 Depth = 3 scale = 2 Tree =>
(16)=>(8)=>(4)=>(2)=>(1)
This is because of the unncessary math.ceil used while calculating the scale
val scale = math.max(math.ceil(math.pow(numPartitions, 1.0 / depth)).toInt,
2)
---
If your project is set up for it, you can reply to this email and have your
reply appear on GitHub as well. If your project does not have this feature
enabled and wishes so, or if the feature is enabled but not working, please
contact infrastructure at [email protected] or file a JIRA ticket
with INFRA.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]