paul-rogers commented on a change in pull request #2194:
URL: https://github.com/apache/drill/pull/2194#discussion_r603747584
##########
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:
Do we want to reuse the rather verbose key here? It might be confusing
as I would think, from the name, that I can also get the new behavior by
setting the given config item.
In fact, I think we have a way to pass session options in a JSON query.
Would it be better to simply use that mechanism here? Check if a new
"drill.rest.errors.verbose" (or some such) option is set? This would let a site
set the option by default, and would allow a future version of Drill make the
verbose option the default.
Otherwise, if we want to add the one-off options here, maybe use short names
such as "verbose". Someone might add a "schema-first" option to export the
schema before the data to avoid client-side buffering.
##########
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:
Stack traces are generally very large. Do you want to a) represent the
items as a list, or b) prune away the uninteresting top-level bits?
--
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]