final List<SqlNode> identifierList = Util.quotientList(extendList.getList(), 2, 0); SqlValidatorUtil.checkIdentifierListForDuplicates( identifierList, validator.getValidationErrorFunction()); final ImmutableList.Builder<RelDataTypeField> builder = ImmutableList.builder();
final List<SqlNode> identifierList = Util.quotientList(extendList.getList(), 2, 0); SqlValidatorUtil.checkIdentifierListForDuplicates( identifierList, validator.getValidationErrorFunction()); final ImmutableList.Builder<RelDataTypeField> builder = ImmutableList.builder();
extendedField.getName())); throw validator.getValidationErrorFunction().apply(extColNode, RESOURCE.typeNotAssignable( baseFields.get(baseIndex).getName(), baseType.getFullTypeString(),
extendedField.getName())); throw validator.getValidationErrorFunction().apply(extColNode, RESOURCE.typeNotAssignable( baseFields.get(baseIndex).getName(), baseType.getFullTypeString(),
@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 SqlTester tester = new SqlValidatorTester(SqlTestFactory.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); }
@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 SqlTester tester = new SqlValidatorTester(SqlTestFactory.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); }