This is an automated email from the ASF dual-hosted git repository.
sorabh pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/drill.git
The following commit(s) were added to refs/heads/master by this push:
new e3534b6 DRILL-6591: Show Exception for failed queries submitted in
WebUI
e3534b6 is described below
commit e3534b6a9f1369a355d250a9e915ee40bca17444
Author: Kunal Khatua <[email protected]>
AuthorDate: Fri Jul 13 15:21:14 2018 -0700
DRILL-6591: Show Exception for failed queries submitted in WebUI
* DRILL-6591: Show Exception for failed queries submitted in WebUI
When query fails on Web UI result page no error is shown, only "No result
found."
This was because DRILL-6477 (PR #1309) switched to
`WebUserConnection.await(long timeoutInMillis)` . Unlike the original
`WebUserConnection.await()`, this method did not throw any UserException
generated by a query failure. The fix was to use WebUserConnection.getError()
method to know about failure of the query and throw UserRemoteException with
that.
closes #1379
---
.../drill/exec/server/rest/QueryWrapper.java | 31 +++++++++++-----------
1 file changed, 16 insertions(+), 15 deletions(-)
diff --git
a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryWrapper.java
b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryWrapper.java
index cf74937..1dac0db 100644
---
a/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryWrapper.java
+++
b/exec/java-exec/src/main/java/org/apache/drill/exec/server/rest/QueryWrapper.java
@@ -22,6 +22,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.Maps;
import org.apache.drill.common.exceptions.UserException;
+import org.apache.drill.common.exceptions.UserRemoteException;
import org.apache.drill.exec.proto.UserBitShared.QueryId;
import org.apache.drill.exec.proto.UserBitShared.QueryResult.QueryState;
import org.apache.drill.exec.proto.UserBitShared.QueryType;
@@ -86,9 +87,8 @@ public class QueryWrapper {
logger.debug("Wait until the query execution is complete or there is error
submitting the query");
do {
try {
- isComplete = webUserConnection.await(TimeUnit.SECONDS.toMillis(1));
/*periodically timeout to check heap*/
- } catch (Exception e) { }
-
+ isComplete = webUserConnection.await(TimeUnit.SECONDS.toMillis(1));
//periodically timeout 1 sec to check heap
+ } catch (InterruptedException e) {}
usagePercent = getHeapUsage();
if (usagePercent > HEAP_MEMORY_FAILURE_THRESHOLD) {
nearlyOutOfHeapSpace = true;
@@ -97,21 +97,22 @@ public class QueryWrapper {
//Fail if nearly out of heap space
if (nearlyOutOfHeapSpace) {
+ UserException almostOutOfHeapException = UserException.resourceError()
+ .message("There is not enough heap memory to run this query using
the web interface. ")
+ .addContext("Please try a query with fewer columns or with a filter
or limit condition to limit the data returned. ")
+ .addContext("You can also try an ODBC/JDBC client. ")
+ .build(logger);
+ //Add event
workManager.getBee().getForemanForQueryId(queryId)
- .addToEventQueue(QueryState.FAILED,
- UserException.resourceError(
- new Throwable(
- "There is not enough heap memory to run this query using
the web interface. "
- + "Please try a query with fewer columns or with a filter
or limit condition to limit the data returned. "
- + "You can also try an ODBC/JDBC client. "
- )
- )
- .build(logger)
- );
+ .addToEventQueue(QueryState.FAILED, almostOutOfHeapException);
+ //Return NearlyOutOfHeap exception
+ throw almostOutOfHeapException;
}
- if (logger.isTraceEnabled()) {
- logger.trace("Query {} is completed ", queryId);
+ logger.trace("Query {} is completed ", queryId);
+
+ if (webUserConnection.getError() != null) {
+ throw new UserRemoteException(webUserConnection.getError());
}
if (webUserConnection.results.isEmpty()) {