Skip to content

Commit

Permalink
[improve] improve batch iterator has next check (#164)
Browse files Browse the repository at this point in the history
  • Loading branch information
gnehil authored Nov 27, 2023
1 parent 86ca733 commit 3efe6ff
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,17 @@ class DorisWriter(settings: SparkSettings, preCommittedTxnAcc: CollectionAccumul

private var isReset = false

override def hasNext: Boolean = recordCount < batchSize && iterator.hasNext
override def hasNext: Boolean = {
if (recordCount < batchSize) {
if (isReset) {
recordCount < buffer.size
} else {
iterator.hasNext
}
} else {
false
}
}

override def next(): T = {
recordCount += 1
Expand Down

0 comments on commit 3efe6ff

Please sign in to comment.