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 2020/02/01 17:20:57 UTC
[GitHub] [spark] kiszk commented on a change in pull request #27246:
[SPARK-30536][CORE][SQL] Sort-merge join operator spilling performance
improvements
kiszk commented on a change in pull request #27246: [SPARK-30536][CORE][SQL] Sort-merge join operator spilling performance improvements
URL: https://github.com/apache/spark/pull/27246#discussion_r373791015
##########
File path: sql/core/src/main/scala/org/apache/spark/sql/execution/ExternalAppendOnlyUnsafeRowArray.scala
##########
@@ -204,22 +199,41 @@ private[sql] class ExternalAppendOnlyUnsafeRowArray(
}
}
- private[this] class SpillableArrayIterator(
+ private[this] class MergerIterator(
iterator: UnsafeSorterIterator,
- numFieldPerRow: Int)
+ numFieldPerRow: Int,
+ startIndex: Int)
extends ExternalAppendOnlyUnsafeRowArrayIterator {
- private val currentRow = new UnsafeRow(numFieldPerRow)
+ private var currentIndex = startIndex
- override def hasNext(): Boolean = !isModified() && iterator.hasNext
+ private val currentSorterRow = new UnsafeRow(numFieldPerRow)
+
+ override def hasNext(): Boolean = {
+ if (currentIndex < numRowBufferedInMemory) {
+ !isModified()
+ } else {
+ !isModified() && iterator.hasNext
+ }
+ }
override def next(): UnsafeRow = {
throwExceptionIfModified()
- iterator.loadNext()
- currentRow.pointTo(iterator.getBaseObject, iterator.getBaseOffset, iterator.getRecordLength)
- currentRow
+ if (currentIndex < numRowBufferedInMemory) {
+ val result = inMemoryBuffer(currentIndex)
+ currentIndex += 1
+ result
+ } else {
+ iterator.loadNext()
+ currentSorterRow.pointTo(iterator.getBaseObject,
+ iterator.getBaseOffset,
+ iterator.getRecordLength)
+ currentSorterRow
+ }
+ }
Review comment:
nit: indentation issues at lines 233 and 234
----------------------------------------------------------------
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.
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
With regards,
Apache Git Services
---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org