tomvanbussel commented on a change in pull request #29772:
URL: https://github.com/apache/spark/pull/29772#discussion_r489506520
##########
File path:
core/src/main/java/org/apache/spark/util/collection/unsafe/sort/UnsafeExternalSorter.java
##########
@@ -516,32 +520,34 @@ public int getNumRecords() {
return numRecords;
}
+ @Override
+ public long getCurrentPageNumber() {
+ throw new UnsupportedOperationException();
+ }
+
public long spill() throws IOException {
synchronized (this) {
- if (!(upstream instanceof UnsafeInMemorySorter.SortedIterator &&
nextUpstream == null
- && numRecords > 0)) {
+ if (inMemSorter == null || numRecords <= 0) {
Review comment:
I think it was originally supposed to mean this, but it could also mean
that all records have been read. This is actually a bug as during the call to
spill it would prevent freeing the memory that's no longer necessary. I've kept
this bug here to keep the changelist as small as possible (there's a little bit
more to this than just removing the check). I'll address this issue in a
separate ticket if that's okay.
----------------------------------------------------------------
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:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]