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

Commit faf1bb2

Browse files
committed
fix presubmit
1 parent 2adc426 commit faf1bb2

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

bigframes/series.py

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -609,6 +609,15 @@ def astype(
609609
if errors not in ["raise", "null"]:
610610
raise ValueError("Argument 'errors' must be one of 'raise' or 'null'")
611611
dtype = bigframes.dtypes.bigframes_type(dtype)
612+
613+
# BigQuery doesn't support CAST(json_col AS STRING), but it does support
614+
# TO_JSON_STRING(json_col).
615+
if (
616+
self.dtype == bigframes.dtypes.JSON_DTYPE
617+
and dtype == bigframes.dtypes.STRING_DTYPE
618+
):
619+
return self._apply_unary_op(ops.json_ops.ToJSONString())
620+
612621
return self._apply_unary_op(
613622
bigframes.operations.AsTypeOp(to_type=dtype, safe=(errors == "null"))
614623
)

0 commit comments

Comments
 (0)