robertwb commented on code in PR #35288:
URL: https://github.com/apache/beam/pull/35288#discussion_r2151073795


##########
sdks/python/apache_beam/yaml/json_utils.py:
##########
@@ -172,26 +172,34 @@ def json_to_row(beam_type: schema_pb2.FieldType) -> 
Callable[[Any], Any]:
     return lambda value: value
   elif type_info == "array_type":
     element_converter = json_to_row(beam_type.array_type.element_type)
-    return lambda value: [element_converter(e) for e in value]
+    return lambda value: [
+        element_converter(e) for e in value

Review Comment:
   Rather than modify each of these cases, I would think that element_converter 
should accept None for if (and only if) it is a nullable type. 
   
   This is probably mostly easily done by putting a case a the top of this 
function like
   
   ```
   if beam_type.nullable:
     non_null_converer = json_to_row(schema_pb2.FieldType(type_info=beam_type, 
nullable=False))
     return lambda e: None if e is None else non_null_converer(e)
   ```



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