public Iterator<InternalRow> sort(Iterator<? extends InternalRow> inputIterator) throws IOException {
        while (inputIterator.hasNext()) {
            insertRow((UnsafeRow) inputIterator.next());
        }
        return sort();
    }
Return the peak memory used so far, in bytes.
indexr-query-opt/src/main/java/org/apache/spark/sql/execution/UnsafeExternalRowSorter.java