Skip to content

Commit 3ba1395

Browse files
committed
fix presubmit
1 parent 00e814c commit 3ba1395

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

bigframes/series.py

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

0 commit comments

Comments
 (0)