HIVE-16120 : Use jvm temporary tmp dir by default (Slim Bouguerra via Ashutosh 
Chauhan)

Signed-off-by: Ashutosh Chauhan <[email protected]>


Project: http://git-wip-us.apache.org/repos/asf/hive/repo
Commit: http://git-wip-us.apache.org/repos/asf/hive/commit/7f05f0cf
Tree: http://git-wip-us.apache.org/repos/asf/hive/tree/7f05f0cf
Diff: http://git-wip-us.apache.org/repos/asf/hive/diff/7f05f0cf

Branch: refs/heads/hive-14535
Commit: 7f05f0cfbbe56ed9f06ece5b040cc00940a4cad2
Parents: 06b2412
Author: Slim Bouguerra <[email protected]>
Authored: Wed Mar 15 11:13:26 2017 -0700
Committer: Ashutosh Chauhan <[email protected]>
Committed: Wed Mar 15 11:13:26 2017 -0700

----------------------------------------------------------------------
 common/src/java/org/apache/hadoop/hive/conf/HiveConf.java      | 4 ++--
 .../org/apache/hadoop/hive/druid/io/DruidOutputFormat.java     | 6 +++++-
 2 files changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/hive/blob/7f05f0cf/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 99e3294..62908f9 100644
--- a/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
+++ b/common/src/java/org/apache/hadoop/hive/conf/HiveConf.java
@@ -1967,8 +1967,8 @@ public class HiveConf extends Configuration {
     HIVE_DRUID_SLEEP_TIME("hive.druid.sleep.time", "PT10S",
             "Sleep time between retries in ISO8601 format (for example P2W, 
P3M, PT1H30M, PT0.750S), default is period of 10 seconds."
     ),
-    HIVE_DRUID_BASE_PERSIST_DIRECTORY("hive.druid.basePersistDirectory", 
"/tmp",
-            "Local temporary directory used to persist intermediate indexing 
state."
+    HIVE_DRUID_BASE_PERSIST_DIRECTORY("hive.druid.basePersistDirectory", "",
+            "Local temporary directory used to persist intermediate indexing 
state, will default to JVM system property java.io.tmpdir."
     ),
     DRUID_SEGMENT_DIRECTORY("hive.druid.storage.storageDirectory", 
"/druid/segments"
             , "druid deep storage location."),

http://git-wip-us.apache.org/repos/asf/hive/blob/7f05f0cf/druid-handler/src/java/org/apache/hadoop/hive/druid/io/DruidOutputFormat.java
----------------------------------------------------------------------
diff --git 
a/druid-handler/src/java/org/apache/hadoop/hive/druid/io/DruidOutputFormat.java 
b/druid-handler/src/java/org/apache/hadoop/hive/druid/io/DruidOutputFormat.java
index c74bce6..40a2022 100644
--- 
a/druid-handler/src/java/org/apache/hadoop/hive/druid/io/DruidOutputFormat.java
+++ 
b/druid-handler/src/java/org/apache/hadoop/hive/druid/io/DruidOutputFormat.java
@@ -18,6 +18,7 @@
 package org.apache.hadoop.hive.druid.io;
 
 import com.google.common.base.Preconditions;
+import com.google.common.base.Strings;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.Lists;
 import com.metamx.common.Granularity;
@@ -194,12 +195,15 @@ public class DruidOutputFormat<K, V> implements 
HiveOutputFormat<K, DruidWritabl
             .getIntVar(jc, HiveConf.ConfVars.HIVE_DRUID_MAX_PARTITION_SIZE);
     String basePersistDirectory = HiveConf
             .getVar(jc, HiveConf.ConfVars.HIVE_DRUID_BASE_PERSIST_DIRECTORY);
+    if (Strings.isNullOrEmpty(basePersistDirectory)) {
+      basePersistDirectory = System.getProperty("java.io.tmpdir");
+    }
     Integer maxRowInMemory = HiveConf.getIntVar(jc, 
HiveConf.ConfVars.HIVE_DRUID_MAX_ROW_IN_MEMORY);
 
     RealtimeTuningConfig realtimeTuningConfig = new 
RealtimeTuningConfig(maxRowInMemory,
             null,
             null,
-            new File(basePersistDirectory),
+            new File(basePersistDirectory, dataSource),
             new CustomVersioningPolicy(version),
             null,
             null,

Reply via email to