From my analysis, the write phase is completing relatively quickly. The primary performance issue seems to be the DISTINCT operation, which is taking a significant amount of time due to the shuffle and deduplication overhead.