Sort the input table, partition-by-partition.
Sort the input table, partition-by-partition. A partition is a set of contiguous rows inside the input table. The end of a partition (i.e. the last row of a partition) is marked by a change of value inside the “partitioning variable” (i.e. The partitioning variable is constant inside one partition).
The algorithm is the following:
1.Anatella loads into an in-memory RAM buffer a whole partition.
2.Anatella sorts the in-memory RAM buffer.
3.Anatella outputs each row of the (sorted) buffer.
4.Anatella clears the buffer and, if there are some more input rows (i.e. some more partitions), it goes back to step 1.
The size of the in-memory RAM buffer automatically increases to be able to store a whole partition. The size increment is given here:
The memory consumption of the Partitioned Sort Action is equal to the amount of RAM memory required to store the largest partition.
In the general case, the output table does not contain any sort-meta-data (to indicate that the output table is, in the general case, not sorted), unless we are in the following “special” case: If the most significant sort-variable of the input table is equal to the partitioning-variable, then the sort-meta-data of the output table is set to the following:
•The most significant sort-variable of the output table is equal to the partitioning-variable.
•The other less-significant sort-variables are set accordingly to the sorting parameters of the Partitioned Sort Action.
The Partitioned Sort Action can run inside a N-Way Multithread Section only if the partitioning variable of the N-Way Multithread Section is equal to the partitioning variable of the Partitioned Sort Action. When executing a Partitioned Sort Action using N CPUs, the RAM memory consumption is multiplied by N.