|
24 | 24 | import sys |
25 | 25 | import tempfile |
26 | 26 | import textwrap |
27 | | -from typing import List, NamedTuple, Optional, Sequence, TYPE_CHECKING |
| 27 | +from typing import List, NamedTuple, Optional, Sequence, TYPE_CHECKING, Union |
28 | 28 |
|
29 | 29 | import ibis |
30 | 30 | import requests |
@@ -623,7 +623,7 @@ def get_routine_reference( |
623 | 623 | # which has moved as @js to the ibis package |
624 | 624 | # https://github.com/ibis-project/ibis/blob/master/ibis/backends/bigquery/udf/__init__.py |
625 | 625 | def remote_function( |
626 | | - input_types: Sequence[type], |
| 626 | + input_types: Union[type, Sequence[type]], |
627 | 627 | output_type: type, |
628 | 628 | session: Optional[Session] = None, |
629 | 629 | bigquery_client: Optional[bigquery.Client] = None, |
@@ -686,9 +686,10 @@ def remote_function( |
686 | 686 | `$ gcloud projects add-iam-policy-binding PROJECT_ID --member="serviceAccount:CONNECTION_SERVICE_ACCOUNT_ID" --role="roles/run.invoker"`. |
687 | 687 |
|
688 | 688 | Args: |
689 | | - input_types list(type): |
690 | | - List of input data types in the user defined function. |
691 | | - output_type type: |
| 689 | + input_types (type or sequence(type)): |
| 690 | + Input data type, or sequence of input data types in the user |
| 691 | + defined function. |
| 692 | + output_type (type): |
692 | 693 | Data type of the output in the user defined function. |
693 | 694 | session (bigframes.Session, Optional): |
694 | 695 | BigQuery DataFrames session to use for getting default project, |
@@ -778,6 +779,9 @@ def remote_function( |
778 | 779 | By default BigQuery DataFrames uses a 10 minute timeout. `None` |
779 | 780 | can be passed to let the cloud functions default timeout take effect. |
780 | 781 | """ |
| 782 | + if isinstance(input_types, type): |
| 783 | + input_types = [input_types] |
| 784 | + |
781 | 785 | import bigframes.pandas as bpd |
782 | 786 |
|
783 | 787 | session = session or bpd.get_global_session() |
|
0 commit comments