Field field = schema.getField(fieldName);
if (field == null) {
throw new SchemaValidationException("No field named " + fieldName
+ " in schema " + schema);
}
Object fieldValue = entity.get(field.pos());
if (fieldValue == null) {
// if the field value is null, and the field is a primitive type,
// we should make the field represent java's default type. This
// can happen when using GenericRecord. SpecificRecord has it's
// fields represented by members of a class, so a SpecificRecord's