@Override
  public int compare(Object obj1, Object obj2) {
    if (obj1.getClass() != obj2.getClass() && (obj1 instanceof Number && obj2 instanceof Number)) {
      return super.compare(obj1, obj2);
    } else if (obj2 instanceof Undefined && !(obj1 instanceof Undefined)) {
      // Everything should be greater than Undefined
      return 1;
    } else if (obj2 instanceof NullToken && !(obj1 instanceof Undefined)
        && !(obj1 instanceof NullToken)) {
      // Everything should be greater than Null except for Undefined
      return 1;
    }

    return ((Comparable) obj1).compareTo(obj2);
  }
A general comparator that will let us compare different numeric types for equality
geode-core/src/main/java/org/apache/geode/cache/query/internal/types/ExtendedNumericComparator.java