Github user cloud-fan commented on the issue: https://github.com/apache/spark/pull/18679 I left a comment in https://github.com/apache/spark/pull/18543#discussion_r128236888 your concern is valid, in the case of `coalesce`, we may have many mergers in one task, and some mergers may finish earlier and waiting for the end of the task to do cleanup. There are 3 possible fixes: 1. do cleanup at the end of the in-memory sorter and the merger. Like this PR did 2. copy the comparator when passing to the in-memory sorter and the merger. Like #18543 did 3. avoid referring `UnsafeExternalSorter` in `TaskContext`.
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org