drill-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jacq...@apache.org
Subject [1/6] drill git commit: DRILL-2675: Implement a subset of User Exceptions to improve how errors are reported to the user
Date Wed, 15 Apr 2015 15:56:02 GMT
Repository: drill
Updated Branches:
  refs/heads/master 859e6a86b -> 314e5a2a8


http://git-wip-us.apache.org/repos/asf/drill/blob/99b6d0e6/exec/java-exec/src/test/java/org/apache/drill/TestDisabledFunctionality.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestDisabledFunctionality.java b/exec/java-exec/src/test/java/org/apache/drill/TestDisabledFunctionality.java
index f62f060..111c3c1 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/TestDisabledFunctionality.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/TestDisabledFunctionality.java
@@ -16,7 +16,7 @@
  * limitations under the License.
  */
 package org.apache.drill;
-import org.apache.drill.exec.rpc.RpcException;
+import org.apache.drill.common.exceptions.DrillUserException;
 import org.apache.drill.exec.work.foreman.SqlUnsupportedException;
 import org.apache.drill.exec.work.foreman.UnsupportedDataTypeException;
 import org.apache.drill.exec.work.foreman.UnsupportedFunctionException;
@@ -26,26 +26,31 @@ import org.junit.Test;
 public class TestDisabledFunctionality extends BaseTestQuery{
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestExampleQueries.class);
 
-  @Test(expected = RpcException.class)  // see DRILL-2054
+  @Test(expected = DrillUserException.class)  // see DRILL-2054
   public void testBooleanORExpression() throws Exception {
         test("select (1 = 1) || (1 > 0) from cp.`tpch/nation.parquet` ");
     }
 
-  @Test(expected = RpcException.class)  // see DRILL-2054
+  @Test(expected = DrillUserException.class)  // see DRILL-2054
   public void testBooleanORSelectClause() throws Exception {
     test("select true || true from cp.`tpch/nation.parquet` ");
   }
 
-  @Test(expected = RpcException.class)  // see DRILL-2054
+  @Test(expected = DrillUserException.class)  // see DRILL-2054
   public void testBooleanORWhereClause() throws Exception {
     test("select * from cp.`tpch/nation.parquet` where (true || true) ");
   }
 
-  @Test(expected = RpcException.class)  // see DRILL-2054
+  @Test(expected = DrillUserException.class)  // see DRILL-2054
   public void testBooleanAND() throws Exception {
     test("select true && true from cp.`tpch/nation.parquet` ");
   }
 
