From 624e162ffdf29c033e124cdf277f285cf5759241 Mon Sep 17 00:00:00 2001 From: Shobhit Singh Date: Tue, 25 Mar 2025 22:20:50 +0000 Subject: [PATCH 1/2] feat!: set `allow_large_results=False` by default to optimize small result operations --- bigframes/_config/bigquery_options.py | 2 +- tests/unit/_config/test_bigquery_options.py | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/bigframes/_config/bigquery_options.py b/bigframes/_config/bigquery_options.py index 84bc4f6d01..7d33b7ba39 100644 --- a/bigframes/_config/bigquery_options.py +++ b/bigframes/_config/bigquery_options.py @@ -89,7 +89,7 @@ def __init__( kms_key_name: Optional[str] = None, skip_bq_connection_check: bool = False, *, - allow_large_results: bool = True, + allow_large_results: bool = False, ordering_mode: Literal["strict", "partial"] = "strict", client_endpoints_override: Optional[dict] = None, ): diff --git a/tests/unit/_config/test_bigquery_options.py b/tests/unit/_config/test_bigquery_options.py index 98a74d4e4c..b8f3a612d4 100644 --- a/tests/unit/_config/test_bigquery_options.py +++ b/tests/unit/_config/test_bigquery_options.py @@ -183,3 +183,10 @@ def test_client_endpoints_override_set_shows_warning(): with pytest.warns(UserWarning): options.client_endpoints_override = {"bqclient": "endpoint_address"} + + +def test_default_options(): + options = bigquery_options.BigQueryOptions() + + assert options.allow_large_results is False + assert options.ordering_mode == "strict" From ae21322183e565ca79a94941cec3559e5834e910 Mon Sep 17 00:00:00 2001 From: Shobhit Singh Date: Wed, 26 Mar 2025 00:20:58 +0000 Subject: [PATCH 2/2] adjust progress bar test for large result --- tests/system/small/test_progress_bar.py | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tests/system/small/test_progress_bar.py b/tests/system/small/test_progress_bar.py index 3139ae5225..9c61c8ea5b 100644 --- a/tests/system/small/test_progress_bar.py +++ b/tests/system/small/test_progress_bar.py @@ -55,6 +55,19 @@ def test_progress_bar_scalar(penguins_df_default_index: bf.dataframe.DataFrame, with bf.option_context("display.progress_bar", "terminal"): penguins_df_default_index["body_mass_g"].head(10).mean() + assert capsys.readouterr().out == "" + + +def test_progress_bar_scalar_allow_large_results( + penguins_df_default_index: bf.dataframe.DataFrame, capsys +): + capsys.readouterr() # clear output + + with bf.option_context( + "display.progress_bar", "terminal", "bigquery.allow_large_results", "True" + ): + penguins_df_default_index["body_mass_g"].head(10).mean() + assert_loading_msg_exist(capsys.readouterr().out)