kee
kee

Reputation: 11629

Value list in Reduce function is ordered determinstically?

If I just use the default sorting comparator and grouping comparator, I guess the ordering of the value lists in Reduce wouldn't be determinstic? It will be random?

Upvotes: 0

Views: 46

Answers (1)

Judge Mental
Judge Mental

Reputation: 5239

You should assume the ordering of values will be random. The default comparator (and all comparators, actually) only compares and groups keys, not values.

The common pattern for rendering the value order deterministic requires sneaking part of the value into the key and ignoring that extra part for the grouping partitioner and comparator, while considering it for the sorting comparator.

Upvotes: 1

Related Questions