You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@hive.apache.org by na...@apache.org on 2010/03/26 06:10:26 UTC

svn commit: r927694 - in /hadoop/hive/trunk: CHANGES.txt ql/src/java/org/apache/hadoop/hive/ql/exec/MapRedTask.java ql/src/java/org/apache/hadoop/hive/ql/exec/TaskExecutionException.java ql/src/java/org/apache/hadoop/hive/ql/exec/package-info.java

Author: namit
Date: Fri Mar 26 05:10:26 2010
New Revision: 927694

URL: http://svn.apache.org/viewvc?rev=927694&view=rev
Log:
HIVE-1277 Failure if the local file system directory for ${hive.user.scratchdir}
does not exist (Arvind Prabhakar via namit)


Added:
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/TaskExecutionException.java
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/package-info.java
Modified:
    hadoop/hive/trunk/CHANGES.txt
    hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/MapRedTask.java

Modified: hadoop/hive/trunk/CHANGES.txt
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/CHANGES.txt?rev=927694&r1=927693&r2=927694&view=diff
==============================================================================
--- hadoop/hive/trunk/CHANGES.txt (original)
+++ hadoop/hive/trunk/CHANGES.txt Fri Mar 26 05:10:26 2010
@@ -318,6 +318,9 @@ Trunk -  Unreleased
     HIVE-1275 Fix TestHBaseCliDriver
     (John Sichi via namit)
 
+    HIVE-1277 Failure if the local file system directory for ${hive.user.scratchdir}
+    does not exist (Arvind Prabhakar via namit)
+
 Release 0.5.0 -  Unreleased
 
   INCOMPATIBLE CHANGES

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/MapRedTask.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/MapRedTask.java?rev=927694&r1=927693&r2=927694&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/MapRedTask.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/MapRedTask.java Fri Mar 26 05:10:26 2010
@@ -82,6 +82,26 @@ public class MapRedTask extends Task<Map
       String hiveConfArgs = ExecDriver.generateCmdLine(conf);
       File scratchDir = new File(conf.getVar(HiveConf.ConfVars.SCRATCHDIR));
 
+      // Check if the scratch directory exists. If not, create it.
+      if (!scratchDir.exists()) {
+        LOG.info("Local scratch directory " + scratchDir.getPath()
+                                + " not found. Attempting to create.");
+        if (!scratchDir.mkdirs()) {
+          // Unable to create this directory - it might have been created due
+          // to another process.
+          if (!scratchDir.exists()) {
+            throw new TaskExecutionException(
+                "Cannot create scratch directory "
+                + "\"" +  scratchDir.getPath() + "\". "
+                + "To configure a different directory, "
+                + "set the configuration "
+                + "\"hive.exec.scratchdir\" "
+                + "in the session, or permanently by modifying the "
+                + "appropriate hive configuration file such as hive-site.xml.");
+          }
+        }
+      }
+
       MapredWork plan = getWork();
 
       File planFile = File.createTempFile("plan", ".xml", scratchDir);

Added: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/TaskExecutionException.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/TaskExecutionException.java?rev=927694&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/TaskExecutionException.java (added)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/TaskExecutionException.java Fri Mar 26 05:10:26 2010
@@ -0,0 +1,40 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.hadoop.hive.ql.exec;
+
+/**
+ * Exception thrown by any task processor to signal a problem with task
+ * execution.
+ */
+public class TaskExecutionException extends RuntimeException {
+
+  private static final long serialVersionUID = 1L;
+
+  public TaskExecutionException(String msg) {
+    super(msg);
+  }
+
+  public TaskExecutionException(String msg, Throwable cause) {
+    super(msg, cause);
+  }
+
+  public TaskExecutionException(Throwable cause) {
+    super(cause);
+  }
+
+}

Added: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/package-info.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/package-info.java?rev=927694&view=auto
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/package-info.java (added)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/package-info.java Fri Mar 26 05:10:26 2010
@@ -0,0 +1,22 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+/**
+ * Hive QL execution tasks, operators, functions and other handlers.
+ */
+package org.apache.hadoop.hive.ql.exec;