Class SimplePartitioner

java.lang.Object
com.linkedin.venice.partitioner.VenicePartitioner
com.linkedin.venice.unit.kafka.SimplePartitioner

public class SimplePartitioner extends VenicePartitioner
This VenicePartitioner implementation takes the first byte of the key, and computes the partition as such: firstByte % numPartitions It is meant to be used in tests where we want to control the partition that a key belongs to, but without needing to work out a proper input that yields the desired partition when hashed by the DefaultVenicePartitioner.
  • Constructor Details

    • SimplePartitioner

      public SimplePartitioner()
    • SimplePartitioner

      public SimplePartitioner(VeniceProperties props)
    • SimplePartitioner

      public SimplePartitioner(VeniceProperties props, org.apache.avro.Schema schema)
  • Method Details

    • getPartitionId

      public int getPartitionId(byte[] keyBytes, int numPartitions)
      Description copied from class: VenicePartitioner
      A function that returns the partitionId based on the key and partition count.
      Specified by:
      getPartitionId in class VenicePartitioner
      Parameters:
      keyBytes - - A key that will be mapped into a partition
      numPartitions - - The number of total partitions available in Kafka/storage
      Returns:
    • getPartitionId

      public int getPartitionId(ByteBuffer keyByteBuffer, int numPartitions)
      Specified by:
      getPartitionId in class VenicePartitioner