Search in sources :

Example 1 with VerifierQueryEvent

use of com.facebook.presto.verifier.event.VerifierQueryEvent in project presto by prestodb.

the class AbstractVerification method concludeVerification.

private VerificationResult concludeVerification(PartialVerificationResult partialResult, Optional<B> control, Optional<B> test, Optional<QueryResult<V>> controlQueryResult, Optional<QueryResult<V>> testQueryResult, QueryContext controlQueryContext, QueryContext testQueryContext, Optional<R> matchResult, ChecksumQueryContext controlChecksumQueryContext, ChecksumQueryContext testChecksumQueryContext, Optional<DeterminismAnalysisDetails> determinismAnalysisDetails, Optional<Throwable> throwable) {
    Optional<String> errorCode = Optional.empty();
    Optional<String> errorMessage = Optional.empty();
    if (partialResult.getStatus() != SUCCEEDED) {
        errorCode = Optional.ofNullable(throwable.map(t -> t instanceof QueryException ? ((QueryException) t).getErrorCodeName() : INTERNAL_ERROR).orElse(matchResult.map(MatchResult::getMatchTypeName).orElse(null)));
        errorMessage = Optional.of(constructErrorMessage(throwable, matchResult, controlQueryContext.getState(), testQueryContext.getState()));
    }
    VerifierQueryEvent event = new VerifierQueryEvent(sourceQuery.getSuite(), testId, sourceQuery.getName(), partialResult.getStatus(), matchResult.map(MatchResult::getMatchTypeName), partialResult.getSkippedReason(), determinismAnalysisDetails, partialResult.getResolveMessage(), skipControl ? Optional.empty() : Optional.of(buildQueryInfo(sourceQuery.getControlConfiguration(), sourceQuery.getQuery(CONTROL), controlChecksumQueryContext, control, controlQueryContext, controlQueryResult)), buildQueryInfo(sourceQuery.getTestConfiguration(), sourceQuery.getQuery(TEST), testChecksumQueryContext, test, testQueryContext, testQueryResult), errorCode, errorMessage, throwable.filter(QueryException.class::isInstance).map(QueryException.class::cast).map(QueryException::toQueryFailure), verificationContext.getQueryFailures(), verificationContext.getResubmissionCount());
    return new VerificationResult(this, false, Optional.of(event));
}
Also used : CONTROL_QUERY_TIMED_OUT(com.facebook.presto.verifier.framework.SkippedReason.CONTROL_QUERY_TIMED_OUT) NOT_RUN(com.facebook.presto.verifier.framework.QueryState.NOT_RUN) TIMED_OUT(com.facebook.presto.verifier.framework.QueryState.TIMED_OUT) TEST_MAIN(com.facebook.presto.verifier.framework.QueryStage.TEST_MAIN) Strings.nullToEmpty(com.google.common.base.Strings.nullToEmpty) QueryActions(com.facebook.presto.verifier.prestoaction.QueryActions) CONTROL_MAIN(com.facebook.presto.verifier.framework.QueryStage.CONTROL_MAIN) VERIFIER_INTERNAL_ERROR(com.facebook.presto.verifier.framework.SkippedReason.VERIFIER_INTERNAL_ERROR) FAILED_RESOLVED(com.facebook.presto.verifier.event.VerifierQueryEvent.EventStatus.FAILED_RESOLVED) VerifierUtil.callAndConsume(com.facebook.presto.verifier.framework.VerifierUtil.callAndConsume) Preconditions.checkArgument(com.google.common.base.Preconditions.checkArgument) ImmutableList(com.google.common.collect.ImmutableList) FAILED_BEFORE_CONTROL_QUERY(com.facebook.presto.verifier.framework.SkippedReason.FAILED_BEFORE_CONTROL_QUERY) Objects.requireNonNull(java.util.Objects.requireNonNull) TEST_SETUP(com.facebook.presto.verifier.framework.QueryStage.TEST_SETUP) QueryStats(com.facebook.presto.jdbc.QueryStats) SUCCEEDED(com.facebook.presto.verifier.event.VerifierQueryEvent.EventStatus.SUCCEEDED) EXCEEDED_TIME_LIMIT(com.facebook.presto.spi.StandardErrorCode.EXCEEDED_TIME_LIMIT) VerifierQueryEvent(com.facebook.presto.verifier.event.VerifierQueryEvent) CONTROL_SETUP_QUERY_FAILED(com.facebook.presto.verifier.framework.SkippedReason.CONTROL_SETUP_QUERY_FAILED) SqlFormatter(com.facebook.presto.sql.SqlFormatter) QueryInfo(com.facebook.presto.verifier.event.QueryInfo) DataVerificationUtil.teardownSafely(com.facebook.presto.verifier.framework.DataVerificationUtil.teardownSafely) QueryAction(com.facebook.presto.verifier.prestoaction.QueryAction) FAILED_TO_SETUP(com.facebook.presto.verifier.framework.QueryState.FAILED_TO_SETUP) QueryActionStats(com.facebook.presto.verifier.prestoaction.QueryActionStats) ImmutableList.toImmutableList(com.google.common.collect.ImmutableList.toImmutableList) TEST(com.facebook.presto.verifier.framework.ClusterType.TEST) CONTROL(com.facebook.presto.verifier.framework.ClusterType.CONTROL) SKIPPED(com.facebook.presto.verifier.event.VerifierQueryEvent.EventStatus.SKIPPED) EventStatus(com.facebook.presto.verifier.event.VerifierQueryEvent.EventStatus) ResultSetConverter(com.facebook.presto.verifier.prestoaction.PrestoAction.ResultSetConverter) CONTROL_QUERY_FAILED(com.facebook.presto.verifier.framework.SkippedReason.CONTROL_QUERY_FAILED) String.format(java.lang.String.format) Preconditions.checkState(com.google.common.base.Preconditions.checkState) Throwables.getStackTraceAsString(com.google.common.base.Throwables.getStackTraceAsString) DeterminismAnalysisDetails(com.facebook.presto.verifier.event.DeterminismAnalysisDetails) SqlExceptionClassifier(com.facebook.presto.verifier.prestoaction.SqlExceptionClassifier) List(java.util.List) NON_DETERMINISTIC(com.facebook.presto.verifier.framework.SkippedReason.NON_DETERMINISTIC) VerifierUtil.runAndConsume(com.facebook.presto.verifier.framework.VerifierUtil.runAndConsume) PrestoAction(com.facebook.presto.verifier.prestoaction.PrestoAction) Optional(java.util.Optional) FAILED(com.facebook.presto.verifier.event.VerifierQueryEvent.EventStatus.FAILED) CONTROL_SETUP(com.facebook.presto.verifier.framework.QueryStage.CONTROL_SETUP) Statement(com.facebook.presto.sql.tree.Statement) VerifierQueryEvent(com.facebook.presto.verifier.event.VerifierQueryEvent) Throwables.getStackTraceAsString(com.google.common.base.Throwables.getStackTraceAsString)

