@Override
  public int compare(Object obj1, Object obj2) {
    int result;
    if (obj1 == null && obj2 == null) {
      return 0;
    }
    assert !(obj1 instanceof VMCachedDeserializable || obj2 instanceof VMCachedDeserializable);
    if ((objType.isStructType() && obj1 instanceof Object[] && obj2 instanceof Object[])
        || !objType.isStructType()) {
      if (((result = evaluateSortCriteria(obj1, obj2)) != 0) && (orderByAttrs != null)) {
        return result;
      }
      if (QueryObserverHolder.getInstance() != null) {
        QueryObserverHolder.getInstance().orderByColumnsEqual();
      }
      // Comparable fields are equal - check if overall keys are equal
      if (objType.isStructType()) {
        int i = 0;
        for (Object o1 : (Object[]) obj1) {
          Object o2 = ((Object[]) obj2)[i++];
          result = compareHelperMethod(o1, o2);
          if (result != 0) {
            return result;
          }
        }
        return 0;
      } else {
        return compareTwoStrings(obj1, obj2);
      }
    }
    throw new ClassCastException(); // throw exception if args can't be compared w/this comparator
  }
Compares its two arguments for order. Returns a negative integer, zero, or a positive integer
as the first argument is less than, equal to, or greater than the second.

@param obj1 the first object to be compared.
@param obj2 the second object to be compared.
@return a negative integer, zero, or a positive integer as the first argument is less than,
        equal to, or greater than the second.
@throws ClassCastException if the arguments' types prevent them from being compared by this
        Comparator.
geode-core/src/main/java/org/apache/geode/cache/query/internal/OrderByComparator.java