Class AvroCollectionElementComparator
java.lang.Object
com.linkedin.davinci.schema.merge.AvroCollectionElementComparator
This 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
-
Method Summary
-
Field Details
-
INSTANCE
-
-
Method Details
-
compare
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:
IllegalArgumentException
- if o1 and o2 have different schemas
-