srowen commented on a change in pull request #29925:
URL: https://github.com/apache/spark/pull/29925#discussion_r498461716



##########
File path: 
mllib/src/main/scala/org/apache/spark/mllib/linalg/distributed/RowMatrix.scala
##########
@@ -786,11 +786,15 @@ class RowMatrix @Since("1.0.0") (
    * Based on the formulae: (numPartitions)^(1/depth) * objectSize <= 
DriverMaxResultSize
    * @param aggregatedObjectSizeInBytes the size, in megabytes, of the object 
being tree aggregated
    */
-  private[spark] def getTreeAggregateIdealDepth(aggregatedObjectSizeInBytes: 
Long) = {
+  private[spark] def getTreeAggregateIdealDepth(aggregatedObjectSizeInBytes: 
Long): Int = {
     require(aggregatedObjectSizeInBytes > 0,
       "Cannot compute aggregate depth heuristic based on a zero-size object to 
aggregate")
 
     val maxDriverResultSizeInBytes = rows.conf.get[Long](MAX_RESULT_SIZE)
+    if (maxDriverResultSizeInBytes == 0) {
+      // Unlimited result size, so 1 is OK
+      return 1

Review comment:
       Good question - 2 could be OK too. I suspect that was chosen to line up 
with the default max result size. Higher depths are needed when the result size 
is smaller, so I figured when the result size is unlimited, the depth can be as 
low as possible, 1.




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to