Class KafkaInputKeyComparator

java.lang.Object
com.linkedin.venice.hadoop.input.kafka.KafkaInputKeyComparator
All Implemented Interfaces:
Serializable, Comparator<org.apache.hadoop.io.BytesWritable>, org.apache.hadoop.io.RawComparator<org.apache.hadoop.io.BytesWritable>
Direct Known Subclasses:
KafkaInputValueGroupingComparator

public class KafkaInputKeyComparator extends Object implements org.apache.hadoop.io.RawComparator<org.apache.hadoop.io.BytesWritable>, Serializable
This class is used to support secondary sorting for KafkaInput Repush. The key is composed by the raw key + offset, and this class will compare key part first to make it in ascending order and then compare the offset part when keys are equal to maintain an offset-descending order for the same key.
See Also:
  • Constructor Details

    • KafkaInputKeyComparator

      public KafkaInputKeyComparator()
  • Method Details

    • compare

      public int compare(byte[] b1, int s1, int l1, byte[] b2, int s2, int l2)
      Specified by:
      compare in interface org.apache.hadoop.io.RawComparator<org.apache.hadoop.io.BytesWritable>
    • compare

      public int compare(org.apache.hadoop.io.BytesWritable o1, org.apache.hadoop.io.BytesWritable o2)
      Specified by:
      compare in interface Comparator<org.apache.hadoop.io.BytesWritable>
    • compare

      protected int compare(KafkaInputMapperKey k1, KafkaInputMapperKey k2)