Github user viirya commented on a diff in the pull request:
https://github.com/apache/spark/pull/19862#discussion_r154556774
--- Diff:
sql/catalyst/src/main/java/org/apache/spark/sql/execution/UnsafeExternalRowSorter.java
---
@@ -159,6 +159,12 @@ public boolean hasNext() {
@Override
public UnsafeRow next() {
try {
+ if (!alreadyCalculated) {
+ while (inputIterator.hasNext()) {
+ insertRow(inputIterator.next());
+ }
+ alreadyCalculated = true;
--- End diff --
We have cleaned up resources when we have an empty iterator at L144. We
should still follow it.
---
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]