Skip to content

Commit 778746f

Browse files
committed
use global option in remaining functions
1 parent 7199fee commit 778746f

File tree

4 files changed

+17
-15
lines changed

4 files changed

+17
-15
lines changed

bigframes/pandas/io/api.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ def read_gbq( # type: ignore[overload-overlap]
187187
use_cache: Optional[bool] = ...,
188188
col_order: Iterable[str] = ...,
189189
dry_run: Literal[False] = ...,
190-
allow_large_results: bool = ...,
190+
allow_large_results: Optional[bool] = ...,
191191
) -> bigframes.dataframe.DataFrame:
192192
...
193193

@@ -204,7 +204,7 @@ def read_gbq(
204204
use_cache: Optional[bool] = ...,
205205
col_order: Iterable[str] = ...,
206206
dry_run: Literal[True] = ...,
207-
allow_large_results: bool = ...,
207+
allow_large_results: Optional[bool] = ...,
208208
) -> pandas.Series:
209209
...
210210

@@ -220,7 +220,7 @@ def read_gbq(
220220
use_cache: Optional[bool] = None,
221221
col_order: Iterable[str] = (),
222222
dry_run: bool = False,
223-
allow_large_results: bool = True,
223+
allow_large_results: Optional[bool] = None,
224224
) -> bigframes.dataframe.DataFrame | pandas.Series:
225225
_set_default_session_location_if_possible(query_or_table)
226226
return global_session.with_default_session(

bigframes/session/__init__.py

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -398,7 +398,7 @@ def read_gbq( # type: ignore[overload-overlap]
398398
use_cache: Optional[bool] = ...,
399399
col_order: Iterable[str] = ...,
400400
dry_run: Literal[False] = ...,
401-
allow_large_results: bool = ...,
401+
allow_large_results: Optional[bool] = ...,
402402
) -> dataframe.DataFrame:
403403
...
404404

@@ -415,7 +415,7 @@ def read_gbq(
415415
use_cache: Optional[bool] = ...,
416416
col_order: Iterable[str] = ...,
417417
dry_run: Literal[True] = ...,
418-
allow_large_results: bool = ...,
418+
allow_large_results: Optional[bool] = ...,
419419
) -> pandas.Series:
420420
...
421421

@@ -431,7 +431,7 @@ def read_gbq(
431431
use_cache: Optional[bool] = None,
432432
col_order: Iterable[str] = (),
433433
dry_run: bool = False,
434-
allow_large_results: bool = True,
434+
allow_large_results: Optional[bool] = None,
435435
) -> dataframe.DataFrame | pandas.Series:
436436
# TODO(b/281571214): Generate prompt to show the progress of read_gbq.
437437
if columns and col_order:
@@ -441,6 +441,9 @@ def read_gbq(
441441
elif col_order:
442442
columns = col_order
443443

444+
if allow_large_results is None:
445+
allow_large_results = bigframes._config.options._allow_large_results
446+
444447
if bf_io_bigquery.is_query(query_or_table):
445448
return self._loader.read_gbq_query( # type: ignore # for dry_run overload
446449
query_or_table,
@@ -527,6 +530,8 @@ def _read_gbq_colab(
527530
if pyformat_args is None:
528531
pyformat_args = {}
529532

533+
allow_large_results = bigframes._config.options._allow_large_results
534+
530535
query = bigframes.core.pyformat.pyformat(
531536
query,
532537
pyformat_args=pyformat_args,
@@ -539,10 +544,7 @@ def _read_gbq_colab(
539544
index_col=bigframes.enums.DefaultIndexKind.NULL,
540545
force_total_order=False,
541546
dry_run=typing.cast(Union[Literal[False], Literal[True]], dry_run),
542-
# TODO(tswast): we may need to allow allow_large_results to be overwritten
543-
# or possibly a general configuration object for an explicit
544-
# destination table and write disposition.
545-
allow_large_results=False,
547+
allow_large_results=allow_large_results,
546548
)
547549

548550
@overload

bigframes/session/loader.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -895,7 +895,7 @@ def read_gbq_query( # type: ignore[overload-overlap]
895895
filters: third_party_pandas_gbq.FiltersType = ...,
896896
dry_run: Literal[False] = ...,
897897
force_total_order: Optional[bool] = ...,
898-
allow_large_results: bool = ...,
898+
allow_large_results: bool,
899899
) -> dataframe.DataFrame:
900900
...
901901

@@ -912,7 +912,7 @@ def read_gbq_query(
912912
filters: third_party_pandas_gbq.FiltersType = ...,
913913
dry_run: Literal[True] = ...,
914914
force_total_order: Optional[bool] = ...,
915-
allow_large_results: bool = ...,
915+
allow_large_results: bool,
916916
) -> pandas.Series:
917917
...
918918

@@ -928,7 +928,7 @@ def read_gbq_query(
928928
filters: third_party_pandas_gbq.FiltersType = (),
929929
dry_run: bool = False,
930930
force_total_order: Optional[bool] = None,
931-
allow_large_results: bool = True,
931+
allow_large_results: bool,
932932
) -> dataframe.DataFrame | pandas.Series:
933933
configuration = _transform_read_gbq_configuration(configuration)
934934

third_party/bigframes_vendored/pandas/io/gbq.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ def read_gbq(
2525
filters: FiltersType = (),
2626
use_cache: Optional[bool] = None,
2727
col_order: Iterable[str] = (),
28-
allow_large_results: bool = True,
28+
allow_large_results: Optional[bool] = None,
2929
):
3030
"""Loads a DataFrame from BigQuery.
3131
@@ -161,7 +161,7 @@ def read_gbq(
161161
Whether to allow large query results. If ``True``, the query
162162
results can be larger than the maximum response size. This
163163
option is only applicable when ``query_or_table`` is a query.
164-
Defaults to ``True``.
164+
Defaults to ``bpd.options.compute.allow_large_results``.
165165
166166
Raises:
167167
bigframes.exceptions.DefaultIndexWarning:

0 commit comments

Comments
 (0)