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

    https://github.com/apache/spark/pull/9383#discussion_r43787218
  
    --- Diff: 
sql/core/src/test/scala/org/apache/spark/sql/execution/UnsafeFixedWidthAggregationMapSuite.scala
 ---
    @@ -291,28 +278,27 @@ class UnsafeFixedWidthAggregationMapSuite
         val sorter = map.destructAndCreateExternalSorter()
     
         // Add more keys to the sorter and make sure the results come out 
sorted.
    +    map = createMap()
         (1 to 4096).foreach { i =>
    -      sorter.insertKV(UnsafeRow.createFromByteArray(0, 0), 
UnsafeRow.createFromByteArray(0, 0))
    +      
map.getAggregationBufferFromUnsafeRow(UnsafeRow.createFromByteArray(0, 0))
     
           if ((i % 100) == 0) {
    -        memoryManager.markExecutionAsOutOfMemoryOnce()
    -        sorter.closeCurrentPage()
    +        val sorter2 = map.destructAndCreateExternalSorter()
    +        sorter.merge(sorter2)
    +        map = createMap()
           }
         }
    +    val sorter2 = map.destructAndCreateExternalSorter()
    +    sorter.merge(sorter2)
     
         var count = 0
         val iter = sorter.sortedIterator()
         while (iter.next()) {
    -      // At here, we also test if copy is correct.
    -      iter.getKey.copy()
    -      iter.getValue.copy()
           count += 1
         }
     
    -    // 1 record was from the map and 4096 records were explicitly inserted.
    -    assert(count === 4097)
    -
    -    map.free()
    +    // 1 record in one map.
    +    assert(count === 42)
    --- End diff --
    
    Ah. Update comment to clarify that we spilled 42 times, hence this number?


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