@VisibleForTesting
    void setTestSpillFrequency(int frequency) {
        assert frequency > 0 : "Frequency must be positive";
        testSpillFrequency = frequency;
    }
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