Skip to content

Commit 43b914f

Browse files
committed
benchmark change
1 parent 144776b commit 43b914f

File tree

5 files changed

+15
-12
lines changed

5 files changed

+15
-12
lines changed

tests/benchmark/read_gbq_colab/aggregate_output.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313
# limitations under the License.
1414
import pathlib
1515

16-
import benchmark.utils as utils
17-
1816
import bigframes.pandas as bpd
1917
import bigframes.session.execution_spec
18+
import tests.benchmark.utils as utils
2019

2120
PAGE_SIZE = utils.READ_GBQ_COLAB_PAGE_SIZE
2221

tests/benchmark/read_gbq_colab/filter_output.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313
# limitations under the License.
1414
import pathlib
1515

16-
import benchmark.utils as utils
17-
1816
import bigframes.pandas as bpd
1917
import bigframes.session.execution_spec
18+
import tests.benchmark.utils as utils
2019

2120
PAGE_SIZE = utils.READ_GBQ_COLAB_PAGE_SIZE
2221

tests/benchmark/read_gbq_colab/first_page.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313
# limitations under the License.
1414
import pathlib
1515

16-
import benchmark.utils as utils
17-
1816
import bigframes.pandas
1917
import bigframes.session.execution_spec
18+
import tests.benchmark.utils as utils
2019

2120
PAGE_SIZE = utils.READ_GBQ_COLAB_PAGE_SIZE
2221

tests/benchmark/read_gbq_colab/last_page.py

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,8 @@
1313
# limitations under the License.
1414
import pathlib
1515

16-
import benchmark.utils as utils
17-
1816
import bigframes.pandas
17+
import tests.benchmark.utils as utils
1918

2019
PAGE_SIZE = utils.READ_GBQ_COLAB_PAGE_SIZE
2120

@@ -27,8 +26,16 @@ def last_page(*, project_id, dataset_id, table_id):
2726
f"SELECT * FROM `{project_id}`.{dataset_id}.{table_id}"
2827
)
2928

30-
# Get number of rows (to calculate number of pages) and then all pages.
31-
batches = df.to_pandas_batches(page_size=PAGE_SIZE)
29+
# Call the executor directly to isolate the query execution time
30+
# from other DataFrame overhead for this benchmark.
31+
execute_result = df._block.session._executor.execute(
32+
df._block.expr,
33+
execution_spec=bigframes.session.execution_spec.ExecutionSpec(
34+
ordered=True, promise_under_10gb=False
35+
),
36+
)
37+
assert execute_result.total_rows is not None and execute_result.total_rows >= 0
38+
batches = execute_result.to_pandas_batches(page_size=PAGE_SIZE)
3239
for _ in batches:
3340
pass
3441

tests/benchmark/read_gbq_colab/sort_output.py

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,9 @@
1313
# limitations under the License.
1414
import pathlib
1515

16-
import benchmark.utils as utils
17-
1816
import bigframes.pandas
1917
import bigframes.session.execution_spec
18+
import tests.benchmark.utils as utils
2019

2120
PAGE_SIZE = utils.READ_GBQ_COLAB_PAGE_SIZE
2221

0 commit comments

Comments
 (0)