@VisibleForTesting
    void insertRow(UnsafeRow row) throws IOException {
        final long prefix = prefixComputer.computePrefix(row);
        sorter.insertRecord(
                row.getBaseObject(),
                row.getBaseOffset(),
                row.getSizeInBytes(),
                prefix
        );
        numRowsInserted++;
        if (testSpillFrequency > 0 && (numRowsInserted % testSpillFrequency) == 0) {
            sorter.spill();
        }
    }
Forces spills to occur every `frequency` records. Only for use in tests.
indexr-query-opt/src/main/java/org/apache/spark/sql/execution/UnsafeExternalRowSorter.java