Skip to content

Commit 0b34402

Browse files
authored
chore: materialize result of remote_function early (#408)
Thank you for opening a Pull Request! Before submitting your PR, there are a few things you can do to make sure it goes smoothly: - [ ] Make sure to open an issue as a [bug/issue](https://togithub.com/googleapis/python-bigquery-dataframes/issues/new/choose) before writing your code! That way we can discuss the change, evaluate designs, and agree on the general idea - [ ] Ensure the tests and linter pass - [ ] Code coverage does not decrease (if any source code was changed) - [ ] Appropriate docs were updated (if necessary) Fixes internal issue 327662690 🦕
1 parent 31325a1 commit 0b34402

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

bigframes/series.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1253,11 +1253,17 @@ def apply(
12531253
ex.message += f"\n{_remote_function_recommendation_message}"
12541254
raise
12551255

1256+
# We are working with remote function at this point
12561257
reprojected_series = Series(self._block._force_reproject())
1257-
return reprojected_series._apply_unary_op(
1258+
result_series = reprojected_series._apply_unary_op(
12581259
ops.RemoteFunctionOp(func=func, apply_on_null=True)
12591260
)
12601261

1262+
# return Series with materialized result so that any error in the remote
1263+
# function is caught early
1264+
materialized_series = result_series._cached()
1265+
return materialized_series
1266+
12611267
def add_prefix(self, prefix: str, axis: int | str | None = None) -> Series:
12621268
return Series(self._get_block().add_prefix(prefix))
12631269

0 commit comments

Comments
 (0)