@@ -279,6 +279,7 @@ def _read_gbq_colab( # type: ignore[overload-overlap]
279
279
* ,
280
280
pyformat_args : Optional [Dict [str , Any ]] = ...,
281
281
dry_run : Literal [False ] = ...,
282
+ use_hybrid_engine : bool = ...,
282
283
) -> bigframes .dataframe .DataFrame :
283
284
...
284
285
@@ -289,6 +290,7 @@ def _read_gbq_colab(
289
290
* ,
290
291
pyformat_args : Optional [Dict [str , Any ]] = ...,
291
292
dry_run : Literal [True ] = ...,
293
+ use_hybrid_engine : bool = ...,
292
294
) -> pandas .Series :
293
295
...
294
296
@@ -298,6 +300,7 @@ def _read_gbq_colab(
298
300
* ,
299
301
pyformat_args : Optional [Dict [str , Any ]] = None ,
300
302
dry_run : bool = False ,
303
+ use_hybrid_engine : bool = False ,
301
304
) -> bigframes .dataframe .DataFrame | pandas .Series :
302
305
"""A Colab-specific version of read_gbq.
303
306
@@ -312,7 +315,9 @@ def _read_gbq_colab(
312
315
dry_run (bool):
313
316
If True, estimates the query results size without returning data.
314
317
The return will be a pandas Series with query metadata.
315
-
318
+ use_hybrid_engine (bool):
319
+ If True, and session not started, new session started will use
320
+ hybrid execution which pushes some execution to local cpu.
316
321
Returns:
317
322
Union[bigframes.dataframe.DataFrame, pandas.Series]:
318
323
A BigQuery DataFrame if `dry_run` is False, otherwise a pandas Series.
@@ -345,7 +350,7 @@ def _read_gbq_colab(
345
350
dry_run = True ,
346
351
)
347
352
_set_default_session_location_if_possible_deferred_query (create_query )
348
- if not config .options .bigquery ._session_started :
353
+ if use_hybrid_engine and not config .options .bigquery ._session_started :
349
354
config .options .bigquery .enable_polars_execution = True
350
355
351
356
return global_session .with_default_session (
0 commit comments