educative.io

Clearer explanation of Round-Robin partitioning needed

Reading the description of round-robin partitioning leaves me unclear. The description is:

c. Round-robin partitioning: This is a very simple strategy that ensures uniform data distribution. With ‘n’ partitions, the ‘i’ tuple is assigned to partition (i mod n).

When I read this, it implies that round-robin partitioning actually relies on a hash function (i mod n). But does the partitioning actually rely on that “function” explicitly being executed, or would it be more appropriate to think of the partition being assigned from a sequential read of a list of possible partitions, always assigning to the next partition in the list, with no real way to reverse engineer where any particular record exists without having to search every partition?

Hi @Jared_Crain
Round-robin partitioning is used to achieve an equal distribution of rows to partitions. However, unlike hash partitioning, you do not have to specify partitioning columns. With round-robin partitioning, new rows are assigned to partitions on a rotation basis.

The round-robin method always creates approximately equal size partitions… The first record goes to the first processing node, the second to the second processing node, and so on.

E.g. If you have 3 nodes and 8 records, then the first record will go to the first node, the second record will go to the second node, the third record will go to the third node, the fourth record will go to the first node and fifth record will go to the second node, and so on…

But how does read operation work?