Class AvroCollectionElementComparator
- java.lang.Object
-
- com.linkedin.davinci.schema.merge.AvroCollectionElementComparator
-
@ThreadSafe public class AvroCollectionElementComparator extends java.lang.ObjectThis comparator is used to compare GenericRecord collection field elements which must have schemas. This comparison is required in order to determine orders of 2 collection elements when their timestamps are the same.
-
-
Field Summary
Fields Modifier and Type Field Description static AvroCollectionElementComparatorINSTANCE
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intcompare(java.lang.Object o1, java.lang.Object o2, org.apache.avro.Schema schema)This function compares two objects using the provided schema.
-
-
-
Field Detail
-
INSTANCE
public static final AvroCollectionElementComparator INSTANCE
-
-
Method Detail
-
compare
public int compare(java.lang.Object o1, java.lang.Object o2, org.apache.avro.Schema schema)This function compares two objects using the provided schema.- Parameters:
o1- first object to compareo2- second object to compareschema- Schema of o1 and o2. Used to determine their type for the comparison- Returns:
- a negative integer if o1 is less than o2, zero if o1 is equal to o2, or a positive integer if o1 is greater than o2. When o1 and o2 are IndexedHashMaps: returns a negative integer if o1.size() < o2.size(), a positive integer if o1.size() > o2.size, or a result of entry-by-entry comparison which is done using positional indexes.
- Throws:
java.lang.IllegalArgumentException- if o1 and o2 have different schemas
-
-