Class AvroCollectionElementComparator


  • @ThreadSafe
    public class AvroCollectionElementComparator
    extends java.lang.Object
    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.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      int compare​(java.lang.Object o1, java.lang.Object o2, org.apache.avro.Schema schema)
      This function compares two objects using the provided schema.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • 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 compare
        o2 - second object to compare
        schema - 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