Skip to content

Commit 577553f

Browse files
committed
convert inputs to bf objects
1 parent 53b6113 commit 577553f

File tree

1 file changed

+19
-14
lines changed
  • bigframes/bigquery/_operations

1 file changed

+19
-14
lines changed

bigframes/bigquery/_operations/obj.py

Lines changed: 19 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@
2727
information, see the `launch stage descriptions
2828
<https://cloud.google.com/products?hl=en#product-launch-stages>`_.
2929
30-
3130
.. note::
3231
3332
To provide feedback or request support for this feature, send an email to
@@ -38,11 +37,12 @@
3837
from __future__ import annotations
3938

4039
import datetime
41-
from typing import Optional, Union
40+
from typing import Optional, Sequence, Union
4241

4342
import numpy as np
4443
import pandas as pd
4544

45+
from bigframes.core import convert
4646
from bigframes.core.logging import log_adapter
4747
import bigframes.core.utils as utils
4848
import bigframes.operations as ops
@@ -56,12 +56,13 @@ def fetch_metadata(
5656
"""The OBJ.FETCH_METADATA function returns Cloud Storage metadata for a partially populated ObjectRef value.
5757
5858
Args:
59-
objectref (bigframes.series.Series):
59+
objectref (bigframes.pandas.Series):
6060
A partially populated ObjectRef value, in which the uri and authorizer fields are populated and the details field isn't.
6161
6262
Returns:
63-
bigframes.series.Series: A fully populated ObjectRef value. The metadata is provided in the details field of the returned ObjectRef value.
63+
bigframes.pandas.Series: A fully populated ObjectRef value. The metadata is provided in the details field of the returned ObjectRef value.
6464
"""
65+
objectref = convert.to_bf_series(objectref, default_index=None)
6566
return objectref._apply_unary_op(ops.obj_fetch_metadata_op)
6667

6768

@@ -74,7 +75,7 @@ def get_access_url(
7475
"""The OBJ.GET_ACCESS_URL function returns JSON that contains reference information for the input ObjectRef value, and also access URLs that you can use to read or modify the Cloud Storage object.
7576
7677
Args:
77-
objectref (bigframes.series.Series):
78+
objectref (bigframes.pandas.Series):
7879
An ObjectRef value that represents a Cloud Storage object.
7980
mode (str):
8081
A STRING value that identifies the type of URL that you want to be returned. The following values are supported:
@@ -84,8 +85,10 @@ def get_access_url(
8485
An optional INTERVAL value that specifies how long the generated access URLs remain valid. You can specify a value between 30 minutes and 6 hours. For example, you could specify INTERVAL 2 HOUR to generate URLs that expire after 2 hours. The default value is 6 hours.
8586
8687
Returns:
87-
bigframes.series.Series: A JSON value that contains the Cloud Storage object reference information from the input ObjectRef value, and also one or more URLs that you can use to access the Cloud Storage object.
88+
bigframes.pandas.Series: A JSON value that contains the Cloud Storage object reference information from the input ObjectRef value, and also one or more URLs that you can use to access the Cloud Storage object.
8889
"""
90+
objectref = convert.to_bf_series(objectref, default_index=None)
91+
8992
duration_micros = None
9093
if duration is not None:
9194
duration_micros = utils.timedelta_to_micros(duration)
@@ -97,23 +100,25 @@ def get_access_url(
97100

98101
@log_adapter.method_logger(custom_base_name="bigquery_obj")
99102
def make_ref(
100-
uri_or_json: series.Series,
101-
authorizer: Optional[series.Series] = None,
103+
uri_or_json: Union[series.Series, Sequence[str]],
104+
authorizer: Union[series.Series, str, None] = None,
102105
) -> series.Series:
103106
"""Use the OBJ.MAKE_REF function to create an ObjectRef value that contains reference information for a Cloud Storage object.
104107
105108
Args:
106-
uri_or_json (bigframes.series.Series):
107-
A STRING value that contains the URI for the Cloud Storage object, for example, gs://mybucket/flowers/12345.jpg.
109+
uri_or_json (bigframes.pandas.Series or str):
110+
A series of STRING values that contains the URI for the Cloud Storage object, for example, gs://mybucket/flowers/12345.jpg.
108111
OR
109-
A JSON value that represents a Cloud Storage object.
110-
authorizer (bigframes.series.Series, optional):
112+
A series of JSON value that represents a Cloud Storage object.
113+
authorizer (bigframes.pandas.Series or str, optional):
111114
A STRING value that contains the Cloud Resource connection used to access the Cloud Storage object.
112-
Required if uri_or_json is a URI string.
115+
Required if ``uri_or_json`` is a URI string.
113116
114117
Returns:
115-
bigframes.series.Series: An ObjectRef value.
118+
bigframes.pandas.Series: An ObjectRef value.
116119
"""
120+
uri_or_json = convert.to_bf_series(uri_or_json, default_index=None)
121+
117122
if authorizer is not None:
118123
return uri_or_json._apply_binary_op(authorizer, ops.obj_make_ref_op)
119124

0 commit comments

Comments
 (0)