We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 00e814c commit 3ba1395Copy full SHA for 3ba1395
bigframes/series.py
@@ -608,6 +608,15 @@ def astype(
608
if errors not in ["raise", "null"]:
609
raise ValueError("Argument 'errors' must be one of 'raise' or 'null'")
610
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
620
return self._apply_unary_op(
621
bigframes.operations.AsTypeOp(to_type=dtype, safe=(errors == "null"))
622
)
0 commit comments