public void insertKV(UnsafeRow key, UnsafeRow value) throws IOException {
        final long prefix = prefixComputer.computePrefix(key);
        sorter.insertKVRecord(
                key.getBaseObject(), key.getBaseOffset(), key.getSizeInBytes(),
                value.getBaseObject(), value.getBaseOffset(), value.getSizeInBytes(), prefix);
    }
Inserts a key-value record into the sorter. If the sorter no longer has enough memory to hold
the record, the sorter sorts the existing records in-memory, writes them out as partially
sorted runs, and then reallocates memory to hold the new record.
indexr-query-opt/src/main/java/org/apache/spark/sql/execution/UnsafeKVExternalSorter.java