commit e6354bd84bead42fcea66b7b577ab142ef18ef1f Author: Andrew Sherman Date: Thu Jun 28 16:48:10 2018 -0700 HIVE-18929 remove the unused method humanReadableInt() in HiveStringUtils.java which has a race condition. diff --git common/src/java/org/apache/hive/common/util/HiveStringUtils.java common/src/java/org/apache/hive/common/util/HiveStringUtils.java index cfe9b2208a60586a05d293f222aa90b37e9a06ac..91742d0e37820f7e057484382345bada011b5f2e 100644 --- common/src/java/org/apache/hive/common/util/HiveStringUtils.java +++ common/src/java/org/apache/hive/common/util/HiveStringUtils.java @@ -168,35 +168,6 @@ public static String simpleHostname(String fullHostname) { return fullHostname; } - private static DecimalFormat oneDecimal = new DecimalFormat("0.0"); - - /** - * Given an integer, return a string that is in an approximate, but human - * readable format. - * It uses the bases 'k', 'm', and 'g' for 1024, 1024**2, and 1024**3. - * @param number the number to format - * @return a human readable form of the integer - */ - public static String humanReadableInt(long number) { - long absNumber = Math.abs(number); - double result = number; - String suffix = ""; - if (absNumber < 1024) { - // since no division has occurred, don't format with a decimal point - return String.valueOf(number); - } else if (absNumber < 1024 * 1024) { - result = number / 1024.0; - suffix = "k"; - } else if (absNumber < 1024 * 1024 * 1024) { - result = number / (1024.0 * 1024); - suffix = "m"; - } else { - result = number / (1024.0 * 1024 * 1024); - suffix = "g"; - } - return oneDecimal.format(result) + suffix; - } - /** * Format a percentage for presentation to the user. * @param done the percentage to format (0.0 to 1.0)