You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@drill.apache.org by "ASF GitHub Bot (Jira)" <ji...@apache.org> on 2021/03/27 15:52:00 UTC

[jira] [Commented] (DRILL-7888) query.json returns an incorrect error message when the query fails

    [ https://issues.apache.org/jira/browse/DRILL-7888?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17309976#comment-17309976 ] 

ASF GitHub Bot commented on DRILL-7888:
---------------------------------------

vvysotskyi opened a new pull request #2194:
URL: https://github.com/apache/drill/pull/2194


   # [DRILL-7888](https://issues.apache.org/jira/browse/DRILL-7888): query.json returns an incorrect error message when the query fails
   
   ## Description
   Updated StreamingHttpConnection.java to return query id and failed state instead of the incorrect message as stated in the Jira ticket.
   
   Examples of the requests and responses:
   Request:
   ```
   {
       "query": "SELECT * FROM cp.`employee123321123321.json` LIMIT 20",
       "queryType": "SQL"
   }
   ```
   Response:
   ```
   {
       "queryId": "1fa0acc2-e507-6688-69fe-02fc627c8c47",
       "queryState": "FAILED"
   }
   ```
   Please note, to preserve backward compatibility, default response has such a form, so now it is possible to obtain additional error info from the query profile.
   
   To provide error details right in the response, the `exec.errors.verbose` option should be set in the following way:
   ```
   {
       "query": "SELECT * FROM cp.`employee123321123321.json` LIMIT 20",
       "queryType": "SQL",
       "options": {
           "exec.errors.verbose": "true"
       }
   }
   ```
   
   The result will be the following and includes a detailed error message and exception stack trace:
   ```
   {
       "queryId": "1fa0ac2e-19e7-a453-d2b4-6e775e57b4ca",
       "exception": "org.apache.calcite.runtime.CalciteContextException",
       "errorMessage": "From line 1, column 15 to line 1, column 16: Object 'employee123321123321.json' not found within 'cp': Object 'employee123321123321.json' not found within 'cp'",
       "stackTrace": "org.apache.calcite.runtime.CalciteContextException: From line 1, column 15 to line 1, column 16: Object 'employee123321123321.json' not found within 'cp': Object 'employee123321123321.json' not found within 'cp'\n\tat .......(:0)\n\tat org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463)\n\tat org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:835)\n\tat org.apache.calcite.sql.SqlUtil.newContextException(SqlUtil.java:820)\n\tat org.apache.calcite.sql.validate.SqlValidatorImpl.newValidationError(SqlValidatorImpl.java:4881)\n\tat org.apache.calcite.sql.validate.IdentifierNamespace.resolveImpl(IdentifierNamespace.java:127)\n\tat org.apache.calcite.sql.validate.IdentifierNamespace.validateImpl(IdentifierNamespace.java:177)\n\tat org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)\n\tat org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1009)\n\tat org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:969)\n\tat org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3129)\n\tat org.apache.drill.exec.planner.sql.conversion.DrillValidator.validateFrom(DrillValidator.java:63)\n\tat org.apache.calcite.sql.validate.SqlValidatorImpl.validateFrom(SqlValidatorImpl.java:3111)\n\tat org.apache.drill.exec.planner.sql.conversion.DrillValidator.validateFrom(DrillValidator.java:63)\n\tat org.apache.calcite.sql.validate.SqlValidatorImpl.validateSelect(SqlValidatorImpl.java:3383)\n\tat org.apache.calcite.sql.validate.SelectNamespace.validateImpl(SelectNamespace.java:60)\n\tat org.apache.calcite.sql.validate.AbstractNamespace.validate(AbstractNamespace.java:84)\n\tat org.apache.calcite.sql.validate.SqlValidatorImpl.validateNamespace(SqlValidatorImpl.java:1009)\n\tat org.apache.calcite.sql.validate.SqlValidatorImpl.validateQuery(SqlValidatorImpl.java:969)\n\tat org.apache.calcite.sql.SqlSelect.validate(SqlSelect.java:216)\n\tat org.apache.calcite.sql.validate.SqlValidatorImpl.validateScopedExpression(SqlValidatorImpl.java:944)\n\tat org.apache.calcite.sql.validate.SqlValidatorImpl.validate(SqlValidatorImpl.java:651)\n\tat org.apache.drill.exec.planner.sql.conversion.SqlConverter.validate(SqlConverter.java:189)\n\tat org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.validateNode(DefaultSqlHandler.java:641)\n\tat org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.validateAndConvert(DefaultSqlHandler.java:195)\n\tat org.apache.drill.exec.planner.sql.handlers.DefaultSqlHandler.getPlan(DefaultSqlHandler.java:169)\n\tat org.apache.drill.exec.planner.sql.DrillSqlWorker.getQueryPlan(DrillSqlWorker.java:283)\n\tat org.apache.drill.exec.planner.sql.DrillSqlWorker.getPhysicalPlan(DrillSqlWorker.java:163)\n\tat org.apache.drill.exec.planner.sql.DrillSqlWorker.convertPlan(DrillSqlWorker.java:128)\n\tat org.apache.drill.exec.planner.sql.DrillSqlWorker.getPlan(DrillSqlWorker.java:93)\n\tat org.apache.drill.exec.work.foreman.Foreman.runSQL(Foreman.java:592)\n\tat org.apache.drill.exec.work.foreman.Foreman.run(Foreman.java:273)\n\tat .......(:0)\nCaused by: org.apache.calcite.sql.validate.SqlValidatorException: Object 'employee123321123321.json' not found within 'cp'\n\tat .......(:0)\n\tat org.apache.calcite.runtime.Resources$ExInstWithCause.ex(Resources.java:463)\n\tat org.apache.calcite.runtime.Resources$ExInst.ex(Resources.java:572)\n\t... 31 more\n",
       "queryState": "FAILED"
   }
   ```
   
   ## Documentation
   NA
   
   ## Testing
   Added unit tests and checked manually.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


> query.json returns an incorrect error message when the query fails
> ------------------------------------------------------------------
>
>                 Key: DRILL-7888
>                 URL: https://issues.apache.org/jira/browse/DRILL-7888
>             Project: Apache Drill
>          Issue Type: Bug
>    Affects Versions: 1.19.0
>            Reporter: Vova Vysotskyi
>            Assignee: Vova Vysotskyi
>            Priority: Major
>             Fix For: 1.19.0
>
>
> When submitting a query that should fail to \{{query.json}} endpoint, it always returns the same response regardless of the actual failure reason:
> {code:json}
> {
>     "errorMessage": "Current context not Array but root"
> }
> {code}



--
This message was sent by Atlassian Jira
(v8.3.4#803005)