vdiravka commented on a change in pull request #1455: DRILL-6724: Convert 
IndexOutOfBounds exception to UserException with …
URL: https://github.com/apache/drill/pull/1455#discussion_r214878343
 
 

 ##########
 File path: 
exec/java-exec/src/main/java/org/apache/drill/exec/store/AbstractRecordReader.java
 ##########
 @@ -105,4 +106,22 @@ public void allocate(Map<String, ValueVector> vectorMap) 
throws OutOfMemoryExcep
     return GroupScan.ALL_COLUMNS;
   }
 
+  @Override
+  public UserException createUserException(int type, Throwable cause, String 
message) {
+    return null;
+  }
+
+  // Construct builder depending on type
+  protected UserException.Builder getExceptionBuilder(int type, Throwable 
cause) {
+    if (type < ERROR_TYPE_DATA_READ || type > ERROR_TYPE_INTERNAL) {
 
 Review comment:
   If a new ERROR type is introduced between above two ones, it should be 
obligatorily reflected here
   What about:
   ```
       UserException.Builder builder;
       if (type == ERROR_TYPE_DATA_READ) {
         builder = UserException.dataReadError(cause);
       } else if (type == ERROR_TYPE_INTERNAL) {
         builder = UserException.internalError(cause);
       } else {
         throw new IllegalArgumentException("Unknown error type: " + type);
       }
       return builder;
   ```

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
us...@infra.apache.org


With regards,
Apache Git Services

Reply via email to