Skip to content
This repository was archived by the owner on Apr 1, 2026. It is now read-only.

Commit 2f67d9c

Browse files
committed
fix(dtypes): Propagate description in convert_to_schema_field for lists
1 parent 58a2f67 commit 2f67d9c

File tree

2 files changed

+13
-1
lines changed

2 files changed

+13
-1
lines changed

bigframes/dtypes.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -822,7 +822,11 @@ def convert_to_schema_field(
822822
)
823823
inner_field = convert_to_schema_field(name, inner_type, overrides)
824824
return google.cloud.bigquery.SchemaField(
825-
name, inner_field.field_type, mode="REPEATED", fields=inner_field.fields
825+
name,
826+
inner_field.field_type,
827+
mode="REPEATED",
828+
fields=inner_field.fields,
829+
description=inner_field.description,
826830
)
827831
if pa.types.is_struct(bigframes_dtype.pyarrow_dtype):
828832
inner_fields: list[google.cloud.bigquery.SchemaField] = []

tests/unit/test_dtypes.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,3 +71,11 @@ def test_infer_literal_type_arrow_scalar(scalar, expected_dtype):
7171
)
7272
def test_contains_db_dtypes_json_arrow_type(type_, expected):
7373
assert bigframes.dtypes.contains_db_dtypes_json_arrow_type(type_) == expected
74+
75+
76+
def test_convert_to_schema_field_list_description():
77+
bf_dtype = bigframes.dtypes.OBJ_REF_DTYPE
78+
list_bf_dtype = bigframes.dtypes.list_type(bf_dtype)
79+
field = bigframes.dtypes.convert_to_schema_field("my_list", list_bf_dtype)
80+
assert field.description == "bigframes_dtype: OBJ_REF_DTYPE"
81+
assert field.mode == "REPEATED"

0 commit comments

Comments
 (0)