Modulus partitioning is also key based partitioning like hash partitioning. But, in modulus partitioning, only one integer column can be defined as key field since modulus operation cannot be performed on non-integer values.
The partition number of each record is calculated as follows:
partition_number = integer_field mod number_of_partitions
In the diagram the age field has been selected as the key field for mod operation. The Input data has the following distinct age values: 22,23,32,34. And there are 3 processing nodes among which the input data has to be partitioned and distributed. So, we divide the age value of each record by 3 and get the remainder as the value. The result of mod operation on the age values are as follows:
Mod(22,3) = 22%3 = 1
Mod(23,3) = 23%3 = 2
Mod(32,3) = 32%3 = 2
Mod(34,3) = 34%3 = 1
The records with mod key result as 1 are sent to partition 1 (node 2 processor). The records with mod key result as 2 are sent to partition 2 (node 3 partition). There are no records with mod key result as 0. Hence, no records are sent to partition 0 (node 1 processor). It’s clearly understood, that like hash partitioning, Modulus partitioning, also, creates uneven partitioning which can cause certain processing nodes to work more than the other nodes available in the system.
On this page of the site you can watch the video online Modulus Partitioning - DataStage with a duration of hours minute second in good quality, which was uploaded by the user Datastage Tutorial 16 December 2018, share the link with friends and acquaintances, this video has already been watched 1,799 times on youtube and it was liked by 18 viewers. Enjoy your viewing!