You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by ai...@apache.org on 2018/07/26 23:47:49 UTC
hive git commit: HIVE-18929: The method humanReadableInt in
HiveStringUtils.java has a race condition. (Andrew Sherman,
reviewed by Aihua Xu)
Repository: hive
Updated Branches:
refs/heads/master 5a3f12dd7 -> 1ad48825c
HIVE-18929: The method humanReadableInt in HiveStringUtils.java has a race condition. (Andrew Sherman, reviewed by Aihua Xu)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/1ad48825
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/1ad48825
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/1ad48825
Branch: refs/heads/master
Commit: 1ad48825c01ca326a9b7387d3e044a3a8b2ad81b
Parents: 5a3f12d
Author: Aihua Xu <ai...@apache.org>
Authored: Thu Jul 26 16:46:35 2018 -0700
Committer: Aihua Xu <ai...@apache.org>
Committed: Thu Jul 26 16:46:35 2018 -0700
----------------------------------------------------------------------
.../hive/common/util/HiveStringUtils.java | 29 --------------------
1 file changed, 29 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/1ad48825/common/src/java/org/apache/hive/common/util/HiveStringUtils.java
----------------------------------------------------------------------
diff --git a/common/src/java/org/apache/hive/common/util/HiveStringUtils.java b/common/src/java/org/apache/hive/common/util/HiveStringUtils.java
index 6b14ad9..a4923f9 100644
--- a/common/src/java/org/apache/hive/common/util/HiveStringUtils.java
+++ b/common/src/java/org/apache/hive/common/util/HiveStringUtils.java
@@ -164,35 +164,6 @@ public class HiveStringUtils {
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)