Skip to content

Commit e937a9e

Browse files
committed
fix the bug for test_blob_image_*_to series and to_folder
1 parent db85c82 commit e937a9e

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

bigframes/operations/blob.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,15 @@ def metadata(self) -> bigframes.series.Series:
8282
bigframes.series.Series: JSON metadata of the Blob. Contains fields: content_type, md5_hash, size and updated(time)."""
8383
series_to_check = bigframes.series.Series(self._block)
8484
# Check if it's a struct series from a verbose operation
85-
if (
86-
dtypes.is_struct_like(series_to_check.dtype)
87-
and "content" in series_to_check.dtype.names
88-
and dtypes.is_blob_like(series_to_check.dtype.field("content").dtype)
89-
):
90-
series_to_check = series_to_check.struct.field("content")
85+
if dtypes.is_struct_like(series_to_check.dtype):
86+
pyarrow_dtype = series_to_check.dtype.pyarrow_dtype
87+
if "content" in pyarrow_dtype.names:
88+
content_field_type = pyarrow_dtype.field("content").type
89+
content_bf_type = dtypes.arrow_dtype_to_bigframes_dtype(
90+
content_field_type
91+
)
92+
if content_bf_type == dtypes.OBJ_REF_DTYPE:
93+
series_to_check = series_to_check.struct.field("content")
9194
details_json = series_to_check._apply_unary_op(
9295
ops.obj_fetch_metadata_op
9396
).struct.field("details")

0 commit comments

Comments
 (0)