Aggregations

QueryStats (com.facebook.presto.jdbc.QueryStats)1 EXCEEDED_TIME_LIMIT (com.facebook.presto.spi.StandardErrorCode.EXCEEDED_TIME_LIMIT)1 SqlFormatter (com.facebook.presto.sql.SqlFormatter)1 Statement (com.facebook.presto.sql.tree.Statement)1 DeterminismAnalysisDetails (com.facebook.presto.verifier.event.DeterminismAnalysisDetails)1 QueryInfo (com.facebook.presto.verifier.event.QueryInfo)1 VerifierQueryEvent (com.facebook.presto.verifier.event.VerifierQueryEvent)1 EventStatus (com.facebook.presto.verifier.event.VerifierQueryEvent.EventStatus)1 FAILED (com.facebook.presto.verifier.event.VerifierQueryEvent.EventStatus.FAILED)1 FAILED_RESOLVED (com.facebook.presto.verifier.event.VerifierQueryEvent.EventStatus.FAILED_RESOLVED)1 SKIPPED (com.facebook.presto.verifier.event.VerifierQueryEvent.EventStatus.SKIPPED)1 SUCCEEDED (com.facebook.presto.verifier.event.VerifierQueryEvent.EventStatus.SUCCEEDED)1 CONTROL (com.facebook.presto.verifier.framework.ClusterType.CONTROL)1 TEST (com.facebook.presto.verifier.framework.ClusterType.TEST)1 DataVerificationUtil.teardownSafely (com.facebook.presto.verifier.framework.DataVerificationUtil.teardownSafely)1 CONTROL_MAIN (com.facebook.presto.verifier.framework.QueryStage.CONTROL_MAIN)1 CONTROL_SETUP (com.facebook.presto.verifier.framework.QueryStage.CONTROL_SETUP)1 TEST_MAIN (com.facebook.presto.verifier.framework.QueryStage.TEST_MAIN)1 TEST_SETUP (com.facebook.presto.verifier.framework.QueryStage.TEST_SETUP)1 FAILED_TO_SETUP (com.facebook.presto.verifier.framework.QueryState.FAILED_TO_SETUP)1