Viranshul-P commented on code in PR #41736:
URL: https://github.com/apache/beam/pull/41736#discussion_r4753395705


##########
sdks/python/apache_beam/io/avroio.py:
##########
@@ -762,6 +783,14 @@ def beam_row_to_avro_dict(
 
 def beam_value_to_avro_value(
     beam_type: schema_pb2.FieldType) -> Callable[[Any], Any]:
+  convert = _beam_value_to_avro_value(beam_type)
+  if beam_type.nullable and beam_type.WhichOneof("type_info") != "atomic_type":
+    return lambda value: None if value is None else convert(value)
+  return convert
+
+
+def _beam_value_to_avro_value(
+    beam_type: schema_pb2.FieldType) -> Callable[[Any], Any]:

Review Comment:
   Thanks @jrmccluskey! The test imports Mapping and Sequence from 
`collections.abc`, and the return type of `unnest_primitive_type` has been 
added; both changes are in ee1ce106f78. On the public/private separation: the 
public function does the None check in one place, so the helper does not repeat 
it. I can combine them into one if you want. The one red check (ML 3.13, 
`test_run_inference_timeout_does_garbage_collection`) fails on master as well.
   



-- 
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]

Reply via email to