Interface Partitioner<K>

  • Type Parameters:
    K - The type of the key to be partitioned.
    All Superinterfaces:
    Function, Serializable
    All Known Implementing Classes:
    IdPartitioner
    Functional Interface:
    This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

    @Public
    @FunctionalInterface
    public interface Partitioner<K>
    extends Serializable, Function
    Function to implement a custom partition assignment for keys.
    • Method Detail

      • partition

        int partition​(K key,
                      int numPartitions)
        Computes the partition for the given key.
        Parameters:
        key - The key.
        numPartitions - The number of partitions to partition into.
        Returns:
        The partition index.