String fieldName = entry.getKey();
if (!actualFields.contains(fieldName)) { // an unset field
Field f = entry.getValue();
JsonNode json = f.defaultValue();
if (json != null) // has default
addField(record, fieldName, f.pos(), // add default
defaultFieldValue(old, f.schema(), json));
else if (old != null) // remove stale value
removeField(record, fieldName, entry.getValue().pos());
}
}