You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by pv...@apache.org on 2017/08/15 15:54:52 UTC
hive git commit: HIVE-17311: Numeric overflow in the HiveConf (Oleg
Danilov via Peter Vary)
Repository: hive
Updated Branches:
refs/heads/master 06d9a6bf1 -> 7ce966a06
HIVE-17311: Numeric overflow in the HiveConf (Oleg Danilov via Peter Vary)
Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/7ce966a0
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/7ce966a0
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/7ce966a0
Branch: refs/heads/master
Commit: 7ce966a064b341d4d05023c83159e81c8be29844
Parents: 06d9a6b
Author: Peter Vary <pv...@cloudera.com>
Authored: Tue Aug 15 17:54:01 2017 +0200
Committer: Peter Vary <pv...@cloudera.com>
Committed: Tue Aug 15 17:54:01 2017 +0200
----------------------------------------------------------------------
.../src/java/org/apache/hadoop/hive/conf/HiveConf.java | 6 +++---
.../test/org/apache/hadoop/hive/conf/TestHiveConf.java | 11 +++++++++++
2 files changed, 14 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/hive/blob/7ce966a0/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
----------------------------------------------------------------------
diff --git a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
index 056f2d7..580e725 100644
--- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
+++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
@@ -1690,7 +1690,7 @@ public class HiveConf extends Configuration {
"Whether column accesses are tracked in the QueryPlan.\n" +
"This is useful to identify how tables are accessed and to determine if there are wasted columns that can be trimmed."),
HIVE_STATS_NDV_ALGO("hive.stats.ndv.algo", "hll", new PatternSet("hll", "fm"),
- "hll and fm stand for HyperLogLog and FM-sketch, respectively for computing ndv."),
+ "hll and fm stand for HyperLogLog and FM-sketch, respectively for computing ndv."),
HIVE_STATS_FETCH_BITVECTOR("hive.stats.fetch.bitvector", false,
"Whether we fetch bitvector when we compute ndv. Users can turn it off if they want to use old schema"),
// standard error allowed for ndv estimates for FM-sketch. A lower value indicates higher accuracy and a
@@ -3913,9 +3913,9 @@ public class HiveConf extends Configuration {
} else if (unit.equals("gb")) {
return 1024*1024*1024;
} else if (unit.equals("tb")) {
- return 1024*1024*1024*1024;
+ return 1024L*1024*1024*1024;
} else if (unit.equals("pb")) {
- return 1024*1024*1024*1024*1024;
+ return 1024L*1024*1024*1024*1024;
}
throw new IllegalArgumentException("Invalid size unit " + unit);
}
http://git-wip-us.apache.org/repos/asf/hive/blob/7ce966a0/common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java
----------------------------------------------------------------------
diff --git a/common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java b/common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java
index fa51ef6..c914d23 100644
--- a/common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java
+++ b/common/src/test/org/apache/hadoop/hive/conf/TestHiveConf.java
@@ -117,6 +117,17 @@ public class TestHiveConf {
}
@Test
+ public void testToSizeBytes() throws Exception {
+ Assert.assertEquals(1L, HiveConf.toSizeBytes("1b"));
+ Assert.assertEquals(1L, HiveConf.toSizeBytes("1bytes"));
+ Assert.assertEquals(1024L, HiveConf.toSizeBytes("1kb"));
+ Assert.assertEquals(1048576L, HiveConf.toSizeBytes("1mb"));
+ Assert.assertEquals(1073741824L, HiveConf.toSizeBytes("1gb"));
+ Assert.assertEquals(1099511627776L, HiveConf.toSizeBytes("1tb"));
+ Assert.assertEquals(1125899906842624L, HiveConf.toSizeBytes("1pb"));
+ }
+
+ @Test
public void testHiddenConfig() throws Exception {
HiveConf conf = new HiveConf();
// check password configs are hidden