damccorm commented on code in PR #35459:
URL: https://github.com/apache/beam/pull/35459#discussion_r2175530845


##########
sdks/python/apache_beam/io/avroio.py:
##########
@@ -554,7 +554,8 @@ def avro_union_type_to_beam_type(union_type: List) -> 
schema_pb2.FieldType:
   """
   if len(union_type) == 2 and "null" in union_type:
     for avro_type in union_type:
-      if avro_type in AVRO_PRIMITIVES_TO_BEAM_PRIMITIVES:
+      if isinstance(avro_type,

Review Comment:
   Ideally, I think this would resolve to an optional string. An improved fix 
might be to call `avro_type_to_beam_type` instead of returning a FieldType here
   
   
https://github.com/apache/beam/blob/dc9aabab0ff21eea6b5abf629ba699500dd81e5e/sdks/python/apache_beam/io/avroio.py#L559
   
   we would just need to pass through an additional `optional` field through 
that function to make things function well. 
   
   
https://github.com/apache/beam/blob/dc9aabab0ff21eea6b5abf629ba699500dd81e5e/sdks/python/apache_beam/io/avroio.py#L572-L574
   
   should take care of the rest at that point.
   
   With that said, this PR is an improvement over the current state of things. 
So @RRap0so if you don't want to do the work needed for that piece we can take 
it as a future improvement, just let me know what you would prefer



-- 
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: github-unsubscr...@beam.apache.org

For queries about this service, please contact Infrastructure at:
us...@infra.apache.org

Reply via email to