diff --git a/bigframes/functions/function_typing.py b/bigframes/functions/function_typing.py index f2fa794456..44ee071001 100644 --- a/bigframes/functions/function_typing.py +++ b/bigframes/functions/function_typing.py @@ -61,7 +61,8 @@ def __init__(self, type_, supported_types): self.type = type_ self.supported_types = supported_types super().__init__( - f"'{type_}' is not one of the supported types {supported_types}" + f"'{type_}' must be one of the supported types ({supported_types}) " + "or a list of one of those types." ) diff --git a/tests/system/small/functions/test_remote_function.py b/tests/system/small/functions/test_remote_function.py index d5d8b29786..86076e764f 100644 --- a/tests/system/small/functions/test_remote_function.py +++ b/tests/system/small/functions/test_remote_function.py @@ -15,6 +15,7 @@ import inspect import re import textwrap +from typing import Sequence import bigframes_vendored.constants as constants import google.api_core.exceptions @@ -1642,3 +1643,29 @@ def processor(x: int, y: int, z: float, w: str) -> str: df = scalars_df_index[["int64_col", "int64_too", "float64_col", "string_col"]] df1 = df.assign(combined=df.apply(processor, axis=1)) repr(df1) + + +@pytest.mark.flaky(retries=2, delay=120) +def test_remote_function_unsupported_type( + session, + dataset_id_permanent, + bq_cf_connection, +): + # Remote functions do not support tuple return types. + def func_tuple(x): + return (x, x, x) + + with pytest.raises( + ValueError, + match=r"'typing\.Sequence\[int\]' must be one of the supported types", + ): + bff.remote_function( + input_types=int, + output_type=Sequence[int], + session=session, + dataset=dataset_id_permanent, + bigquery_connection=bq_cf_connection, + reuse=True, + name=get_function_name(func_tuple), + cloud_function_service_account="default", + )(func_tuple)