Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -111,12 +111,16 @@ private class PartitionIterator[T](
reader: PartitionReader[T],
customMetrics: Map[String, SQLMetric]) extends Iterator[T] {
private[this] var valuePrepared = false
private[this] var prevHasNext = true
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think hasMoreInput is a better name.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

+1


private var numRow = 0L

override def hasNext: Boolean = {
if (!valuePrepared) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can you follow the change in https://github.com/apache/spark/pull/37900/files ? It can avoid entering this if branch entirely.

valuePrepared = reader.next()
if (prevHasNext) {
prevHasNext = reader.next()
}
valuePrepared = prevHasNext
}
valuePrepared
}
Expand Down