Github user srowen commented on a diff in the pull request:

    https://github.com/apache/spark/pull/18868#discussion_r131603462
  
    --- Diff: 
mllib/src/main/scala/org/apache/spark/ml/tree/impl/RandomForest.scala ---
    @@ -1107,9 +1108,11 @@ private[spark] object RandomForest extends Logging {
             mutableTreeToNodeToIndexInfo
               .getOrElseUpdate(treeIndex, new mutable.HashMap[Int, 
NodeIndexInfo]())(node.id)
               = new NodeIndexInfo(numNodesInGroup, featureSubset)
    +        numNodesInGroup += 1
    +        memUsage += nodeMemUsage
    +      } else {
    +        flag = false
    --- End diff --
    
    "flag" isn't that descriptive. What about simply clearing the stack to make 
the loop terminate naturally? or a break?
    
    Actually can the loop just use `nodeStack.pop()` at the top? it isn't 
necessary to peek at it with top and then later decide to pop. It can be 
removed no matter what.


---
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 infrastruct...@apache.org or file a JIRA ticket
with INFRA.
---

---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org
For additional commands, e-mail: reviews-h...@spark.apache.org

Reply via email to