[SPARK-2873] use ExternalAppendOnlyMap to resolve aggregate's OOM