cloud-fan commented on code in PR #52190: URL: https://github.com/apache/spark/pull/52190#discussion_r2317713815
########## sql/core/src/main/scala/org/apache/spark/sql/execution/ExternalAppendOnlyUnsafeRowArray.scala: ########## @@ -116,19 +121,24 @@ private[sql] class ExternalAppendOnlyUnsafeRowArray( spillableArray = null } else if (inMemoryBuffer != null) { inMemoryBuffer.clear() + inMemoryBufferSizeInBytes = 0; } numFieldsPerRow = 0 numRows = 0 modificationsCount += 1 } def add(unsafeRow: UnsafeRow): Unit = { - if (numRows < numRowsInMemoryBufferThreshold) { + // Once spills, we will switch to UnsafeExternalSorter permanently. + if (spillableArray == null && numRows < numRowsInMemoryBufferThreshold && + inMemoryBufferSizeInBytes < sizeInBytesSpillThreshold) { Review Comment: ```suggestion inMemoryBufferSizeInBytes < sizeInBytesInMemoryBufferThreshold) { ``` -- 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-unsubscr...@spark.apache.org For queries about this service, please contact Infrastructure at: us...@infra.apache.org --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org