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 Summary
Constructors -
Method Summary
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface java.util.Comparator
equals, reversed, thenComparing, thenComparing, thenComparing, thenComparingDouble, thenComparingInt, thenComparingLong
-
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:
comparein interfaceorg.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:
comparein interfaceComparator<org.apache.hadoop.io.BytesWritable>
-
compare
-