Choose OnHeapAggregation or ExternalAggregation base on spark.sql.aggregate.external in SQLConf