diff --git a/presto-main/src/main/java/com/facebook/presto/execution/QueryInfo.java b/presto-main/src/main/java/com/facebook/presto/execution/QueryInfo.java index bb74e716810e..51effd86400d 100644 --- a/presto-main/src/main/java/com/facebook/presto/execution/QueryInfo.java +++ b/presto-main/src/main/java/com/facebook/presto/execution/QueryInfo.java @@ -16,6 +16,7 @@ import com.facebook.presto.Session; import com.facebook.presto.client.FailureInfo; import com.facebook.presto.spi.ErrorCode; +import com.facebook.presto.spi.StandardErrorCode.ErrorType; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import com.google.common.base.Preconditions; @@ -31,6 +32,7 @@ import java.util.Map; import java.util.Set; +import static com.facebook.presto.spi.StandardErrorCode.toErrorType; import static com.google.common.base.MoreObjects.toStringHelper; @Immutable @@ -48,6 +50,7 @@ public class QueryInfo private final Set resetSessionProperties; private final StageInfo outputStage; private final FailureInfo failureInfo; + private final ErrorType errorType; private final ErrorCode errorCode; private final Set inputs; @@ -91,16 +94,11 @@ public QueryInfo( this.resetSessionProperties = ImmutableSet.copyOf(resetSessionProperties); this.outputStage = outputStage; this.failureInfo = failureInfo; + this.errorType = errorCode == null ? null : toErrorType(errorCode.getCode()); this.errorCode = errorCode; this.inputs = ImmutableSet.copyOf(inputs); } - @JsonProperty - public ErrorCode getErrorCode() - { - return errorCode; - } - @JsonProperty public QueryId getQueryId() { @@ -174,6 +172,20 @@ public FailureInfo getFailureInfo() return failureInfo; } + @Nullable + @JsonProperty + public ErrorType getErrorType() + { + return errorType; + } + + @Nullable + @JsonProperty + public ErrorCode getErrorCode() + { + return errorCode; + } + @JsonProperty public Set getInputs() { diff --git a/presto-main/src/main/java/com/facebook/presto/server/BasicQueryInfo.java b/presto-main/src/main/java/com/facebook/presto/server/BasicQueryInfo.java index 7dd0f365e72d..00f6e97f6ef6 100644 --- a/presto-main/src/main/java/com/facebook/presto/server/BasicQueryInfo.java +++ b/presto-main/src/main/java/com/facebook/presto/server/BasicQueryInfo.java @@ -17,11 +17,14 @@ import com.facebook.presto.execution.QueryId; import com.facebook.presto.execution.QueryInfo; import com.facebook.presto.execution.QueryState; +import com.facebook.presto.spi.ErrorCode; +import com.facebook.presto.spi.StandardErrorCode.ErrorType; import com.fasterxml.jackson.annotation.JsonCreator; import com.fasterxml.jackson.annotation.JsonProperty; import io.airlift.units.Duration; import org.joda.time.DateTime; +import javax.annotation.Nullable; import javax.annotation.concurrent.Immutable; import java.net.URI; @@ -36,6 +39,8 @@ public class BasicQueryInfo private final QueryId queryId; private final Session session; private final QueryState state; + private final ErrorType errorType; + private final ErrorCode errorCode; private final boolean scheduled; private final URI self; private final String query; @@ -52,6 +57,8 @@ public BasicQueryInfo( @JsonProperty("queryId") QueryId queryId, @JsonProperty("session") Session session, @JsonProperty("state") QueryState state, + @JsonProperty("errorType") ErrorType errorType, + @JsonProperty("errorCode") ErrorCode errorCode, @JsonProperty("scheduled") boolean scheduled, @JsonProperty("self") URI self, @JsonProperty("query") String query, @@ -67,6 +74,8 @@ public BasicQueryInfo( this.queryId = checkNotNull(queryId, "queryId is null"); this.session = checkNotNull(session, "session is null"); this.state = checkNotNull(state, "state is null"); + this.errorType = errorType; + this.errorCode = errorCode; this.scheduled = scheduled; this.self = checkNotNull(self, "self is null"); this.query = checkNotNull(query, "query is null"); @@ -89,6 +98,8 @@ public BasicQueryInfo(QueryInfo queryInfo) this(queryInfo.getQueryId(), queryInfo.getSession(), queryInfo.getState(), + queryInfo.getErrorType(), + queryInfo.getErrorCode(), queryInfo.isScheduled(), queryInfo.getSelf(), queryInfo.getQuery(), @@ -119,6 +130,20 @@ public QueryState getState() return state; } + @Nullable + @JsonProperty + public ErrorType getErrorType() + { + return errorType; + } + + @Nullable + @JsonProperty + public ErrorCode getErrorCode() + { + return errorCode; + } + @JsonProperty public boolean isScheduled() { diff --git a/presto-main/src/main/resources/webapp/index.html b/presto-main/src/main/resources/webapp/index.html index d75af492acec..ca6b02f67fdf 100644 --- a/presto-main/src/main/resources/webapp/index.html +++ b/presto-main/src/main/resources/webapp/index.html @@ -49,6 +49,7 @@

Presto

Source User State + Error Done Total Completion @@ -128,6 +129,7 @@

Presto

queryInfo.session.source, queryInfo.session.user, queryInfo.state, + shortErrorType(queryInfo.errorType), completedSplits, splits, d3.format("%")(splits == 0 ? 0 : completedSplits / splits) @@ -216,6 +218,18 @@

Presto

return [stage].concat(flatten(substages)); } +function shortErrorType(errorType) +{ + switch (errorType) { + case "USER_ERROR": + return "USER"; + case "INTERNAL_ERROR": + return "INTERNAL"; + case "INSUFFICIENT_RESOURCES": + return "RESOURCES"; + } + return errorType; +} function flatten(array) { diff --git a/presto-main/src/main/resources/webapp/query.html b/presto-main/src/main/resources/webapp/query.html index 1611a12abd76..4e6e10207fa8 100644 --- a/presto-main/src/main/resources/webapp/query.html +++ b/presto-main/src/main/resources/webapp/query.html @@ -98,6 +98,12 @@

Summary

Kill
+
Error Type
+
+ +
Error Code
+
+
Message
@@ -170,6 +176,20 @@

Tasks

d3.select('#failureMessage').html(" "); } + if (query.errorType) { + d3.select('#errorType').text(query.errorType); + } + else { + d3.select('#errorType').html(" "); + } + + if (query.errorCode) { + d3.select('#errorCode').text(query.errorCode.name + " (" + query.errorCode.code + ")"); + } + else { + d3.select('#errorCode').html(" "); + } + var sessionPropertiesList = d3.select('#sessionProperties').append("ul"); for (property in query.session.systemProperties) {