use of com.facebook.presto.verifier.resolver.FailureResolverManager in project presto by prestodb.
the class VerificationFactory method get.
public Verification get(SourceQuery sourceQuery, Optional<VerificationContext> existingContext) {
QueryType queryType = QueryType.of(sqlParser.createStatement(sourceQuery.getQuery(CONTROL), PARSING_OPTIONS));
VerificationContext verificationContext = existingContext.map(VerificationContext::createForResubmission).orElseGet(() -> VerificationContext.create(sourceQuery.getName(), sourceQuery.getSuite()));
QueryActions queryActions = queryActionsFactory.create(sourceQuery, verificationContext);
if (verifierConfig.isExplain()) {
return new ExplainVerification(queryActions, sourceQuery, exceptionClassifier, verificationContext, verifierConfig, sqlParser);
}
QueryRewriter queryRewriter = queryRewriterFactory.create(queryActions.getHelperAction());
switch(queryType) {
case CREATE_TABLE_AS_SELECT:
case INSERT:
case QUERY:
DeterminismAnalyzer determinismAnalyzer = new DeterminismAnalyzer(sourceQuery, queryActions.getHelperAction(), queryRewriter, checksumValidator, typeManager, determinismAnalyzerConfig);
FailureResolverManager failureResolverManager = failureResolverManagerFactory.create(new FailureResolverFactoryContext(sqlParser, queryActions.getHelperAction()));
return new DataVerification(queryActions, sourceQuery, queryRewriter, determinismAnalyzer, failureResolverManager, exceptionClassifier, verificationContext, verifierConfig, typeManager, checksumValidator);
case CREATE_VIEW:
return new CreateViewVerification(sqlParser, queryActions, sourceQuery, queryRewriter, exceptionClassifier, verificationContext, verifierConfig);
case CREATE_TABLE:
return new CreateTableVerification(sqlParser, queryActions, sourceQuery, queryRewriter, exceptionClassifier, verificationContext, verifierConfig);
default:
throw new IllegalStateException(format("Unsupported query type: %s", queryType));
}
}
Aggregations