Be careful with `reduce`, it will throw exception if some of the partitions are empty. Using `aggregate` is better.