An application uses Avro schemas in AWS Glue Schema Registry; old and new producers and consumers must coexist during deployment. Existing fields must remain unchanged, and a new comment field must accept text but read as null when absent from older records; which schema change meets these requirements?
Show the answer
Correct answerA. Add comment as a null-or-string union with a null default.
AWhy this is right: New readers default the missing field to null, and old readers ignore the additional field.
BWhy not this: An empty-string default produces an empty string, not the required null, when reading older records.
CWhy not this: Allowing null does not provide a reader default for records whose writer schema lacks the field.
DWhy not this: Replacing an existing field violates the requirement to preserve existing fields and can break older readers.
A nullable union with a null default lets new readers supply null for older records, while old readers ignore the added field. A nullable union without a default permits null values but does not supply a missing field during schema resolution.