Search in sources :

Example 1 with QueryOutputInfo

use of io.prestosql.execution.QueryExecution.QueryOutputInfo in project hetu-core by openlookeng.

the class QueryStateMachine method getQueryInfo.

@VisibleForTesting
QueryInfo getQueryInfo(Optional<StageInfo> rootStage) {
    // Query state must be captured first in order to provide a
    // correct view of the query.  For example, building this
    // information, the query could finish, and the task states would
    // never be visible.
    QueryState state = queryState.get();
    ExecutionFailureInfo localFailureCause = null;
    ErrorCode errorCode = null;
    if (state == FAILED) {
        localFailureCause = this.failureCause.get();
        if (localFailureCause != null) {
            errorCode = localFailureCause.getErrorCode();
        }
    }
    boolean completeInfo = getAllStages(rootStage).stream().allMatch(StageInfo::isCompleteInfo);
    boolean isScheduled = isScheduled(rootStage);
    return new QueryInfo(queryId, session.toSessionRepresentation(), state, memoryPool.get().getId(), isScheduled, self, outputManager.getQueryOutputInfo().map(QueryOutputInfo::getColumnNames).orElse(ImmutableList.of()), query, preparedQuery, getQueryStats(rootStage), Optional.ofNullable(setCatalog.get()), Optional.ofNullable(setSchema.get()), Optional.ofNullable(setPath.get()), setSessionProperties, resetSessionProperties, setRoles, addedPreparedStatements, deallocatedPreparedStatements, Optional.ofNullable(startedTransactionId.get()), clearTransactionId.get(), updateType.get(), rootStage, localFailureCause, errorCode, warningCollector.getWarnings(), inputs.get(), output.get(), completeInfo, Optional.of(resourceGroup), isRunningAsync.get());
}
Also used : QueryOutputInfo(io.prestosql.execution.QueryExecution.QueryOutputInfo) ErrorCode(io.prestosql.spi.ErrorCode) BasicQueryInfo(io.prestosql.server.BasicQueryInfo) VisibleForTesting(com.google.common.annotations.VisibleForTesting)

Aggregations

VisibleForTesting (com.google.common.annotations.VisibleForTesting)1 QueryOutputInfo (io.prestosql.execution.QueryExecution.QueryOutputInfo)1 BasicQueryInfo (io.prestosql.server.BasicQueryInfo)1 ErrorCode (io.prestosql.spi.ErrorCode)1