Program: 111782
Project: 111782
Buggy source:
/** 
 * Ensures that extended columns that have the same name as a base column also have the same data-type.
 */
private void checkExtendedColumnTypes(SqlNodeList extendList){
  final List<RelDataTypeField> extendedFields=SqlValidatorUtil.getExtendedColumns(validator.getTypeFactory(),table,extendList);
  final List<RelDataTypeField> baseFields=getBaseRowType().getFieldList();
  final Map<String,Integer> nameToIndex=SqlValidatorUtil.mapNameToIndex(baseFields);
  for (  final RelDataTypeField extendedField : extendedFields) {
    final String extFieldName=extendedField.getName();
    if (nameToIndex.containsKey(extFieldName)) {
      final Integer baseIndex=nameToIndex.get(extFieldName);
      final RelDataType baseType=baseFields.get(baseIndex).getType();
      final RelDataType extType=extendedField.getType();
      if (!extType.equals(baseType)) {
        final Predicate<SqlNode> nameMatches=new Predicate<SqlNode>(){
          @Override public boolean apply(          SqlNode sqlNode){
            if (sqlNode instanceof SqlIdentifier) {
              final SqlIdentifier identifier=(SqlIdentifier)sqlNode;
              return Util.last(identifier.names).equals(extendedField.getName());
            }
            return false;
          }
        }
;
        final SqlNode extColNode=Iterables.find(extendList.getList(),nameMatches);
        throw validator.getValidationErrorFunction().apply(extColNode,RESOURCE.typeNotAssignable(baseFields.get(baseIndex).getName(),baseType.getFullTypeString(),extendedField.getName(),extType.getFullTypeString()));
      }
    }
  }
}

Fixed version (ground truth):
/** 
 * Ensures that extended columns that have the same name as a base column also have the same data-type.
 */
private void checkExtendedColumnTypes(SqlNodeList extendList){
  final List<RelDataTypeField> extendedFields=SqlValidatorUtil.getExtendedColumns(validator.getTypeFactory(),table,extendList);
  final List<RelDataTypeField> baseFields=getBaseRowType().getFieldList();
  final Map<String,Integer> nameToIndex=SqlValidatorUtil.mapNameToIndex(baseFields);
  for (  final RelDataTypeField extendedField : extendedFields) {
    final String extFieldName=extendedField.getName();
    if (nameToIndex.containsKey(extFieldName)) {
      final Integer baseIndex=nameToIndex.get(extFieldName);
      final RelDataType baseType=baseFields.get(baseIndex).getType();
      final RelDataType extType=extendedField.getType();
      if (!extType.equals(baseType)) {
        final Predicate<SqlNode> nameMatches=new PredicateImpl<SqlNode>(){
          @Override public boolean test(          SqlNode sqlNode){
            if (sqlNode instanceof SqlIdentifier) {
              final SqlIdentifier identifier=(SqlIdentifier)sqlNode;
              return Util.last(identifier.names).equals(extendedField.getName());
            }
            return false;
          }
        }
;
        final SqlNode extColNode=Iterables.find(extendList.getList(),nameMatches);
        throw validator.getValidationErrorFunction().apply(extColNode,RESOURCE.typeNotAssignable(baseFields.get(baseIndex).getName(),baseType.getFullTypeString(),extendedField.getName(),extType.getFullTypeString()));
      }
    }
  }
}