use of org.apache.calcite.sql.test.SqlTesterImpl in project calcite by apache.
the class SqlValidatorUtilTest method testCheckingDuplicatesWithCompoundIdentifiers.
@SuppressWarnings("resource")
@Test
public void testCheckingDuplicatesWithCompoundIdentifiers() {
final List<SqlNode> newList = new ArrayList<>(2);
newList.add(new SqlIdentifier(Arrays.asList("f0", "c0"), SqlParserPos.ZERO));
newList.add(new SqlIdentifier(Arrays.asList("f0", "c0"), SqlParserPos.ZERO));
final SqlTesterImpl tester = new SqlTesterImpl(DefaultSqlTestFactory.INSTANCE);
final SqlValidatorImpl validator = (SqlValidatorImpl) tester.getValidator();
try {
SqlValidatorUtil.checkIdentifierListForDuplicates(newList, validator.getValidationErrorFunction());
fail("expected exception");
} catch (CalciteContextException e) {
// ok
}
// should not throw
newList.set(1, new SqlIdentifier(Arrays.asList("f0", "c1"), SqlParserPos.ZERO));
SqlValidatorUtil.checkIdentifierListForDuplicates(newList, null);
}
Aggregations