+  private static void throwAsUnsupportedException(DrillUserException ex) throws Exception {
+    SqlUnsupportedException.errorClassNameToException(ex.getOrCreatePBError(false).getException().getExceptionClass());
+    throw ex;
+  }
+
   @Test(expected = UnsupportedFunctionException.class)  // see DRILL-1937
   public void testDisabledExplainplanForComparisonWithNonscalarSubquery() throws Exception {
     try {
@@ -53,9 +58,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
            "where n_nationkey = " +
            "(select r_regionkey from cp.`tpch/region.parquet` " +
            "where r_regionkey = 1)");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -66,9 +70,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
            "where n_nationkey = " +
            "(select r_regionkey from cp.`tpch/region.parquet` " +
            "where r_regionkey = 1)");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -76,9 +79,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
   public void testDisabledUnion() throws Exception {
     try {
       test("(select n_name as name from cp.`tpch/nation.parquet`) UNION (select r_name as name from cp.`tpch/region.parquet`)");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -86,9 +88,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
   public void testDisabledUnionDistinct() throws Exception {
     try {
       test("(select n_name as name from cp.`tpch/nation.parquet`) UNION DISTINCT (select r_name as name from cp.`tpch/region.parquet`)");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -96,9 +97,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
   public void testDisabledIntersect() throws Exception {
     try {
       test("(select n_name as name from cp.`tpch/nation.parquet`) INTERSECT (select r_name as name from cp.`tpch/region.parquet`)");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -106,9 +106,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
   public void testDisabledIntersectALL() throws Exception {
     try {
       test("(select n_name as name from cp.`tpch/nation.parquet`) INTERSECT ALL (select r_name as name from cp.`tpch/region.parquet`)");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -116,9 +115,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
   public void testDisabledExceptALL() throws Exception {
     try {
       test("(select n_name as name from cp.`tpch/nation.parquet`) EXCEPT ALL (select r_name as name from cp.`tpch/region.parquet`)");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -126,9 +124,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
   public void testDisabledExcept() throws Exception {
     try {
       test("(select n_name as name from cp.`tpch/nation.parquet`) EXCEPT (select r_name as name from cp.`tpch/region.parquet`)");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -136,9 +133,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
   public void testDisabledNaturalJoin() throws Exception {
     try {
       test("select * from cp.`tpch/nation.parquet` NATURAL JOIN cp.`tpch/region.parquet`");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -146,9 +142,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
   public void testDisabledCrossJoin() throws Exception {
     try {
       test("select * from cp.`tpch/nation.parquet` CROSS JOIN cp.`tpch/region.parquet`");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -156,9 +151,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
   public void testDisabledCastTINYINT() throws Exception {
     try {
       test("select cast(n_name as tinyint) from cp.`tpch/nation.parquet`;");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -166,9 +160,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
   public void testDisabledCastSMALLINT() throws Exception {
     try {
       test("select cast(n_name as smallint) from cp.`tpch/nation.parquet`;");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -176,9 +169,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
   public void testDisabledCastREAL() throws Exception {
     try {
       test("select cast(n_name as real) from cp.`tpch/nation.parquet`;");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -186,9 +178,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
   public void testDisabledCardinality() throws Exception {
     try {
       test("select cardinality(employee_id) from cp.`employee.json`;");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -197,9 +188,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
     try {
       test("select a.*, b.user_port " +
           "from cp.`employee.json` a, sys.drillbits b;");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -209,9 +199,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
       test("select a.*, b.user_port " +
           "from cp.`employee.json` a, sys.drillbits b " +
           "where a.position_id <> b.user_port;");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -221,9 +210,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
       test("select a.last_name, b.n_name, c.r_name " +
           "from cp.`employee.json` a, cp.`tpch/nation.parquet` b, cp.`tpch/region.parquet` c " +
           "where a.position_id > b.n_nationKey and b.n_nationKey = c.r_regionkey;");
-      } catch(Exception ex) {
-        SqlUnsupportedException.errorMessageToException(ex.getMessage());
-        throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -233,9 +221,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
       test("select a.lastname, b.n_name " +
           "from cp.`employee.json` a LEFT JOIN cp.`tpch/nation.parquet` b " +
           "ON a.position_id > b.n_nationKey;");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -245,9 +232,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
       test("select a.lastname, b.n_name " +
           "from cp.`employee.json` a INNER JOIN cp.`tpch/nation.parquet` b " +
           "ON a.position_id > b.n_nationKey;");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -259,9 +245,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
           "where b.n_nationkey = " +
           "(select r_regionkey from cp.`tpch/region.parquet` " +
           "where r_regionkey = 1)");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -271,9 +256,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
       test("select a.lastname " +
           "from cp.`employee.json` a " +
           "where exists (select n_name from cp.`tpch/nation.parquet` b) AND a.position_id = 10");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -283,9 +267,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
       test("explain plan for (select a.lastname, b.n_name " +
           "from cp.`employee.json` a INNER JOIN cp.`tpch/nation.parquet` b " +
           "ON a.position_id > b.n_nationKey);");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -295,9 +278,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
       test("explain plan for (select a.lastname, b.n_name " +
           "from cp.`employee.json` a LEFT OUTER JOIN cp.`tpch/nation.parquet` b " +
           "ON (a.position_id > b.n_nationKey AND a.employee_id = b.n_regionkey));");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -307,9 +289,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
       test("select a.lastname, b.n_name " +
           "from cp.`employee.json` a RIGHT OUTER JOIN cp.`tpch/nation.parquet` b " +
           "ON (a.position_id > b.n_nationKey AND a.employee_id = b.n_regionkey);");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 
@@ -320,9 +301,8 @@ public class TestDisabledFunctionality extends BaseTestQuery{
           "OVER (PARTITION BY position_id order by position_id) " +
           "FROM cp.`employee.json` " +
           "order by employee_id;");
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
-      throw ex;
+    } catch(DrillUserException ex) {
+      throwAsUnsupportedException(ex);
     }
   }
 }
\ No newline at end of file

http://git-wip-us.apache.org/repos/asf/drill/blob/99b6d0e6/exec/java-exec/src/test/java/org/apache/drill/TestStarQueries.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestStarQueries.java b/exec/java-exec/src/test/java/org/apache/drill/TestStarQueries.java
index effef9b..3dfaf10 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/TestStarQueries.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/TestStarQueries.java
@@ -17,10 +17,10 @@
  */
 package org.apache.drill;
 
+import org.apache.drill.common.exceptions.DrillUserException;
 import org.apache.drill.common.types.TypeProtos;
 import org.apache.drill.common.util.TestTools;
 import org.junit.Test;
-import org.apache.drill.exec.rpc.RpcException;
 
 public class TestStarQueries extends BaseTestQuery{
   static final org.slf4j.Logger logger = org.slf4j.LoggerFactory.getLogger(TestStarQueries.class);
@@ -263,11 +263,11 @@ public class TestStarQueries extends BaseTestQuery{
     test("select *, first_name, *, last_name from cp.`employee.json`;");
   }
 
-  @Test(expected = RpcException.class)  // Should get "At line 1, column 8: Column 'n_nationkey' is ambiguous"
+  @Test(expected = DrillUserException.class)  // Should get "At line 1, column 8: Column 'n_nationkey' is ambiguous"
   public void testSelStarAmbiguousJoin() throws Exception {
     try {
       test("select x.n_nationkey, x.n_name, x.n_regionkey, x.r_name from (select * from cp.`tpch/nation.parquet` n, cp.`tpch/region.parquet` r where n.n_regionkey = r.r_regionkey) x " ) ;
-    } catch (RpcException e) {
+    } catch (DrillUserException e) {
       logger.info("***** Test resulted in expected failure: " + e.getMessage());
       throw e;
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/99b6d0e6/exec/java-exec/src/test/java/org/apache/drill/TestUnionAll.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/TestUnionAll.java b/exec/java-exec/src/test/java/org/apache/drill/TestUnionAll.java
index 11d83f9..3e00423 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/TestUnionAll.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/TestUnionAll.java
@@ -17,9 +17,9 @@
  */
 package org.apache.drill;
 
+import org.apache.drill.common.exceptions.DrillUserException;
 import org.apache.drill.common.types.TypeProtos;
 import org.apache.drill.common.util.FileUtils;
-import org.apache.drill.exec.rpc.RpcException;
 import org.apache.drill.exec.work.foreman.SqlUnsupportedException;
 import org.apache.drill.exec.work.foreman.UnsupportedRelOperatorException;
 import org.junit.Test;
@@ -227,8 +227,8 @@ public class TestUnionAll extends BaseTestQuery{
       String query = "(select * from dfs_test.tmp.`nation_view_testunionall`) " +
                      "union all (select * from cp.`tpch/region.parquet`)";
       test(query);
-    } catch(Exception ex) {
-      SqlUnsupportedException.errorMessageToException(ex.getMessage());
+    } catch(DrillUserException ex) {
+      SqlUnsupportedException.errorClassNameToException(ex.getOrCreatePBError(false).getException().getExceptionClass());
       throw ex;
     } finally {
       test("drop view nation_view_testunionall");
@@ -356,7 +356,7 @@ public class TestUnionAll extends BaseTestQuery{
         .build().run();
   }
 
-  @Test(expected = RpcException.class) // see DRILL-2590
+  @Test(expected = DrillUserException.class) // see DRILL-2590
   public void testUnionAllImplicitCastingFailure() throws Exception {
     String rootInt = FileUtils.getResourceAsFile("/store/json/intData.json").toURI().toString();
     String rootBoolean = FileUtils.getResourceAsFile("/store/json/booleanData.json").toURI().toString();

http://git-wip-us.apache.org/repos/asf/drill/blob/99b6d0e6/exec/java-exec/src/test/java/org/apache/drill/exec/server/TestDrillbitResilience.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/server/TestDrillbitResilience.java b/exec/java-exec/src/test/java/org/apache/drill/exec/server/TestDrillbitResilience.java
index e03098a..69c274c 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/server/TestDrillbitResilience.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/server/TestDrillbitResilience.java
@@ -29,6 +29,7 @@ import org.apache.drill.QueryTestUtil;
 import org.apache.drill.SingleRowListener;
 import org.apache.drill.common.AutoCloseables;
 import org.apache.drill.common.config.DrillConfig;
+import org.apache.drill.common.exceptions.DrillUserException;
 import org.apache.drill.common.types.TypeProtos.MinorType;
 import org.apache.drill.exec.ExecConstants;
 import org.apache.drill.exec.ExecTest;
@@ -39,13 +40,13 @@ import org.apache.drill.exec.exception.SchemaChangeException;
 import org.apache.drill.exec.memory.BufferAllocator;
 import org.apache.drill.exec.memory.TopLevelAllocator;
 import org.apache.drill.exec.proto.UserBitShared.DrillPBError;
+import org.apache.drill.exec.proto.UserBitShared.ExceptionWrapper;
 import org.apache.drill.exec.proto.UserBitShared.QueryData;
 import org.apache.drill.exec.proto.UserBitShared.QueryType;
 import org.apache.drill.exec.record.BatchSchema;
 import org.apache.drill.exec.record.MaterializedField;
 import org.apache.drill.exec.record.RecordBatchLoader;
 import org.apache.drill.exec.record.VectorWrapper;
-import org.apache.drill.exec.rpc.RpcException;
 import org.apache.drill.exec.rpc.user.QueryDataBatch;
 import org.apache.drill.exec.testing.ExceptionInjectionUtil;
 import org.apache.drill.exec.testing.SimulatedExceptions.InjectionOption;
@@ -311,13 +312,10 @@ public class TestDrillbitResilience extends ExecTest {
    * @param desc the expected exception site description
    */
   private static void assertInjected(
-      final Throwable caught, final Class<? extends Throwable> exceptionClass, final String desc) {
-    final String cause = caught.getMessage();
-    final String[] causeParts = cause.split(":");
-    final String causeShortName = causeParts[0].trim();
-    final String causeDesc = causeParts[1].trim();
-    assertTrue(exceptionClass.getName().endsWith(causeShortName));
-    assertEquals(desc, causeDesc);
+      final DrillUserException caught, final Class<? extends Throwable> exceptionClass, final String desc) {
+    ExceptionWrapper cause = caught.getOrCreatePBError(false).getException();
+    assertEquals(exceptionClass.getName(), cause.getExceptionClass());
+    assertEquals(desc, cause.getMessage());
   }
 
   @Test
@@ -341,8 +339,8 @@ public class TestDrillbitResilience extends ExecTest {
     try {
       QueryTestUtil.test(drillClient, "select * from sys.drillbits");
       fail();
-    } catch(RpcException rpce) {
-      assertInjected(rpce, ForemanException.class, desc);
+    } catch(DrillUserException dre) {
+      assertInjected(dre, ForemanException.class, desc);
     }
   }
 
@@ -367,8 +365,8 @@ public class TestDrillbitResilience extends ExecTest {
     try {
       QueryTestUtil.test(drillClient, "select * from sys.drillbits");
       fail();
-    } catch(RpcException rpce) {
-      assertInjected(rpce, ForemanException.class, exceptionDesc);
+    } catch(DrillUserException dre) {
+      assertInjected(dre, ForemanException.class, exceptionDesc);
     }
   }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/99b6d0e6/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetResultListener.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetResultListener.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetResultListener.java
index 55f0d75..3bcfbdf 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetResultListener.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/ParquetResultListener.java
@@ -23,6 +23,8 @@ import java.io.UnsupportedEncodingException;
 import java.util.Arrays;
 import java.util.HashMap;
 
+import org.apache.drill.common.exceptions.DrillUserException;
+import org.apache.drill.common.exceptions.ErrorHelper;
 import org.apache.drill.common.types.TypeProtos;
 import org.apache.drill.exec.exception.SchemaChangeException;
 import org.apache.drill.exec.memory.BufferAllocator;
@@ -60,7 +62,7 @@ public class ParquetResultListener implements UserResultsListener {
   }
 
   @Override
-  public void submissionFailed(RpcException ex) {
+  public void submissionFailed(DrillUserException ex) {
     logger.error("Submission failed.", ex);
     future.setException(ex);
   }
@@ -167,7 +169,9 @@ public class ParquetResultListener implements UserResultsListener {
           assertEquals("Mismatched record counts in vectors.", recordsInBatch, valuesChecked.get(s).intValue());
         }
         assertEquals("Record count incorrect for column: " + s, totalRecords, (long) valuesChecked.get(s));
-      } catch (AssertionError e) { submissionFailed(new RpcException(e)); }
+      } catch (AssertionError e) {
+        submissionFailed(ErrorHelper.wrap(e));
+      }
     }
 
     assert valuesChecked.keySet().size() > 0;

http://git-wip-us.apache.org/repos/asf/drill/blob/99b6d0e6/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetPhysicalPlan.java
----------------------------------------------------------------------
diff --git a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetPhysicalPlan.java b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetPhysicalPlan.java
index 882cdbd..cde2e95 100644
--- a/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetPhysicalPlan.java
+++ b/exec/java-exec/src/test/java/org/apache/drill/exec/store/parquet/TestParquetPhysicalPlan.java
@@ -23,12 +23,12 @@ import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
 import org.apache.drill.common.config.DrillConfig;
+import org.apache.drill.common.exceptions.DrillUserException;
 import org.apache.drill.exec.ExecTest;
 import org.apache.drill.exec.client.DrillClient;
 import org.apache.drill.exec.proto.UserBitShared.QueryId;
 import org.apache.drill.exec.record.RecordBatchLoader;
 import org.apache.drill.exec.record.VectorWrapper;
-import org.apache.drill.exec.rpc.RpcException;
 import org.apache.drill.exec.rpc.user.ConnectionThrottle;
 import org.apache.drill.exec.rpc.user.QueryDataBatch;
 import org.apache.drill.exec.rpc.user.UserResultsListener;
@@ -90,7 +90,7 @@ public class TestParquetPhysicalPlan extends ExecTest {
     private CountDownLatch latch = new CountDownLatch(1);
 
     @Override
-    public void submissionFailed(RpcException ex) {
+    public void submissionFailed(DrillUserException ex) {
       logger.error("submission failed", ex);
       latch.countDown();
     }

http://git-wip-us.apache.org/repos/asf/drill/blob/99b6d0e6/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillCursor.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillCursor.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillCursor.java
index d666d06..857a885 100644
--- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillCursor.java
+++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/DrillCursor.java
@@ -25,10 +25,8 @@ import net.hydromatic.avatica.ArrayImpl.Factory;
 import net.hydromatic.avatica.ColumnMetaData;
 import net.hydromatic.avatica.Cursor;
 
-import org.apache.drill.exec.exception.SchemaChangeException;
 import org.apache.drill.exec.record.BatchSchema;
 import org.apache.drill.exec.record.RecordBatchLoader;
-import org.apache.drill.exec.rpc.RpcException;
 import org.apache.drill.exec.rpc.user.QueryDataBatch;
 import org.apache.drill.jdbc.impl.DrillResultSetImpl;
 
@@ -141,7 +139,7 @@ public class DrillCursor implements Cursor {
           }
           return true;
         }
-      } catch (RpcException | InterruptedException | SchemaChangeException e) {
+      } catch (Exception e) {
         throw new SQLException("Failure while executing query.", e);
       }
 

http://git-wip-us.apache.org/repos/asf/drill/blob/99b6d0e6/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillResultSetImpl.java
----------------------------------------------------------------------
diff --git a/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillResultSetImpl.java b/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillResultSetImpl.java
index 24ef62b..a9753bc 100644
--- a/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillResultSetImpl.java
+++ b/exec/jdbc/src/main/java/org/apache/drill/jdbc/impl/DrillResultSetImpl.java
@@ -29,12 +29,12 @@ import net.hydromatic.avatica.AvaticaPrepareResult;
 import net.hydromatic.avatica.AvaticaResultSet;
 import net.hydromatic.avatica.AvaticaStatement;
 
+import org.apache.drill.common.exceptions.DrillUserException;
 import org.apache.drill.exec.client.DrillClient;
 import org.apache.drill.exec.proto.UserBitShared.QueryId;
 import org.apache.drill.exec.proto.UserBitShared.QueryType;
 import org.apache.drill.exec.proto.helper.QueryIdHelper;
 import org.apache.drill.exec.record.RecordBatchLoader;
-import org.apache.drill.exec.rpc.RpcException;
 import org.apache.drill.exec.rpc.user.ConnectionThrottle;
 import org.apache.drill.exec.rpc.user.QueryDataBatch;
 import org.apache.drill.exec.rpc.user.UserResultsListener;
@@ -160,7 +160,7 @@ public class DrillResultSetImpl extends AvaticaResultSet implements DrillResultS
   // (Public until JDBC impl. classes moved out of published-intf. package. (DRILL-2089).)
   public class ResultsListener implements UserResultsListener {
     private static final int MAX = 100;
-    private volatile RpcException ex;
+    private volatile DrillUserException ex;
     volatile boolean completed = false;
     private volatile boolean autoread = true;
     private volatile ConnectionThrottle throttle;
@@ -183,7 +183,7 @@ public class DrillResultSetImpl extends AvaticaResultSet implements DrillResultS
     }
 
     @Override
-    public void submissionFailed(RpcException ex) {
+    public void submissionFailed(DrillUserException ex) {
       this.ex = ex;
       completed = true;
       close();
@@ -219,7 +219,7 @@ public class DrillResultSetImpl extends AvaticaResultSet implements DrillResultS
     }
 
     // TODO:  Doc.:  Specify whether result can be null and what that means.
-    public QueryDataBatch getNext() throws RpcException, InterruptedException {
+    public QueryDataBatch getNext() throws Exception {
       while (true) {
         if (ex != null) {
           throw ex;

http://git-wip-us.apache.org/repos/asf/drill/blob/99b6d0e6/protocol/src/main/java/org/apache/drill/exec/proto/SchemaUserBitShared.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/SchemaUserBitShared.java b/protocol/src/main/java/org/apache/drill/exec/proto/SchemaUserBitShared.java
index f72d5e1..d9dba6e 100644
--- a/protocol/src/main/java/org/apache/drill/exec/proto/SchemaUserBitShared.java
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/SchemaUserBitShared.java
@@ -270,7 +270,7 @@ public final class SchemaUserBitShared
                     output.writeObject(2, message.getEndpoint(), org.apache.drill.exec.proto.SchemaCoordinationProtos.DrillbitEndpoint.WRITE, false);
 
                 if(message.hasErrorType())
-                    output.writeInt32(3, message.getErrorType(), false);
+                    output.writeEnum(3, message.getErrorType().getNumber(), false);
                 if(message.hasMessage())
                     output.writeString(4, message.getMessage(), false);
                 if(message.hasException())
@@ -326,7 +326,7 @@ public final class SchemaUserBitShared
 
                             break;
                         case 3:
-                            builder.setErrorType(input.readInt32());
+                            builder.setErrorType(org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType.valueOf(input.readEnum()));
                             break;
                         case 4:
                             builder.setMessage(input.readString());

http://git-wip-us.apache.org/repos/asf/drill/blob/99b6d0e6/protocol/src/main/java/org/apache/drill/exec/proto/UserBitShared.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/UserBitShared.java b/protocol/src/main/java/org/apache/drill/exec/proto/UserBitShared.java
index 96a921b..4b4e558 100644
--- a/protocol/src/main/java/org/apache/drill/exec/proto/UserBitShared.java
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/UserBitShared.java
@@ -1705,15 +1705,15 @@ public final class UserBitShared {
      */
     org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpointOrBuilder getEndpointOrBuilder();
 
-    // optional int32 error_type = 3;
+    // optional .exec.shared.DrillPBError.ErrorType error_type = 3;
     /**
-     * <code>optional int32 error_type = 3;</code>
+     * <code>optional .exec.shared.DrillPBError.ErrorType error_type = 3;</code>
      */
     boolean hasErrorType();
     /**
-     * <code>optional int32 error_type = 3;</code>
+     * <code>optional .exec.shared.DrillPBError.ErrorType error_type = 3;</code>
      */
-    int getErrorType();
+    org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType getErrorType();
 
     // optional string message = 4;
     /**
@@ -1859,8 +1859,14 @@ public final class UserBitShared {
               break;
             }
             case 24: {
-              bitField0_ |= 0x00000004;
-              errorType_ = input.readInt32();
+              int rawValue = input.readEnum();
+              org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType value = org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType.valueOf(rawValue);
+              if (value == null) {
+                unknownFields.mergeVarintField(3, rawValue);
+              } else {
+                bitField0_ |= 0x00000004;
+                errorType_ = value;
+              }
               break;
             }
             case 34: {
@@ -1931,6 +1937,160 @@ public final class UserBitShared {
       return PARSER;
     }
 
+    /**
+     * Protobuf enum {@code exec.shared.DrillPBError.ErrorType}
+     */
+    public enum ErrorType
+        implements com.google.protobuf.ProtocolMessageEnum {
+      /**
+       * <code>CONNECTION = 0;</code>
+       */
+      CONNECTION(0, 0),
+      /**
+       * <code>DATA_READ = 1;</code>
+       */
+      DATA_READ(1, 1),
+      /**
+       * <code>DATA_WRITE = 2;</code>
+       */
+      DATA_WRITE(2, 2),
+      /**
+       * <code>FUNCTION = 3;</code>
+       */
+      FUNCTION(3, 3),
+      /**
+       * <code>PARSE = 4;</code>
+       */
+      PARSE(4, 4),
+      /**
+       * <code>PERMISSION = 5;</code>
+       */
+      PERMISSION(5, 5),
+      /**
+       * <code>PLAN = 6;</code>
+       */
+      PLAN(6, 6),
+      /**
+       * <code>RESOURCE = 7;</code>
+       */
+      RESOURCE(7, 7),
+      /**
+       * <code>SYSTEM = 8;</code>
+       */
+      SYSTEM(8, 8),
+      /**
+       * <code>UNSUPPORTED_OPERATION = 9;</code>
+       */
+      UNSUPPORTED_OPERATION(9, 9),
+      ;
+
+      /**
+       * <code>CONNECTION = 0;</code>
+       */
+      public static final int CONNECTION_VALUE = 0;
+      /**
+       * <code>DATA_READ = 1;</code>
+       */
+      public static final int DATA_READ_VALUE = 1;
+      /**
+       * <code>DATA_WRITE = 2;</code>
+       */
+      public static final int DATA_WRITE_VALUE = 2;
+      /**
+       * <code>FUNCTION = 3;</code>
+       */
+      public static final int FUNCTION_VALUE = 3;
+      /**
+       * <code>PARSE = 4;</code>
+       */
+      public static final int PARSE_VALUE = 4;
+      /**
+       * <code>PERMISSION = 5;</code>
+       */
+      public static final int PERMISSION_VALUE = 5;
+      /**
+       * <code>PLAN = 6;</code>
+       */
+      public static final int PLAN_VALUE = 6;
+      /**
+       * <code>RESOURCE = 7;</code>
+       */
+      public static final int RESOURCE_VALUE = 7;
+      /**
+       * <code>SYSTEM = 8;</code>
+       */
+      public static final int SYSTEM_VALUE = 8;
+      /**
+       * <code>UNSUPPORTED_OPERATION = 9;</code>
+       */
+      public static final int UNSUPPORTED_OPERATION_VALUE = 9;
+
+
+      public final int getNumber() { return value; }
+
+      public static ErrorType valueOf(int value) {
+        switch (value) {
+          case 0: return CONNECTION;
+          case 1: return DATA_READ;
+          case 2: return DATA_WRITE;
+          case 3: return FUNCTION;
+          case 4: return PARSE;
+          case 5: return PERMISSION;
+          case 6: return PLAN;
+          case 7: return RESOURCE;
+          case 8: return SYSTEM;
+          case 9: return UNSUPPORTED_OPERATION;
+          default: return null;
+        }
+      }
+
+      public static com.google.protobuf.Internal.EnumLiteMap<ErrorType>
+          internalGetValueMap() {
+        return internalValueMap;
+      }
+      private static com.google.protobuf.Internal.EnumLiteMap<ErrorType>
+          internalValueMap =
+            new com.google.protobuf.Internal.EnumLiteMap<ErrorType>() {
+              public ErrorType findValueByNumber(int number) {
+                return ErrorType.valueOf(number);
+              }
+            };
+
+      public final com.google.protobuf.Descriptors.EnumValueDescriptor
+          getValueDescriptor() {
+        return getDescriptor().getValues().get(index);
+      }
+      public final com.google.protobuf.Descriptors.EnumDescriptor
+          getDescriptorForType() {
+        return getDescriptor();
+      }
+      public static final com.google.protobuf.Descriptors.EnumDescriptor
+          getDescriptor() {
+        return org.apache.drill.exec.proto.UserBitShared.DrillPBError.getDescriptor().getEnumTypes().get(0);
+      }
+
+      private static final ErrorType[] VALUES = values();
+
+      public static ErrorType valueOf(
+          com.google.protobuf.Descriptors.EnumValueDescriptor desc) {
+        if (desc.getType() != getDescriptor()) {
+          throw new java.lang.IllegalArgumentException(
+            "EnumValueDescriptor is not for this type.");
+        }
+        return VALUES[desc.getIndex()];
+      }
+
+      private final int index;
+      private final int value;
+
+      private ErrorType(int index, int value) {
+        this.index = index;
+        this.value = value;
+      }
+
+      // @@protoc_insertion_point(enum_scope:exec.shared.DrillPBError.ErrorType)
+    }
+
     private int bitField0_;
     // optional string error_id = 1;
     public static final int ERROR_ID_FIELD_NUMBER = 1;
@@ -2009,19 +2169,19 @@ public final class UserBitShared {
       return endpoint_;
     }
 
-    // optional int32 error_type = 3;
+    // optional .exec.shared.DrillPBError.ErrorType error_type = 3;
     public static final int ERROR_TYPE_FIELD_NUMBER = 3;
-    private int errorType_;
+    private org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType errorType_;
     /**
-     * <code>optional int32 error_type = 3;</code>
+     * <code>optional .exec.shared.DrillPBError.ErrorType error_type = 3;</code>
      */
     public boolean hasErrorType() {
       return ((bitField0_ & 0x00000004) == 0x00000004);
     }
     /**
-     * <code>optional int32 error_type = 3;</code>
+     * <code>optional .exec.shared.DrillPBError.ErrorType error_type = 3;</code>
      */
-    public int getErrorType() {
+    public org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType getErrorType() {
       return errorType_;
     }
 
@@ -2149,7 +2309,7 @@ public final class UserBitShared {
     private void initFields() {
       errorId_ = "";
       endpoint_ = org.apache.drill.exec.proto.CoordinationProtos.DrillbitEndpoint.getDefaultInstance();
-      errorType_ = 0;
+      errorType_ = org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType.CONNECTION;
       message_ = "";
       exception_ = org.apache.drill.exec.proto.UserBitShared.ExceptionWrapper.getDefaultInstance();
       parsingError_ = java.util.Collections.emptyList();
@@ -2173,7 +2333,7 @@ public final class UserBitShared {
         output.writeMessage(2, endpoint_);
       }
       if (((bitField0_ & 0x00000004) == 0x00000004)) {
-        output.writeInt32(3, errorType_);
+        output.writeEnum(3, errorType_.getNumber());
       }
       if (((bitField0_ & 0x00000008) == 0x00000008)) {
         output.writeBytes(4, getMessageBytes());
@@ -2203,7 +2363,7 @@ public final class UserBitShared {
       }
       if (((bitField0_ & 0x00000004) == 0x00000004)) {
         size += com.google.protobuf.CodedOutputStream
-          .computeInt32Size(3, errorType_);
+          .computeEnumSize(3, errorType_.getNumber());
       }
       if (((bitField0_ & 0x00000008) == 0x00000008)) {
         size += com.google.protobuf.CodedOutputStream
@@ -2344,7 +2504,7 @@ public final class UserBitShared {
           endpointBuilder_.clear();
         }
         bitField0_ = (bitField0_ & ~0x00000002);
-        errorType_ = 0;
+        errorType_ = org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType.CONNECTION;
         bitField0_ = (bitField0_ & ~0x00000004);
         message_ = "";
         bitField0_ = (bitField0_ & ~0x00000008);
@@ -2728,35 +2888,38 @@ public final class UserBitShared {
         return endpointBuilder_;
       }
 
-      // optional int32 error_type = 3;
-      private int errorType_ ;
+      // optional .exec.shared.DrillPBError.ErrorType error_type = 3;
+      private org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType errorType_ = org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType.CONNECTION;
       /**
-       * <code>optional int32 error_type = 3;</code>
+       * <code>optional .exec.shared.DrillPBError.ErrorType error_type = 3;</code>
        */
       public boolean hasErrorType() {
         return ((bitField0_ & 0x00000004) == 0x00000004);
       }
       /**
-       * <code>optional int32 error_type = 3;</code>
+       * <code>optional .exec.shared.DrillPBError.ErrorType error_type = 3;</code>
        */
-      public int getErrorType() {
+      public org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType getErrorType() {
         return errorType_;
       }
       /**
-       * <code>optional int32 error_type = 3;</code>
+       * <code>optional .exec.shared.DrillPBError.ErrorType error_type = 3;</code>
        */
-      public Builder setErrorType(int value) {
+      public Builder setErrorType(org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType value) {
+        if (value == null) {
+          throw new NullPointerException();
+        }
         bitField0_ |= 0x00000004;
         errorType_ = value;
         onChanged();
         return this;
       }
       /**
-       * <code>optional int32 error_type = 3;</code>
+       * <code>optional .exec.shared.DrillPBError.ErrorType error_type = 3;</code>
        */
       public Builder clearErrorType() {
         bitField0_ = (bitField0_ & ~0x00000004);
-        errorType_ = 0;
+        errorType_ = org.apache.drill.exec.proto.UserBitShared.DrillPBError.ErrorType.CONNECTION;
         onChanged();
         return this;
       }
@@ -19611,103 +19774,108 @@ public final class UserBitShared {
       "s.proto\032\022Coordination.proto\032\017SchemaDef.p" +
       "roto\"$\n\017UserCredentials\022\021\n\tuser_name\030\001 \001" +
       "(\t\"\'\n\007QueryId\022\r\n\005part1\030\001 \001(\020\022\r\n\005part2\030\002 " +
-      "\001(\020\"\323\001\n\014DrillPBError\022\020\n\010error_id\030\001 \001(\t\022(" +
+      "\001(\020\"\235\003\n\014DrillPBError\022\020\n\010error_id\030\001 \001(\t\022(" +
       "\n\010endpoint\030\002 \001(\0132\026.exec.DrillbitEndpoint" +
-      "\022\022\n\nerror_type\030\003 \001(\005\022\017\n\007message\030\004 \001(\t\0220\n" +
-      "\texception\030\005 \001(\0132\035.exec.shared.Exception" +
-      "Wrapper\0220\n\rparsing_error\030\006 \003(\0132\031.exec.sh" +
-      "ared.ParsingError\"\246\001\n\020ExceptionWrapper\022\027",
-      "\n\017exception_class\030\001 \001(\t\022\017\n\007message\030\002 \001(\t" +
-      "\022:\n\013stack_trace\030\003 \003(\0132%.exec.shared.Stac" +
-      "kTraceElementWrapper\022,\n\005cause\030\004 \001(\0132\035.ex" +
-      "ec.shared.ExceptionWrapper\"\205\001\n\030StackTrac" +
-      "eElementWrapper\022\022\n\nclass_name\030\001 \001(\t\022\021\n\tf" +
-      "ile_name\030\002 \001(\t\022\023\n\013line_number\030\003 \001(\005\022\023\n\013m" +
-      "ethod_name\030\004 \001(\t\022\030\n\020is_native_method\030\005 \001" +
-      "(\010\"\\\n\014ParsingError\022\024\n\014start_column\030\002 \001(\005" +
-      "\022\021\n\tstart_row\030\003 \001(\005\022\022\n\nend_column\030\004 \001(\005\022" +
-      "\017\n\007end_row\030\005 \001(\005\"~\n\016RecordBatchDef\022\024\n\014re",
-      "cord_count\030\001 \001(\005\022+\n\005field\030\002 \003(\0132\034.exec.s" +
-      "hared.SerializedField\022)\n!carries_two_byt" +
-      "e_selection_vector\030\003 \001(\010\"\205\001\n\010NamePart\022(\n" +
-      "\004type\030\001 \001(\0162\032.exec.shared.NamePart.Type\022" +
-      "\014\n\004name\030\002 \001(\t\022$\n\005child\030\003 \001(\0132\025.exec.shar" +
-      "ed.NamePart\"\033\n\004Type\022\010\n\004NAME\020\000\022\t\n\005ARRAY\020\001" +
-      "\"\351\001\n\017SerializedField\022%\n\nmajor_type\030\001 \001(\013" +
-      "2\021.common.MajorType\022(\n\tname_part\030\002 \001(\0132\025" +
-      ".exec.shared.NamePart\022+\n\005child\030\003 \003(\0132\034.e" +
-      "xec.shared.SerializedField\022\023\n\013value_coun",
-      "t\030\004 \001(\005\022\027\n\017var_byte_length\030\005 \001(\005\022\023\n\013grou" +
-      "p_count\030\006 \001(\005\022\025\n\rbuffer_length\030\007 \001(\005\"7\n\n" +
-      "NodeStatus\022\017\n\007node_id\030\001 \001(\005\022\030\n\020memory_fo" +
-      "otprint\030\002 \001(\003\"\206\002\n\013QueryResult\0228\n\013query_s" +
-      "tate\030\001 \001(\0162#.exec.shared.QueryResult.Que" +
-      "ryState\022&\n\010query_id\030\002 \001(\0132\024.exec.shared." +
-      "QueryId\022(\n\005error\030\003 \003(\0132\031.exec.shared.Dri" +
-      "llPBError\"k\n\nQueryState\022\013\n\007PENDING\020\000\022\013\n\007" +
-      "RUNNING\020\001\022\r\n\tCOMPLETED\020\002\022\014\n\010CANCELED\020\003\022\n" +
-      "\n\006FAILED\020\004\022\032\n\026CANCELLATION_REQUESTED\020\005\"p",
-      "\n\tQueryData\022&\n\010query_id\030\001 \001(\0132\024.exec.sha" +
-      "red.QueryId\022\021\n\trow_count\030\002 \001(\005\022(\n\003def\030\003 " +
-      "\001(\0132\033.exec.shared.RecordBatchDef\"\224\001\n\tQue" +
-      "ryInfo\022\r\n\005query\030\001 \001(\t\022\r\n\005start\030\002 \001(\003\0222\n\005" +
-      "state\030\003 \001(\0162#.exec.shared.QueryResult.Qu" +
-      "eryState\022\014\n\004user\030\004 \001(\t\022\'\n\007foreman\030\005 \001(\0132" +
-      "\026.exec.DrillbitEndpoint\"\336\002\n\014QueryProfile" +
-      "\022 \n\002id\030\001 \001(\0132\024.exec.shared.QueryId\022$\n\004ty" +
-      "pe\030\002 \001(\0162\026.exec.shared.QueryType\022\r\n\005star" +
-      "t\030\003 \001(\003\022\013\n\003end\030\004 \001(\003\022\r\n\005query\030\005 \001(\t\022\014\n\004p",
-      "lan\030\006 \001(\t\022\'\n\007foreman\030\007 \001(\0132\026.exec.Drillb" +
-      "itEndpoint\0222\n\005state\030\010 \001(\0162#.exec.shared." +
-      "QueryResult.QueryState\022\027\n\017total_fragment" +
-      "s\030\t \001(\005\022\032\n\022finished_fragments\030\n \001(\005\022;\n\020f" +
-      "ragment_profile\030\013 \003(\0132!.exec.shared.Majo" +
-      "rFragmentProfile\"t\n\024MajorFragmentProfile" +
-      "\022\031\n\021major_fragment_id\030\001 \001(\005\022A\n\026minor_fra" +
-      "gment_profile\030\002 \003(\0132!.exec.shared.MinorF" +
-      "ragmentProfile\"\274\002\n\024MinorFragmentProfile\022" +
-      ")\n\005state\030\001 \001(\0162\032.exec.shared.FragmentSta",
-      "te\022(\n\005error\030\002 \001(\0132\031.exec.shared.DrillPBE" +
-      "rror\022\031\n\021minor_fragment_id\030\003 \001(\005\0226\n\020opera" +
-      "tor_profile\030\004 \003(\0132\034.exec.shared.Operator" +
-      "Profile\022\022\n\nstart_time\030\005 \001(\003\022\020\n\010end_time\030" +
-      "\006 \001(\003\022\023\n\013memory_used\030\007 \001(\003\022\027\n\017max_memory" +
-      "_used\030\010 \001(\003\022(\n\010endpoint\030\t \001(\0132\026.exec.Dri" +
-      "llbitEndpoint\"\377\001\n\017OperatorProfile\0221\n\rinp" +
-      "ut_profile\030\001 \003(\0132\032.exec.shared.StreamPro" +
-      "file\022\023\n\013operator_id\030\003 \001(\005\022\025\n\roperator_ty" +
-      "pe\030\004 \001(\005\022\023\n\013setup_nanos\030\005 \001(\003\022\025\n\rprocess",
-      "_nanos\030\006 \001(\003\022#\n\033peak_local_memory_alloca" +
-      "ted\030\007 \001(\003\022(\n\006metric\030\010 \003(\0132\030.exec.shared." +
-      "MetricValue\022\022\n\nwait_nanos\030\t \001(\003\"B\n\rStrea" +
-      "mProfile\022\017\n\007records\030\001 \001(\003\022\017\n\007batches\030\002 \001" +
-      "(\003\022\017\n\007schemas\030\003 \001(\003\"J\n\013MetricValue\022\021\n\tme" +
-      "tric_id\030\001 \001(\005\022\022\n\nlong_value\030\002 \001(\003\022\024\n\014dou" +
-      "ble_value\030\003 \001(\001*5\n\nRpcChannel\022\017\n\013BIT_CON" +
-      "TROL\020\000\022\014\n\010BIT_DATA\020\001\022\010\n\004USER\020\002*/\n\tQueryT" +
-      "ype\022\007\n\003SQL\020\001\022\013\n\007LOGICAL\020\002\022\014\n\010PHYSICAL\020\003*" +
-      "k\n\rFragmentState\022\013\n\007SENDING\020\000\022\027\n\023AWAITIN",
-      "G_ALLOCATION\020\001\022\013\n\007RUNNING\020\002\022\014\n\010FINISHED\020" +
-      "\003\022\r\n\tCANCELLED\020\004\022\n\n\006FAILED\020\005*\312\005\n\020CoreOpe" +
-      "ratorType\022\021\n\rSINGLE_SENDER\020\000\022\024\n\020BROADCAS" +
-      "T_SENDER\020\001\022\n\n\006FILTER\020\002\022\022\n\016HASH_AGGREGATE" +
-      "\020\003\022\r\n\tHASH_JOIN\020\004\022\016\n\nMERGE_JOIN\020\005\022\031\n\025HAS" +
-      "H_PARTITION_SENDER\020\006\022\t\n\005LIMIT\020\007\022\024\n\020MERGI" +
-      "NG_RECEIVER\020\010\022\034\n\030ORDERED_PARTITION_SENDE" +
-      "R\020\t\022\013\n\007PROJECT\020\n\022\026\n\022UNORDERED_RECEIVER\020\013" +
-      "\022\020\n\014RANGE_SENDER\020\014\022\n\n\006SCREEN\020\r\022\034\n\030SELECT" +
-      "ION_VECTOR_REMOVER\020\016\022\027\n\023STREAMING_AGGREG",
-      "ATE\020\017\022\016\n\nTOP_N_SORT\020\020\022\021\n\rEXTERNAL_SORT\020\021" +
-      "\022\t\n\005TRACE\020\022\022\t\n\005UNION\020\023\022\014\n\010OLD_SORT\020\024\022\032\n\026" +
-      "PARQUET_ROW_GROUP_SCAN\020\025\022\021\n\rHIVE_SUB_SCA" +
-      "N\020\026\022\025\n\021SYSTEM_TABLE_SCAN\020\027\022\021\n\rMOCK_SUB_S" +
-      "CAN\020\030\022\022\n\016PARQUET_WRITER\020\031\022\023\n\017DIRECT_SUB_" +
-      "SCAN\020\032\022\017\n\013TEXT_WRITER\020\033\022\021\n\rTEXT_SUB_SCAN" +
-      "\020\034\022\021\n\rJSON_SUB_SCAN\020\035\022\030\n\024INFO_SCHEMA_SUB" +
-      "_SCAN\020\036\022\023\n\017COMPLEX_TO_JSON\020\037\022\025\n\021PRODUCER" +
-      "_CONSUMER\020 \022\022\n\016HBASE_SUB_SCAN\020!\022\n\n\006WINDO" +
-      "W\020\"\022\024\n\020NESTED_LOOP_JOIN\020#B.\n\033org.apache.",
-      "drill.exec.protoB\rUserBitSharedH\001"
+      "\0227\n\nerror_type\030\003 \001(\0162#.exec.shared.Drill" +
+      "PBError.ErrorType\022\017\n\007message\030\004 \001(\t\0220\n\tex" +
+      "ception\030\005 \001(\0132\035.exec.shared.ExceptionWra" +
+      "pper\0220\n\rparsing_error\030\006 \003(\0132\031.exec.share",
+      "d.ParsingError\"\242\001\n\tErrorType\022\016\n\nCONNECTI" +
+      "ON\020\000\022\r\n\tDATA_READ\020\001\022\016\n\nDATA_WRITE\020\002\022\014\n\010F" +
+      "UNCTION\020\003\022\t\n\005PARSE\020\004\022\016\n\nPERMISSION\020\005\022\010\n\004" +
+      "PLAN\020\006\022\014\n\010RESOURCE\020\007\022\n\n\006SYSTEM\020\010\022\031\n\025UNSU" +
+      "PPORTED_OPERATION\020\t\"\246\001\n\020ExceptionWrapper" +
+      "\022\027\n\017exception_class\030\001 \001(\t\022\017\n\007message\030\002 \001" +
+      "(\t\022:\n\013stack_trace\030\003 \003(\0132%.exec.shared.St" +
+      "ackTraceElementWrapper\022,\n\005cause\030\004 \001(\0132\035." +
+      "exec.shared.ExceptionWrapper\"\205\001\n\030StackTr" +
+      "aceElementWrapper\022\022\n\nclass_name\030\001 \001(\t\022\021\n",
+      "\tfile_name\030\002 \001(\t\022\023\n\013line_number\030\003 \001(\005\022\023\n" +
+      "\013method_name\030\004 \001(\t\022\030\n\020is_native_method\030\005" +
+      " \001(\010\"\\\n\014ParsingError\022\024\n\014start_column\030\002 \001" +
+      "(\005\022\021\n\tstart_row\030\003 \001(\005\022\022\n\nend_column\030\004 \001(" +
+      "\005\022\017\n\007end_row\030\005 \001(\005\"~\n\016RecordBatchDef\022\024\n\014" +
+      "record_count\030\001 \001(\005\022+\n\005field\030\002 \003(\0132\034.exec" +
+      ".shared.SerializedField\022)\n!carries_two_b" +
+      "yte_selection_vector\030\003 \001(\010\"\205\001\n\010NamePart\022" +
+      "(\n\004type\030\001 \001(\0162\032.exec.shared.NamePart.Typ" +
+      "e\022\014\n\004name\030\002 \001(\t\022$\n\005child\030\003 \001(\0132\025.exec.sh",
+      "ared.NamePart\"\033\n\004Type\022\010\n\004NAME\020\000\022\t\n\005ARRAY" +
+      "\020\001\"\351\001\n\017SerializedField\022%\n\nmajor_type\030\001 \001" +
+      "(\0132\021.common.MajorType\022(\n\tname_part\030\002 \001(\013" +
+      "2\025.exec.shared.NamePart\022+\n\005child\030\003 \003(\0132\034" +
+      ".exec.shared.SerializedField\022\023\n\013value_co" +
+      "unt\030\004 \001(\005\022\027\n\017var_byte_length\030\005 \001(\005\022\023\n\013gr" +
+      "oup_count\030\006 \001(\005\022\025\n\rbuffer_length\030\007 \001(\005\"7" +
+      "\n\nNodeStatus\022\017\n\007node_id\030\001 \001(\005\022\030\n\020memory_" +
+      "footprint\030\002 \001(\003\"\206\002\n\013QueryResult\0228\n\013query" +
+      "_state\030\001 \001(\0162#.exec.shared.QueryResult.Q",
+      "ueryState\022&\n\010query_id\030\002 \001(\0132\024.exec.share" +
+      "d.QueryId\022(\n\005error\030\003 \003(\0132\031.exec.shared.D" +
+      "rillPBError\"k\n\nQueryState\022\013\n\007PENDING\020\000\022\013" +
+      "\n\007RUNNING\020\001\022\r\n\tCOMPLETED\020\002\022\014\n\010CANCELED\020\003" +
+      "\022\n\n\006FAILED\020\004\022\032\n\026CANCELLATION_REQUESTED\020\005" +
+      "\"p\n\tQueryData\022&\n\010query_id\030\001 \001(\0132\024.exec.s" +
+      "hared.QueryId\022\021\n\trow_count\030\002 \001(\005\022(\n\003def\030" +
+      "\003 \001(\0132\033.exec.shared.RecordBatchDef\"\224\001\n\tQ" +
+      "ueryInfo\022\r\n\005query\030\001 \001(\t\022\r\n\005start\030\002 \001(\003\0222" +
+      "\n\005state\030\003 \001(\0162#.exec.shared.QueryResult.",
+      "QueryState\022\014\n\004user\030\004 \001(\t\022\'\n\007foreman\030\005 \001(" +
+      "\0132\026.exec.DrillbitEndpoint\"\336\002\n\014QueryProfi" +
+      "le\022 \n\002id\030\001 \001(\0132\024.exec.shared.QueryId\022$\n\004" +
+      "type\030\002 \001(\0162\026.exec.shared.QueryType\022\r\n\005st" +
+      "art\030\003 \001(\003\022\013\n\003end\030\004 \001(\003\022\r\n\005query\030\005 \001(\t\022\014\n" +
+      "\004plan\030\006 \001(\t\022\'\n\007foreman\030\007 \001(\0132\026.exec.Dril" +
+      "lbitEndpoint\0222\n\005state\030\010 \001(\0162#.exec.share" +
+      "d.QueryResult.QueryState\022\027\n\017total_fragme" +
+      "nts\030\t \001(\005\022\032\n\022finished_fragments\030\n \001(\005\022;\n" +
+      "\020fragment_profile\030\013 \003(\0132!.exec.shared.Ma",
+      "jorFragmentProfile\"t\n\024MajorFragmentProfi" +
+      "le\022\031\n\021major_fragment_id\030\001 \001(\005\022A\n\026minor_f" +
+      "ragment_profile\030\002 \003(\0132!.exec.shared.Mino" +
+      "rFragmentProfile\"\274\002\n\024MinorFragmentProfil" +
+      "e\022)\n\005state\030\001 \001(\0162\032.exec.shared.FragmentS" +
+      "tate\022(\n\005error\030\002 \001(\0132\031.exec.shared.DrillP" +
+      "BError\022\031\n\021minor_fragment_id\030\003 \001(\005\0226\n\020ope" +
+      "rator_profile\030\004 \003(\0132\034.exec.shared.Operat" +
+      "orProfile\022\022\n\nstart_time\030\005 \001(\003\022\020\n\010end_tim" +
+      "e\030\006 \001(\003\022\023\n\013memory_used\030\007 \001(\003\022\027\n\017max_memo",
+      "ry_used\030\010 \001(\003\022(\n\010endpoint\030\t \001(\0132\026.exec.D" +
+      "rillbitEndpoint\"\377\001\n\017OperatorProfile\0221\n\ri" +
+      "nput_profile\030\001 \003(\0132\032.exec.shared.StreamP" +
+      "rofile\022\023\n\013operator_id\030\003 \001(\005\022\025\n\roperator_" +
+      "type\030\004 \001(\005\022\023\n\013setup_nanos\030\005 \001(\003\022\025\n\rproce" +
+      "ss_nanos\030\006 \001(\003\022#\n\033peak_local_memory_allo" +
+      "cated\030\007 \001(\003\022(\n\006metric\030\010 \003(\0132\030.exec.share" +
+      "d.MetricValue\022\022\n\nwait_nanos\030\t \001(\003\"B\n\rStr" +
+      "eamProfile\022\017\n\007records\030\001 \001(\003\022\017\n\007batches\030\002" +
+      " \001(\003\022\017\n\007schemas\030\003 \001(\003\"J\n\013MetricValue\022\021\n\t",
+      "metric_id\030\001 \001(\005\022\022\n\nlong_value\030\002 \001(\003\022\024\n\014d" +
+      "ouble_value\030\003 \001(\001*5\n\nRpcChannel\022\017\n\013BIT_C" +
+      "ONTROL\020\000\022\014\n\010BIT_DATA\020\001\022\010\n\004USER\020\002*/\n\tQuer" +
+      "yType\022\007\n\003SQL\020\001\022\013\n\007LOGICAL\020\002\022\014\n\010PHYSICAL\020" +
+      "\003*k\n\rFragmentState\022\013\n\007SENDING\020\000\022\027\n\023AWAIT" +
+      "ING_ALLOCATION\020\001\022\013\n\007RUNNING\020\002\022\014\n\010FINISHE" +
+      "D\020\003\022\r\n\tCANCELLED\020\004\022\n\n\006FAILED\020\005*\312\005\n\020CoreO" +
+      "peratorType\022\021\n\rSINGLE_SENDER\020\000\022\024\n\020BROADC" +
+      "AST_SENDER\020\001\022\n\n\006FILTER\020\002\022\022\n\016HASH_AGGREGA" +
+      "TE\020\003\022\r\n\tHASH_JOIN\020\004\022\016\n\nMERGE_JOIN\020\005\022\031\n\025H",
+      "ASH_PARTITION_SENDER\020\006\022\t\n\005LIMIT\020\007\022\024\n\020MER" +
+      "GING_RECEIVER\020\010\022\034\n\030ORDERED_PARTITION_SEN" +
+      "DER\020\t\022\013\n\007PROJECT\020\n\022\026\n\022UNORDERED_RECEIVER" +
+      "\020\013\022\020\n\014RANGE_SENDER\020\014\022\n\n\006SCREEN\020\r\022\034\n\030SELE" +
+      "CTION_VECTOR_REMOVER\020\016\022\027\n\023STREAMING_AGGR" +
+      "EGATE\020\017\022\016\n\nTOP_N_SORT\020\020\022\021\n\rEXTERNAL_SORT" +
+      "\020\021\022\t\n\005TRACE\020\022\022\t\n\005UNION\020\023\022\014\n\010OLD_SORT\020\024\022\032" +
+      "\n\026PARQUET_ROW_GROUP_SCAN\020\025\022\021\n\rHIVE_SUB_S" +
+      "CAN\020\026\022\025\n\021SYSTEM_TABLE_SCAN\020\027\022\021\n\rMOCK_SUB" +
+      "_SCAN\020\030\022\022\n\016PARQUET_WRITER\020\031\022\023\n\017DIRECT_SU",
+      "B_SCAN\020\032\022\017\n\013TEXT_WRITER\020\033\022\021\n\rTEXT_SUB_SC" +
+      "AN\020\034\022\021\n\rJSON_SUB_SCAN\020\035\022\030\n\024INFO_SCHEMA_S" +
+      "UB_SCAN\020\036\022\023\n\017COMPLEX_TO_JSON\020\037\022\025\n\021PRODUC" +
+      "ER_CONSUMER\020 \022\022\n\016HBASE_SUB_SCAN\020!\022\n\n\006WIN" +
+      "DOW\020\"\022\024\n\020NESTED_LOOP_JOIN\020#B.\n\033org.apach" +
+      "e.drill.exec.protoB\rUserBitSharedH\001"
     };
     com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner assigner =
       new com.google.protobuf.Descriptors.FileDescriptor.InternalDescriptorAssigner() {

http://git-wip-us.apache.org/repos/asf/drill/blob/99b6d0e6/protocol/src/main/java/org/apache/drill/exec/proto/beans/DrillPBError.java
----------------------------------------------------------------------
diff --git a/protocol/src/main/java/org/apache/drill/exec/proto/beans/DrillPBError.java b/protocol/src/main/java/org/apache/drill/exec/proto/beans/DrillPBError.java
index ac9cef5..873ffa4 100644
--- a/protocol/src/main/java/org/apache/drill/exec/proto/beans/DrillPBError.java
+++ b/protocol/src/main/java/org/apache/drill/exec/proto/beans/DrillPBError.java
@@ -35,6 +35,50 @@ import com.dyuproject.protostuff.Schema;
 
 public final class DrillPBError implements Externalizable, Message<DrillPBError>, Schema<DrillPBError>
 {
+    public enum ErrorType implements com.dyuproject.protostuff.EnumLite<ErrorType>
+    {
+        CONNECTION(0),
+        DATA_READ(1),
+        DATA_WRITE(2),
+        FUNCTION(3),
+        PARSE(4),
+        PERMISSION(5),
+        PLAN(6),
+        RESOURCE(7),
+        SYSTEM(8),
+        UNSUPPORTED_OPERATION(9);
+        
+        public final int number;
+        
+        private ErrorType (int number)
+        {
+            this.number = number;
+        }
+        
+        public int getNumber()
+        {
+            return number;
+        }
+        
+        public static ErrorType valueOf(int number)
+        {
+            switch(number) 
+            {
+                case 0: return CONNECTION;
+                case 1: return DATA_READ;
+                case 2: return DATA_WRITE;
+                case 3: return FUNCTION;
+                case 4: return PARSE;
+                case 5: return PERMISSION;
+                case 6: return PLAN;
+                case 7: return RESOURCE;
+                case 8: return SYSTEM;
+                case 9: return UNSUPPORTED_OPERATION;
+                default: return null;
+            }
+        }
+    }
+
 
     public static Schema<DrillPBError> getSchema()
     {
@@ -51,7 +95,7 @@ public final class DrillPBError implements Externalizable, Message<DrillPBError>
     
     private String errorId;
     private DrillbitEndpoint endpoint;
-    private int errorType;
+    private ErrorType errorType;
     private String message;
     private ExceptionWrapper exception;
     private List<ParsingError> parsingError;
@@ -91,12 +135,12 @@ public final class DrillPBError implements Externalizable, Message<DrillPBError>
 
     // errorType
 
-    public int getErrorType()
+    public ErrorType getErrorType()
     {
-        return errorType;
+        return errorType == null ? ErrorType.CONNECTION : errorType;
     }
 
-    public DrillPBError setErrorType(int errorType)
+    public DrillPBError setErrorType(ErrorType errorType)
     {
         this.errorType = errorType;
         return this;
@@ -203,7 +247,7 @@ public final class DrillPBError implements Externalizable, Message<DrillPBError>
                     break;
 
                 case 3:
-                    message.errorType = input.readInt32();
+                    message.errorType = ErrorType.valueOf(input.readEnum());
                     break;
                 case 4:
                     message.message = input.readString();
@@ -234,8 +278,8 @@ public final class DrillPBError implements Externalizable, Message<DrillPBError>
              output.writeObject(2, message.endpoint, DrillbitEndpoint.getSchema(), false);
 
 
-        if(message.errorType != 0)
-            output.writeInt32(3, message.errorType, false);
+        if(message.errorType != null)
+             output.writeEnum(3, message.errorType.number, false);
 
         if(message.message != null)
             output.writeString(4, message.message, false);

http://git-wip-us.apache.org/repos/asf/drill/blob/99b6d0e6/protocol/src/main/protobuf/UserBitShared.proto
----------------------------------------------------------------------
diff --git a/protocol/src/main/protobuf/UserBitShared.proto b/protocol/src/main/protobuf/UserBitShared.proto
index 2938114..0f86958 100644
--- a/protocol/src/main/protobuf/UserBitShared.proto
+++ b/protocol/src/main/protobuf/UserBitShared.proto
@@ -30,9 +30,21 @@ message QueryId {
 }
 
 message DrillPBError{
+  enum ErrorType {
+    CONNECTION = 0;
+    DATA_READ = 1;
+    DATA_WRITE = 2;
+    FUNCTION = 3;
+    PARSE = 4;
+    PERMISSION = 5;
+    PLAN = 6;
+    RESOURCE = 7;
+    SYSTEM = 8;
+    UNSUPPORTED_OPERATION = 9;
+  }
   optional string error_id = 1; // for debug tracing purposes
   optional DrillbitEndpoint endpoint = 2;
-  optional int32 error_type = 3;
+  optional ErrorType error_type = 3;
   optional string message = 4;
   optional ExceptionWrapper exception = 5;
   repeated ParsingError parsing_error = 6; //optional, used when providing location of error within a piece of text.


Mime
View raw message