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: [email protected]

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