use of com.facebook.presto.verifier.framework.VerifierUtil.PARSING_OPTIONS in project presto by prestodb.
the class DdlVerification method verify.
@Override
@SuppressWarnings("unchecked")
protected DdlMatchResult verify(QueryObjectBundle control, QueryObjectBundle test, Optional<QueryResult<Void>> controlQueryResult, Optional<QueryResult<Void>> testQueryResult, ChecksumQueryContext controlChecksumQueryContext, ChecksumQueryContext testChecksumQueryContext) {
Statement controlChecksumQuery = getChecksumQuery(control);
Statement testChecksumQuery = getChecksumQuery(test);
controlChecksumQueryContext.setChecksumQuery(formatSql(controlChecksumQuery));
testChecksumQueryContext.setChecksumQuery(formatSql(testChecksumQuery));
String controlChecksum = getOnlyElement(callAndConsume(() -> getHelperAction().execute(controlChecksumQuery, CONTROL_CHECKSUM, checksumConverter), stats -> stats.getQueryStats().map(QueryStats::getQueryId).ifPresent(controlChecksumQueryContext::setChecksumQueryId)).getResults());
String testChecksum = getOnlyElement(callAndConsume(() -> getHelperAction().execute(testChecksumQuery, TEST_CHECKSUM, checksumConverter), stats -> stats.getQueryStats().map(QueryStats::getQueryId).ifPresent(testChecksumQueryContext::setChecksumQueryId)).getResults());
S controlObject;
S testObject;
try {
controlObject = (S) sqlParser.createStatement(controlChecksum, PARSING_OPTIONS);
} catch (ParsingException e) {
return new DdlMatchResult(CONTROL_NOT_PARSABLE, Optional.of(e), controlChecksum, testChecksum);
}
try {
testObject = (S) sqlParser.createStatement(testChecksum, PARSING_OPTIONS);
} catch (ParsingException e) {
return new DdlMatchResult(TEST_NOT_PARSABLE, Optional.of(e), controlChecksum, testChecksum);
}
return new DdlMatchResult(match(controlObject, testObject, control, test) ? MATCH : MISMATCH, Optional.empty(), controlChecksum, testChecksum);
}
Aggregations