Group sorted results by partition key.