[
https://issues.apache.org/jira/browse/DRILL-7888?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17311803#comment-17311803
]
ASF GitHub Bot commented on DRILL-7888:
---------------------------------------
vvysotskyi commented on a change in pull request #2194:
URL: https://github.com/apache/drill/pull/2194#discussion_r604409604
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/stream/StreamingHttpConnection.java
##########
@@ -219,12 +230,39 @@ private void emitRows(RowSetReader batchReader) throws
IOException {
*/
public void finish() throws IOException {
JsonOutput gen = writer.jsonOutput();
- gen.writeEndArray();
- writeNewline(gen);
+ if (batchCount == 0) {
+ startHeader();
+ if (options != null &&
+
Boolean.parseBoolean(options.get(ExecConstants.ENABLE_VERBOSE_ERRORS_KEY))) {
+ emitErrorInfo();
+ }
+ } else {
+ gen.writeEndArray();
+ writeNewline(gen);
+ }
gen.writeFieldName("queryState");
gen.writeVarChar(getQueryState());
writeNewline(gen);
gen.writeEndObject();
writeNewline(gen);
}
+
+ private void emitErrorInfo() throws IOException {
+ JsonOutput gen = writer.jsonOutput();
+ Throwable exception =
DrillExceptionUtil.getThrowable(error.getException());
+ if (exception != null) {
+ gen.writeFieldName("exception");
+ gen.writeVarChar(exception.getClass().getName());
+ writeNewline(gen);
+ gen.writeFieldName("errorMessage");
+ gen.writeVarChar(exception.getMessage());
+ writeNewline(gen);
+ gen.writeFieldName("stackTrace");
Review comment:
Good point, thanks, updated the code to pass stack trace items as a list.
##########
File path:
exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/stream/StreamingHttpConnection.java
##########
@@ -219,12 +230,39 @@ private void emitRows(RowSetReader batchReader) throws
IOException {
*/
public void finish() throws IOException {
JsonOutput gen = writer.jsonOutput();
- gen.writeEndArray();
- writeNewline(gen);
+ if (batchCount == 0) {
+ startHeader();
+ if (options != null &&
+
Boolean.parseBoolean(options.get(ExecConstants.ENABLE_VERBOSE_ERRORS_KEY))) {
Review comment:
Agree, thanks. Updated the code to use a new session option which also
can be passed in the query request.
--
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:
[email protected]
> 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)