incubator-hcatalog-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ga...@apache.org
Subject svn commit: r1434407 - in /incubator/hcatalog/branches/branch-0.5: CHANGES.txt webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatDelegator.java
Date Wed, 16 Jan 2013 21:16:45 GMT
Author: gates
Date: Wed Jan 16 21:16:45 2013
New Revision: 1434407

URL: http://svn.apache.org/viewvc?rev=1434407&view=rev
Log:
HCATALOG-592 webhcat - handle change in hive table/partition not found error

Modified:
    incubator/hcatalog/branches/branch-0.5/CHANGES.txt
    incubator/hcatalog/branches/branch-0.5/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatDelegator.java

Modified: incubator/hcatalog/branches/branch-0.5/CHANGES.txt
URL: http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.5/CHANGES.txt?rev=1434407&r1=1434406&r2=1434407&view=diff
==============================================================================
--- incubator/hcatalog/branches/branch-0.5/CHANGES.txt (original)
+++ incubator/hcatalog/branches/branch-0.5/CHANGES.txt Wed Jan 16 21:16:45 2013
@@ -160,6 +160,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-554 Loading data using HCatLoader() from a table on non default namenode fails. (amalakar
via avandana)
 
   HCAT-586 checkstyle fails every time complaining that it's own header file does not have
the proper header (gates)

Modified: incubator/hcatalog/branches/branch-0.5/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatDelegator.java
URL: http://svn.apache.org/viewvc/incubator/hcatalog/branches/branch-0.5/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatDelegator.java?rev=1434407&r1=1434406&r2=1434407&view=diff
==============================================================================
--- incubator/hcatalog/branches/branch-0.5/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatDelegator.java
(original)
+++ incubator/hcatalog/branches/branch-0.5/webhcat/svr/src/main/java/org/apache/hcatalog/templeton/HcatDelegator.java
Wed Jan 16 21:16:45 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,



Mime
View raw message