allisonwang-db commented on code in PR #42161:
URL: https://github.com/apache/spark/pull/42161#discussion_r1275479798
##########
python/pyspark/sql/connect/types.py:
##########
@@ -170,14 +170,16 @@ def pyspark_types_to_proto_types(data_type: DataType) ->
pb2.DataType:
ret.year_month_interval.start_field = data_type.startField
ret.year_month_interval.end_field = data_type.endField
elif isinstance(data_type, StructType):
+ struct = pb2.DataType.Struct()
for field in data_type.fields:
struct_field = pb2.DataType.StructField()
struct_field.name = field.name
struct_field.data_type.CopyFrom(pyspark_types_to_proto_types(field.dataType))
struct_field.nullable = field.nullable
if field.metadata is not None and len(field.metadata) > 0:
struct_field.metadata = json.dumps(field.metadata)
- ret.struct.fields.append(struct_field)
+ struct.fields.append(struct_field)
+ ret.struct.CopyFrom(struct)
Review Comment:
Good catch!
--
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]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]