ahmedabu98 commented on code in PR #30770:
URL: https://github.com/apache/beam/pull/30770#discussion_r1561872345
##########
sdks/python/apache_beam/io/avroio.py:
##########
@@ -649,7 +684,11 @@ def beam_schema_to_avro_schema(
def beam_type_to_avro_type(beam_type: schema_pb2.FieldType) -> _AvroSchemaType:
type_info = beam_type.WhichOneof("type_info")
if type_info == "atomic_type":
- return {'type': BEAM_PRIMITIVES_TO_AVRO_PRIMITIVES[beam_type.atomic_type]}
+ avro_primitive = BEAM_PRIMITIVES_TO_AVRO_PRIMITIVES[beam_type.atomic_type]
+ if beam_type.nullable:
+ return ['null', avro_primitive]
Review Comment:
I'm just noticing the current implementation returns a dict like `{'type':
<type>}`. This change returns just the primitive, which may break existing
use-cases.
The conditionals following this one all return a dict with a `'type'` field
too, we should probably do the same here to have a consistent return value for
`beam_type_to_avro_type`
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]