FAQ
Author: jssarma
Date: Fri Jun 12 17:07:15 2009
New Revision: 784198

URL: http://svn.apache.org/viewvc?rev=784198&view=rev
Log:
HIVE-557. Better exception handling. (Zheng Shao via jssarma)

Modified:
hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ExecMapper.java
hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ExecReducer.java
hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ExecMapper.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ExecMapper.java?rev=784198&r1=784197&r2=784198&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ExecMapper.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ExecMapper.java Fri Jun 12 17:07:15 2009
@@ -124,7 +124,7 @@
}

rp = reporter;
- } catch (HiveException e) {
+ } catch (Exception e) {
abort = true;
e.printStackTrace();
throw new RuntimeException ("Map operator initialization failed", e);
@@ -137,10 +137,10 @@
else
// Since there is no concept of a group, we don't invoke startGroup/endGroup for a mapper
mo.process((Writable)value);
- } catch (HiveException e) {
+ } catch (Exception e) {
abort = true;
e.printStackTrace();
- throw new RuntimeException (e.getMessage(), e);
+ throw new RuntimeException ("Map operator process failed", e);
}
}

@@ -151,7 +151,7 @@
l4j.trace("Close called no row");
mo.initialize(jc, null, null);
rp = null;
- } catch (HiveException e) {
+ } catch (Exception e) {
abort = true;
e.printStackTrace();
throw new RuntimeException ("Map operator close failed during initialize", e);
@@ -177,11 +177,11 @@
reportStats rps = new reportStats (rp);
mo.preorderMap(rps);
return;
- } catch (HiveException e) {
+ } catch (Exception e) {
if(!abort) {
// signal new failure to map-reduce
l4j.error("Hit error while closing operators - failing tree");
- throw new RuntimeException ("Error while closing operators");
+ throw new RuntimeException ("Error while closing operators", e);
}
}
}

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ExecReducer.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ExecReducer.java?rev=784198&r1=784197&r2=784198&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ExecReducer.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/ExecReducer.java Fri Jun 12 17:07:15 2009
@@ -93,7 +93,7 @@
rowObjectInspector[tag] = ObjectInspectorFactory.getStandardStructObjectInspector(
Arrays.asList(fieldNames), ois);
}
- } catch (SerDeException e) {
+ } catch (Exception e) {
throw new RuntimeException(e);
}
}
@@ -118,10 +118,10 @@
reducer.setOutputCollector(oc);
reducer.initialize(jc, reporter, rowObjectInspector);
rp = reporter;
- } catch (HiveException e) {
+ } catch (Exception e) {
abort = true;
e.printStackTrace();
- throw new RuntimeException ("Reduce operator initialization failed");
+ throw new RuntimeException ("Reduce operator process failed", e);
}
}

@@ -150,7 +150,7 @@
}
try {
keyObject = inputKeyDeserializer.deserialize(keyWritable);
- } catch (SerDeException e) {
+ } catch (Exception e) {
throw new HiveException(e);
}
// System.err.print(keyObject.toString());
@@ -175,7 +175,7 @@
reducer.process(row, rowObjectInspector[tag.get()], tag.get());
}

- } catch (HiveException e) {
+ } catch (Exception e) {
abort = true;
throw new IOException (e);
}
@@ -198,7 +198,7 @@
l4j.trace("Close called no row");
reducer.initialize(jc, null, rowObjectInspector);
rp = null;
- } catch (HiveException e) {
+ } catch (Exception e) {
abort = true;
e.printStackTrace();
throw new RuntimeException ("Reduce operator close failed during initialize", e);
@@ -216,7 +216,7 @@
reportStats rps = new reportStats (rp);
reducer.preorderMap(rps);
return;
- } catch (HiveException e) {
+ } catch (Exception e) {
if(!abort) {
// signal new failure to map-reduce
l4j.error("Hit error while closing operators - failing tree");

Modified: hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java
URL: http://svn.apache.org/viewvc/hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java?rev=784198&r1=784197&r2=784198&view=diff
==============================================================================
--- hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java (original)
+++ hadoop/hive/trunk/ql/src/java/org/apache/hadoop/hive/ql/exec/FileSinkOperator.java Fri Jun 12 17:07:15 2009
@@ -79,17 +79,18 @@
return;

state = state.CLOSE;
- if(!abort) {
+ if (!abort) {
if (outWriter != null) {
try {
outWriter.close(abort);
commit();
} catch (IOException e) {
- // Don't throw an exception, just ignore and return
- return;
+ throw new HiveException(e);
}
}
} else {
+ // Will come here if an Exception was thrown in map() or reduce().
+ // Hadoop always call close() even if an Exception was thrown in map() or reduce().
try {
outWriter.close(abort);
if(!autoDelete)

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 1 | next ›
Discussion Overview
groupcommits @
categorieshive, hadoop
postedJun 12, '09 at 5:07p
activeJun 12, '09 at 5:07p
posts1
users1
websitehive.apache.org

1 user in discussion

Jssarma: 1 post

People

Translate

site design / logo © 2021 Grokbase