Skip to content

Commit d6c534c

Browse files
cleanups
1 parent ee240cd commit d6c534c

3 files changed

Lines changed: 10 additions & 10 deletions

File tree

packages/bigframes/bigframes/session/bq_caching_executor.py

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ def __init__(
8080
metrics: Optional[bigframes.session.metrics.ExecutionMetrics] = None,
8181
enable_polars_execution: bool = False,
8282
publisher: bigframes.core.events.Publisher,
83-
labels: Mapping[str, str] = {},
83+
labels: tuple[tuple[str, str], ...] = (),
8484
compiler_name: Literal["ibis", "sqlglot"] = "ibis",
8585
cache: Optional[execution_cache.ExecutionCache] = None,
8686
):
@@ -166,7 +166,7 @@ def execute(
166166
result = self._export_gbq(
167167
array_value,
168168
execution_spec.destination_spec,
169-
extra_labels=dict(execution_spec.labels),
169+
extra_labels=execution_spec.labels,
170170
)
171171
self._publisher.publish(
172172
bigframes.core.events.ExecutionFinished(
@@ -183,7 +183,7 @@ def execute(
183183
if isinstance(execution_spec.destination_spec, ex_spec.CacheSpec)
184184
else None,
185185
must_create_table=not execution_spec.promise_under_10gb,
186-
extra_labels=dict(execution_spec.labels),
186+
extra_labels=execution_spec.labels,
187187
)
188188
# post steps: export
189189
if isinstance(execution_spec.destination_spec, ex_spec.GcsOutputSpec):
@@ -246,7 +246,7 @@ def _export_gbq(
246246
self,
247247
array_value: bigframes.core.ArrayValue,
248248
spec: ex_spec.TableOutputSpec,
249-
extra_labels: Mapping[str, str] = {},
249+
extra_labels: tuple[tuple[str, str], ...] = (),
250250
) -> executor.ExecuteResult:
251251
"""
252252
Export the ArrayValue to an existing BigQuery table.
@@ -365,7 +365,7 @@ def _run_execute_query(
365365
job_config: Optional[bq_job.QueryJobConfig] = None,
366366
query_with_job: bool = True,
367367
session=None,
368-
extra_labels: Mapping[str, str] = {},
368+
extra_labels: tuple[tuple[str, str], ...] = (),
369369
) -> Tuple[bq_table.RowIterator, Optional[bigquery.QueryJob]]:
370370
"""
371371
Starts BigQuery query job and waits for results.

packages/bigframes/bigframes/session/proxy_executor.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ def __init__(
5252
metrics: Optional[bigframes.session.metrics.ExecutionMetrics] = None,
5353
enable_polars_execution: bool = False,
5454
publisher: bigframes.core.events.Publisher,
55-
labels: Mapping[str, str] = {},
55+
labels: tuple[tuple[str, str], ...] = (),
5656
):
5757
self._enable_polars_execution = enable_polars_execution
5858
shared_cache = execution_cache.ExecutionCache()
@@ -119,10 +119,10 @@ def execute(
119119
{_COMPILER_LABEL_KEY: f"sqlglot-{correlation_id}"}
120120
),
121121
)
122-
except google.cloud.exceptions.BadRequest as e:
122+
except Exception as e:
123123
msg = bfe.format_message(
124-
f"Compiler ID {correlation_id}: BadRequest on sqlglot. "
125-
f"Falling back to ibis. Details: {e.message}"
124+
f"Compiler ID {correlation_id}: Exception on sqlglot. "
125+
f"Falling back to ibis. Details: {e}"
126126
)
127127
warnings.warn(msg, category=UserWarning)
128128
return self._ibis_executor.execute(

packages/bigframes/tests/unit/session/test_proxy_executor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ def test_cached_stable_routes_to_sqlglot_fallback_to_ibis(mock_executor, monkeyp
175175
with mock.patch("uuid.uuid1") as mock_uuid:
176176
mock_uuid.return_value.hex = "1234567890123456"
177177
with pytest.warns(
178-
UserWarning, match="Compiler ID 123456789012: BadRequest on sqlglot"
178+
UserWarning, match="Compiler ID 123456789012: Exception on sqlglot"
179179
):
180180
mock_executor.cached(array_value, config=config)
181181

0 commit comments

Comments
 (0)