Class KeyGroupPartitioner<T>

  • Type Parameters:
    T - type of the partitioned elements.

    public class KeyGroupPartitioner<T>
    extends Object
    Class that contains the base algorithm for partitioning data into key-groups. This algorithm currently works with two array (input, output) for optimal algorithmic complexity. Notice that this could also be implemented over a single array, using some cuckoo-hashing-style element replacement. This would have worse algorithmic complexity but better space efficiency. We currently prefer the trade-off in favor of better algorithmic complexity.
    • Constructor Detail

      • KeyGroupPartitioner

        public KeyGroupPartitioner​(@Nonnull
                                   T[] partitioningSource,
                                   @Nonnegative
                                   int numberOfElements,
                                   @Nonnull
                                   T[] partitioningDestination,
                                   @Nonnull
                                   KeyGroupRange keyGroupRange,
                                   @Nonnegative
                                   int totalKeyGroups,
                                   @Nonnull
                                   KeyExtractorFunction<T> keyExtractorFunction,
                                   @Nonnull
                                   KeyGroupPartitioner.ElementWriterFunction<T> elementWriterFunction)
        Creates a new KeyGroupPartitioner.
        Parameters:
        partitioningSource - the input for the partitioning. All elements must be densely packed in the index interval [0, numberOfElements[, without null values.
        numberOfElements - the number of elements to consider from the input, starting at input index 0.
        partitioningDestination - the output of the partitioning. Must have capacity of at least numberOfElements.
        keyGroupRange - the key-group range of the data that will be partitioned by this instance.
        totalKeyGroups - the total number of key groups in the job.
        keyExtractorFunction - this function extracts the partition key from an element.