public UnsafeKVExternalSorter destructAndCreateExternalSorter() throws IOException {
        return new UnsafeKVExternalSorter(
                groupingKeySchema, aggregationBufferSchema,
                //SparkEnv.get().blockManager(),
                map.getPageSizeBytes(), map);
    }
Sorts the map's records in place, spill them to disk, and returns an [[UnsafeKVExternalSorter]]

Note that the map will be reset for inserting new records, and the returned sorter can NOT be used
to insert records.
indexr-query-opt/src/main/java/org/apache/spark/sql/execution/UnsafeFixedWidthAggregationMap.java