Bird
Raised Fist0

Which of the following is a valid way to add a new optional field in an Avro schema to maintain forward compatibility?

easy📝 Syntax Q3 of Q15
Kafka - Schema Registry
Which of the following is a valid way to add a new optional field in an Avro schema to maintain forward compatibility?
A"newField": {"type": "string", "default": ""}
B"newField": "string"
C"newField": {"type": "int"}
D"newField": {"type": "string"}
Step-by-Step Solution
Solution:
  1. Step 1: Understand forward compatibility for adding fields

    Adding a new optional field requires a default value to keep old data readable.
  2. Step 2: Check options for default value

    Only "newField": {"type": "string", "default": ""} includes a default value for the new field, making it forward compatible.
  3. Final Answer:

    "newField": {"type": "string", "default": ""} -> Option A
  4. Quick Check:

    Forward compatible new field needs default value [OK]
Quick Trick: Add default value to new field for forward compatibility [OK]
Common Mistakes:
MISTAKES
  • Adding fields without default values
  • Confusing optional with required fields
  • Using wrong syntax for default

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Kafka Quizzes