Source:
static int compare(Row row, String aggregationName, Number value, Map<String, AggregatorFactory> aggregators) { Object metricValueObj = row.getRaw(aggregationName); if (metricValueObj != null) { if (aggregators != null && aggregators.containsKey(aggregationName)) { metricValueObj = aggregators.get(aggregationName).finalizeComputation(metricValueObj); } if (metricValueObj instanceof Long || metricValueObj instanceof Integer) { long n = ((Number) metricValueObj).longValue(); if (value instanceof Long || value instanceof Integer) { return Longs.compare(n, value.longValue()); } else if (value instanceof Double || value instanceof Float) { return BigDecimal.valueOf(n).compareTo(BigDecimal.valueOf(value.doubleValue())); } else { throw new ISE("Number was[%s]?!?", value.getClass().getName()); } } else if (metricValueObj instanceof Float) { float n = (Float) metricValueObj; return Floats.compare(n, value.floatValue()); } else if (metricValueObj instanceof Double) { double n = (Double) metricValueObj; return Doubles.compare(n, value.doubleValue()); } else if (metricValueObj instanceof String) { String metricValueStr = (String) metricValueObj; if (LONG_PAT.matcher(metricValueStr).matches()) { long l = Long.parseLong(metricValueStr); return Long.compare(l, value.longValue()); } else { double d = Double.parseDouble(metricValueStr); return Double.compare(d, value.doubleValue()); } } else { throw new ISE("Unknown type of metric value: %s", metricValueObj); } } else { return Double.compare(0, value.doubleValue()); } }

Target:
static int compare(Row row, String aggregationName, Number value, Map<String, AggregatorFactory> aggregators) { Object metricValueObj = row.getRaw(aggregationName); if (metricValueObj != null) { if (aggregators != null && aggregators.containsKey(aggregationName)) { metricValueObj = aggregators.get(aggregationName).finalizeComputation(metricValueObj); } if (metricValueObj instanceof Long || metricValueObj instanceof Integer) { long n = ((Number) metricValueObj).longValue(); if (value instanceof Long || value instanceof Integer) { return Longs.compare(n, value.longValue()); } else if (value instanceof Double || value instanceof Float) { return -compareDoubleToLong(value.doubleValue(), n); } else { throw new ISE("Number was[%s]?!?", value.getClass().getName()); } } else if (metricValueObj instanceof Double || metricValueObj instanceof Float) { double n = ((Number) metricValueObj).doubleValue(); if (value instanceof Long || value instanceof Integer) { return compareDoubleToLong(n, value.longValue()); } else if (value instanceof Double || value instanceof Float) { return Doubles.compare(n, value.doubleValue()); } else { throw new ISE("Number was[%s]?!?", value.getClass().getName()); } } else if (metricValueObj instanceof String) { String metricValueStr = (String) metricValueObj; if (LONG_PAT.matcher(metricValueStr).matches()) { long l = Long.parseLong(metricValueStr); return Long.compare(l, value.longValue()); } else { double d = Double.parseDouble(metricValueStr); return Double.compare(d, value.doubleValue()); } } else { throw new ISE("Unknown type of metric value: %s", metricValueObj); } } else { return Double.compare(0, value.doubleValue()); } }