You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by GitBox <gi...@apache.org> on 2022/08/26 17:13:23 UTC

[GitHub] [spark] JoshRosen commented on a diff in pull request #37668: [SPARK-40224][SQL] Make ObjectHashAggregateExec release memory eagerly when fallback to sort-based

JoshRosen commented on code in PR #37668:
URL: https://github.com/apache/spark/pull/37668#discussion_r956244603


##########
sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/ObjectAggregationMap.scala:
##########
@@ -54,6 +54,7 @@ class ObjectAggregationMap() {
       }
       override def next(): AggregationBufferEntry = {
         val entry = iter.next()
+        iter.remove()

Review Comment:
   This memory usage optimization makes sense to me.
   
   What do you think about renaming this `def iterator: Iterator[AggregationBufferEntry]` to `destructiveIterator` to make it clearer to the caller that this destructs the map? That would be consistent with similar `destructiveIterator` methods elsewhere in the code, e.g.
   
   https://github.com/apache/spark/blob/4f4a080a78c3979961e8483aace663bdc45f489d/sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/ObjectAggregationIterator.scala#L244-L248



-- 
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.

To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


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