@Override
public Tuple2<IntByteArray, byte[]> call(Pair<K, V> p) throws Exception {
int partition = getPartitioner().getPartition(p.first(), p.second(), numPartitions);
return new Tuple2<IntByteArray, byte[]>(
new IntByteArray(partition, keySerde.toBytes(p.first())),
valueSerde.toBytes(p.second()));
}