Paul Rogers created DRILL-6065:
----------------------------------

             Summary: Properly handle UserException thrown by format plugin 
setup method
                 Key: DRILL-6065
                 URL: https://issues.apache.org/jira/browse/DRILL-6065
             Project: Apache Drill
          Issue Type: Bug
    Affects Versions: 1.10.0
            Reporter: Paul Rogers
            Priority: Minor


The scan operator calls the {{setup()}} method of the record reader when 
opening the reader. The {{setup()}} method is expected to throw a 
{{ExecutionSetupException}} which is translated into a 
{{UserException.systemError()}}.

The setup method often opens files, parses the project list, maps projected 
columns to table columns and other advanced tasks. When things fail, the 
{{setup()}} method should be able to use a {{UserException}} to provide detail.

If a {{setup()}} method does throw a {{UserException}}, that exceptin is 
improperly handled; it gets wrapped in another {{UserException}}:

{code}
    } catch (Exception ex) {
      throw UserException.systemError(ex).build(logger);
{code}

Instead, the code should simply rethrow the {{UserException}}:

{code}
    } catch (UserException ex) {
      throw ex;
    } catch (Exception ex) {
      throw UserException.systemError(ex).build(logger);
{code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Reply via email to