Author: gates
Date: Wed Jan 16 20:42:37 2013
New Revision: 1434375
URL: http://svn.apache.org/viewvc?rev=1434375&view=rev
Log:
HCATALOG-592 webhcat - handle change in hive table/partition not found error
Modified:
incubator/hcatalog/trunk/CHANGES.txt
incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatDelegator.java
Modified: incubator/hcatalog/trunk/CHANGES.txt
URL:
http://svn.apache.org/viewvc/incubator/hcatalog/trunk/CHANGES.txt?rev=1434375&r1=1434374&r2=1434375&view=diff
==============================================================================
--- incubator/hcatalog/trunk/CHANGES.txt (original)
+++ incubator/hcatalog/trunk/CHANGES.txt Wed Jan 16 20:42:37 2013
@@ -174,6 +174,8 @@ Release 0.5.0 - Unreleased
OPTIMIZATIONS
BUG FIXES
+ HCAT-592 webhcat - handle change in hive table/partition not found error
(thejas via gates)
+
HCAT-586 checkstyle fails every time complaining that it's own header file
does not have the proper header (gates)
HCAT-580 Optimizations in HCAT-538 break e2e tests (daijy via gates)
Modified:
incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatDelegator.java
URL:
http://svn.apache.org/viewvc/incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatDelegator.java?rev=1434375&r1=1434374&r2=1434375&view=diff
==============================================================================
---
incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatDelegator.java
(original)
+++
incubator/hcatalog/trunk/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatDelegator.java
Wed Jan 16 20:42:37 2013
@@ -25,7 +25,7 @@ import java.util.HashMap;
import java.util.List;
import java.util.Map;
import javax.ws.rs.core.Response;
-
+
import org.apache.commons.exec.ExecuteException;
import org.apache.commons.lang.StringUtils;
import org.apache.commons.logging.Log;
@@ -113,7 +113,7 @@ public class HcatDelegator extends Launc
String res = jsonRun(user, exec);
return JsonBuilder.create(res).build();
} catch (HcatException e) {
- if (e.execBean.stderr.indexOf("Error in semantic analysis") > -1) {
+ if (e.execBean.stderr.contains("SemanticException")) {
return JsonBuilder.create().
put("error", "Database " + db + " does not exist")
.put("errorCode", "404")
@@ -256,7 +256,15 @@ public class HcatDelegator extends Launc
.put("table", table)
.build();
} catch (HcatException e) {
- throw new HcatException("unable to describe table: " + table,
+ if (e.execBean.stderr.contains("SemanticException") &&
+ e.execBean.stderr.contains("Table not found")) {
+ return JsonBuilder.create().
+ put("error", "Table" + db + "." + table + " does not
exist" )
+ .put("errorCode", "404")
+ .put("table", table)
+ .put("database", db).build();
+ }
+ throw new HcatException("unable to describe database: " + db,
e.execBean, exec);
}
}
@@ -631,6 +639,19 @@ public class HcatDelegator extends Launc
.put("partition", partition)
.build();
} catch (HcatException e) {
+ if (e.execBean.stderr.contains("SemanticException") &&
+ e.execBean.stderr.contains("Partition not found")) {
+ String emsg = "Partition " + partition + " for table "
+ + table + " does not exist" + db + "." + table + " does
not exist";
+ return JsonBuilder.create()
+ .put("error", emsg)
+ .put("errorCode", "404")
+ .put("database", db)
+ .put("table", table)
+ .put("partition", partition)
+ .build();
+ }
+
throw new HcatException("unable to show partition: "
+ table + " " + partition,
e.execBean,