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

    https://github.com/apache/spark/pull/16435#discussion_r94201244
  
    --- Diff: 
sql/core/src/main/scala/org/apache/spark/sql/execution/aggregate/ObjectAggregationIterator.scala
 ---
    @@ -154,21 +200,19 @@ class ObjectAggregationIterator(
           while (inputRows.hasNext && !sortBased) {
             val newInput = safeProjection(inputRows.next())
             val groupingKey = groupingProjection.apply(newInput)
    -        val buffer: InternalRow = getAggregationBufferByKey(hashMap, 
groupingKey)
    -        processRow(buffer, newInput)
    -
    -        // The the hash map gets too large, makes a sorted spill and clear 
the map.
    -        if (hashMap.size >= fallbackCountThreshold) {
    -          logInfo(
    -            s"Aggregation hash map reaches threshold " +
    -              s"capacity ($fallbackCountThreshold entries), spilling and 
falling back to sort" +
    -              s" based aggregation. You may change the threshold by adjust 
option " +
    -              SQLConf.OBJECT_AGG_SORT_BASED_FALLBACK_THRESHOLD.key
    -          )
    -
    +        val buffer: (InternalRow, Long, Int) = 
getAggregationBufferByKey(hashMap, groupingKey)
    +        if (buffer == null) {
               // Falls back to sort-based aggregation
               sortBased = true
    -
    +        } else {
    +          processRow(buffer._1, newInput)
    +          if (buffer._3 == 10) {
    --- End diff --
    
    Why 10? Is it better to add a comment to choose this value?


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