Aditya Toomula created SAMZA-2347:
-------------------------------------
Summary: Samza-sql: Fix AvroTypeFactoryImpl to properly denote a
field as optional and nullable.
Key: SAMZA-2347
URL: https://issues.apache.org/jira/browse/SAMZA-2347
Project: Samza
Issue Type: Bug
Reporter: Aditya Toomula
Assignee: Aditya Toomula
* Nullable fields in avro are of type union with one of the values being null.
* Fields with default values are optional ONLY while reading. Default values are
* meant for schema evolution where reader schema is different from writer
schema.
* Please note here that even the fields with default values MUST be specified at
* the time of serialization.
*
* Behavior on the consumption side:
* While reading, the fields that are not written will be filled with default
values
* that are specified in the reader schema. Please note that this happens only
when
* the field with default value is not present in writer schema but is present in
* reader schema.
*
* Behavior on the producer side:
* All non-nullable avro fields should have values including fields with default
values.
* Nullable fields need not be explicitly set as they are set at the time of
serialization.
*
* So, all nullable fields are optional fields on the producer side in Avro.
* \{@link AvroTypeFactoryImpl} reflects the state of fields on the producer
side.
*
* Note: There could be cases where the producer might embed some fields, in
which case
* a non-nullable field is considered optional.
--
This message was sent by Atlassian Jira
(v8.3.4#803005)