Skip to content

feat: Add bigframes-mode label to query jobs #832

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jul 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions bigframes/session/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -1833,6 +1833,8 @@ def _start_query(
Starts BigQuery query job and waits for results.
"""
job_config = self._prepare_query_job_config(job_config)
if not self._strictly_ordered:
job_config.labels = {"bigframes-mode": "unordered"}
try:
return bigframes.session._io.bigquery.start_query_with_client(
self,
Expand Down
9 changes: 9 additions & 0 deletions tests/system/small/test_unordered.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,15 @@
from tests.system.utils import assert_pandas_df_equal, skip_legacy_pandas


def test_unordered_mode_job_label(unordered_session):
pd_df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]}, dtype=pd.Int64Dtype())
df = bpd.DataFrame(pd_df, session=unordered_session)
df.to_pandas()
job_labels = df.query_job.labels # type:ignore
assert "bigframes-mode" in job_labels
assert job_labels["bigframes-mode"] == "unordered"


def test_unordered_mode_cache_aggregate(unordered_session):
pd_df = pd.DataFrame({"a": [1, 2, 3], "b": [4, 5, 6]}, dtype=pd.Int64Dtype())
df = bpd.DataFrame(pd_df, session=unordered_session)
Expand Down