srowen commented on a change in pull request #23983: [SPARK-26881][mllib]
Heuristic for tree aggregate depth
URL: https://github.com/apache/spark/pull/23983#discussion_r263851419
##########
File path:
mllib/src/main/scala/org/apache/spark/mllib/linalg/distributed/RowMatrix.scala
##########
@@ -117,6 +117,7 @@ class RowMatrix @Since("1.0.0") (
// Computes n*(n+1)/2, avoiding overflow in the multiplication.
// This succeeds when n <= 65535, which is checked above
val nt = if (n % 2 == 0) ((n / 2) * (n + 1)) else (n * ((n + 1) / 2))
+ val gramianSizeInMb = (nt / 1000000) * 8
Review comment:
These are integers though. (999999/1000000)*8 == 0, but (999999*8)/1000000
== 7, which is more like correct. It has to be done using longs though to avoid
overflow: `((nt * 8L) / 1000000).toInt`
----------------------------------------------------------------
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]
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]