1313# limitations under the License.
1414import pathlib
1515
16+ import benchmark .utils as utils
17+
1618import bigframes .pandas as bpd
17- import bigframes .session .execution_spec
18- import tests .benchmark .utils as utils
1919
2020PAGE_SIZE = utils .READ_GBQ_COLAB_PAGE_SIZE
2121
@@ -25,17 +25,9 @@ def aggregate_output(*, project_id, dataset_id, table_id):
2525 # e.g. "{local_inline}" or "{local_large}"
2626 df = bpd ._read_gbq_colab (f"SELECT * FROM `{ project_id } `.{ dataset_id } .{ table_id } " )
2727
28- # Call the executor directly to isolate the query execution time
29- # from other DataFrame overhead for this benchmark.
30- execute_result = df ._block .session ._executor .execute (
31- df ._block .expr ,
32- execution_spec = bigframes .session .execution_spec .ExecutionSpec (
33- ordered = True , promise_under_10gb = False
34- ),
35- )
36- assert execute_result .total_rows is not None and execute_result .total_rows >= 0
37- batches = execute_result .to_pandas_batches (page_size = PAGE_SIZE )
38- next (iter (batches ))
28+ # Simulate getting the first page, since we'll always do that first in the UI.
29+ df .shape
30+ next (iter (df .to_pandas_batches (page_size = PAGE_SIZE )))
3931
4032 # To simulate very small rows that can only fit a boolean,
4133 # some tables don't have an integer column. If an integer column is available,
@@ -50,20 +42,9 @@ def aggregate_output(*, project_id, dataset_id, table_id):
5042 .groupby ("rounded" )
5143 .sum (numeric_only = True )
5244 )
53- execute_result_aggregated = df_aggregated ._block .session ._executor .execute (
54- df_aggregated ._block .expr ,
55- execution_spec = bigframes .session .execution_spec .ExecutionSpec (
56- ordered = True , promise_under_10gb = False
57- ),
58- )
59- assert (
60- execute_result_aggregated .total_rows is not None
61- and execute_result_aggregated .total_rows >= 0
62- )
63- batches_aggregated = execute_result_aggregated .to_pandas_batches (
64- page_size = PAGE_SIZE
65- )
66- next (iter (batches_aggregated ))
45+
46+ df_aggregated .shape
47+ next (iter (df_aggregated .to_pandas_batches (page_size = PAGE_SIZE )))
6748
6849
6950if __name__ == "__main__" :
0 commit comments