You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by se...@apache.org on 2014/03/19 17:52:13 UTC

svn commit: r1579296 - in /hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/exec/tez: DagUtils.java TezSessionState.java

Author: sershe
Date: Wed Mar 19 16:52:13 2014
New Revision: 1579296

URL: http://svn.apache.org/r1579296
Log:
HIVE-6690 : NPE in tez session state (Sergey Shelukhin, reviewed by Gunther Hagleitner)

Modified:
    hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java
    hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java

Modified: hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java?rev=1579296&r1=1579295&r2=1579296&view=diff
==============================================================================
--- hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java (original)
+++ hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/DagUtils.java Wed Mar 19 16:52:13 2014
@@ -599,6 +599,24 @@ public class DagUtils {
 
     // we need the directory on hdfs to which we shall put all these files
     // Use HIVE_JAR_DIRECTORY only if it's set explicitly; otherwise use default directory
+    String hdfsDirPathStr = getHiveJarDirectory(conf);
+
+    String allFiles = auxJars + "," + addedJars + "," + addedFiles + "," + addedArchives;
+    String[] allFilesArr = allFiles.split(",");
+    for (String file : allFilesArr) {
+      if (!StringUtils.isNotBlank(file)) {
+        continue;
+      }
+      String hdfsFilePathStr = hdfsDirPathStr + "/" + getResourceBaseName(file);
+      LocalResource localResource = localizeResource(new Path(file),
+          new Path(hdfsFilePathStr), conf);
+      tmpResources.add(localResource);
+    }
+
+    return tmpResources;
+  }
+
+  public String getHiveJarDirectory(Configuration conf) throws IOException, LoginException {
     FileStatus fstatus = null;
     String hdfsDirPathStr = HiveConf.getVar(conf, HiveConf.ConfVars.HIVE_JAR_DIRECTORY, null);
     if (hdfsDirPathStr != null) {
@@ -618,20 +636,7 @@ public class DagUtils {
       Path destDir = getDefaultDestDir(conf);
       hdfsDirPathStr = destDir.toString();
     }
-
-    String allFiles = auxJars + "," + addedJars + "," + addedFiles + "," + addedArchives;
-    String[] allFilesArr = allFiles.split(",");
-    for (String file : allFilesArr) {
-      if (!StringUtils.isNotBlank(file)) {
-        continue;
-      }
-      String hdfsFilePathStr = hdfsDirPathStr + "/" + getResourceBaseName(file);
-      LocalResource localResource = localizeResource(new Path(file),
-          new Path(hdfsFilePathStr), conf);
-      tmpResources.add(localResource);
-    }
-
-    return tmpResources;
+    return hdfsDirPathStr;
   }
 
   // the api that finds the jar being used by this class on disk

Modified: hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java
URL: http://svn.apache.org/viewvc/hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java?rev=1579296&r1=1579295&r2=1579296&view=diff
==============================================================================
--- hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java (original)
+++ hive/branches/branch-0.13/ql/src/java/org/apache/hadoop/hive/ql/exec/tez/TezSessionState.java Wed Mar 19 16:52:13 2014
@@ -247,7 +247,7 @@ public class TezSessionState {
    */
   private LocalResource createHiveExecLocalResource()
     throws IOException, LoginException, URISyntaxException {
-    String hiveJarDir = conf.getVar(HiveConf.ConfVars.HIVE_JAR_DIRECTORY);
+    String hiveJarDir = utils.getHiveJarDirectory(conf);
     String currentVersionPathStr = utils.getExecJarPathLocal();
     String currentJarName = utils.getResourceBaseName(currentVersionPathStr);
     FileSystem fs = null;