Skip to content
This repository was archived by the owner on May 7, 2026. It is now read-only.

Commit 8dc2171

Browse files
committed
fix presumbit error
1 parent 75a6d68 commit 8dc2171

3 files changed

Lines changed: 27 additions & 34 deletions

File tree

bigframes/operations/output_schemas.py

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,6 @@
1414

1515
import pyarrow as pa
1616

17-
from bigframes import dtypes
18-
1917

2018
def parse_sql_type(sql: str) -> pa.DataType:
2119
"""
@@ -45,9 +43,6 @@ def parse_sql_type(sql: str) -> pa.DataType:
4543
if sql.upper() == "BOOL":
4644
return pa.bool_()
4745

48-
if sql.upper() == "JSON":
49-
return dtypes.JSON_ARROW_TYPE
50-
5146
if sql.upper().startswith("ARRAY<") and sql.endswith(">"):
5247
inner_type = sql[len("ARRAY<") : -1]
5348
return pa.list_(parse_sql_type(inner_type))

notebooks/dataframes/anywidget_mode.ipynb

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
"cells": [
33
{
44
"cell_type": "code",
5-
"execution_count": 1,
5+
"execution_count": 2,
66
"id": "d10bfca4",
77
"metadata": {},
88
"outputs": [],
@@ -32,7 +32,7 @@
3232
},
3333
{
3434
"cell_type": "code",
35-
"execution_count": 2,
35+
"execution_count": 3,
3636
"id": "ca22f059",
3737
"metadata": {},
3838
"outputs": [],
@@ -50,7 +50,7 @@
5050
},
5151
{
5252
"cell_type": "code",
53-
"execution_count": 3,
53+
"execution_count": 4,
5454
"id": "1bc5aaf3",
5555
"metadata": {},
5656
"outputs": [],
@@ -69,7 +69,7 @@
6969
},
7070
{
7171
"cell_type": "code",
72-
"execution_count": 4,
72+
"execution_count": 5,
7373
"id": "f289d250",
7474
"metadata": {},
7575
"outputs": [
@@ -96,7 +96,7 @@
9696
},
9797
{
9898
"cell_type": "code",
99-
"execution_count": 5,
99+
"execution_count": 6,
100100
"id": "42bb02ab",
101101
"metadata": {},
102102
"outputs": [
@@ -123,7 +123,7 @@
123123
},
124124
{
125125
"cell_type": "code",
126-
"execution_count": 6,
126+
"execution_count": 7,
127127
"id": "ce250157",
128128
"metadata": {},
129129
"outputs": [
@@ -142,7 +142,7 @@
142142
{
143143
"data": {
144144
"application/vnd.jupyter.widget-view+json": {
145-
"model_id": "f0ed74d739b64a56a6e3750968b155e1",
145+
"model_id": "6e46f6d1352043a4baee57fa089f2b0c",
146146
"version_major": 2,
147147
"version_minor": 0
148148
},
@@ -160,7 +160,7 @@
160160
"Computation deferred. Computation will process 171.4 MB"
161161
]
162162
},
163-
"execution_count": 6,
163+
"execution_count": 7,
164164
"metadata": {},
165165
"output_type": "execute_result"
166166
}
@@ -179,7 +179,7 @@
179179
},
180180
{
181181
"cell_type": "code",
182-
"execution_count": 7,
182+
"execution_count": 8,
183183
"id": "6920d49b",
184184
"metadata": {},
185185
"outputs": [
@@ -217,7 +217,7 @@
217217
{
218218
"data": {
219219
"application/vnd.jupyter.widget-view+json": {
220-
"model_id": "fd00566103744c189a52033df9c9db7a",
220+
"model_id": "88d370b617b545809eb7bb8e5c66ea0e",
221221
"version_major": 2,
222222
"version_minor": 0
223223
},
@@ -251,7 +251,7 @@
251251
},
252252
{
253253
"cell_type": "code",
254-
"execution_count": 8,
254+
"execution_count": 9,
255255
"id": "12b68f15",
256256
"metadata": {},
257257
"outputs": [
@@ -288,7 +288,7 @@
288288
},
289289
{
290290
"cell_type": "code",
291-
"execution_count": 9,
291+
"execution_count": 10,
292292
"id": "a9d5d13a",
293293
"metadata": {},
294294
"outputs": [
@@ -330,7 +330,7 @@
330330
{
331331
"data": {
332332
"application/vnd.jupyter.widget-view+json": {
333-
"model_id": "2233934e95b84a87b01b9352ca36346d",
333+
"model_id": "dec19e8788b74219b88bccfc65e3b9c0",
334334
"version_major": 2,
335335
"version_minor": 0
336336
},
@@ -361,15 +361,15 @@
361361
},
362362
{
363363
"cell_type": "code",
364-
"execution_count": 10,
364+
"execution_count": 11,
365365
"id": "added-cell-1",
366366
"metadata": {},
367367
"outputs": [
368368
{
369369
"data": {
370370
"text/html": [
371371
"✅ Completed. \n",
372-
" Query processed 85.9 kB in 11 seconds of slot time.\n",
372+
" Query processed 85.9 kB in 21 seconds of slot time.\n",
373373
" "
374374
],
375375
"text/plain": [
@@ -408,7 +408,7 @@
408408
{
409409
"data": {
410410
"application/vnd.jupyter.widget-view+json": {
411-
"model_id": "3e3e09d7adee4bcaa5b3540603c2418a",
411+
"model_id": "774357b4083c47c8a5e1fd33bb6af188",
412412
"version_major": 2,
413413
"version_minor": 0
414414
},
@@ -426,7 +426,7 @@
426426
"Computation deferred. Computation will process 0 Bytes"
427427
]
428428
},
429-
"execution_count": 10,
429+
"execution_count": 11,
430430
"metadata": {},
431431
"output_type": "execute_result"
432432
}

tests/system/small/test_anywidget.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -62,8 +62,7 @@ def table_widget(paginated_bf_df: bf.dataframe.DataFrame):
6262
Helper fixture to create a TableWidget instance with a fixed page size.
6363
This reduces duplication across tests that use the same widget configuration.
6464
"""
65-
66-
from bigframes.display import TableWidget
65+
from bigframes.display.anywidget import TableWidget
6766

6867
with bf.option_context("display.repr_mode", "anywidget", "display.max_rows", 2):
6968
# Delay context manager cleanup of `max_rows` until after tests finish.
@@ -92,7 +91,7 @@ def small_bf_df(
9291
@pytest.fixture
9392
def small_widget(small_bf_df):
9493
"""Helper fixture for tests using a DataFrame smaller than the page size."""
95-
from bigframes.display import TableWidget
94+
from bigframes.display.anywidget import TableWidget
9695

9796
with bf.option_context("display.repr_mode", "anywidget", "display.max_rows", 5):
9897
yield TableWidget(small_bf_df)
@@ -152,10 +151,11 @@ def test_widget_initialization_should_calculate_total_row_count(
152151
paginated_bf_df: bf.dataframe.DataFrame,
153152
):
154153
"""A TableWidget should correctly calculate the total row count on creation."""
155-
from bigframes.display import TableWidget
154+
from bigframes.display.anywidget import TableWidget
156155

157156
with bf.option_context("display.repr_mode", "anywidget", "display.max_rows", 2):
158157
widget = TableWidget(paginated_bf_df)
158+
widget = TableWidget(paginated_bf_df)
159159

160160
assert widget.row_count == EXPECTED_ROW_COUNT
161161

@@ -266,7 +266,7 @@ def test_widget_pagination_should_work_with_custom_page_size(
266266
A widget should paginate correctly with a custom page size of 3.
267267
"""
268268
with bf.option_context("display.repr_mode", "anywidget", "display.max_rows", 3):
269-
from bigframes.display import TableWidget
269+
from bigframes.display.anywidget import TableWidget
270270

271271
widget = TableWidget(paginated_bf_df)
272272
assert widget.page_size == 3
@@ -312,7 +312,7 @@ def test_widget_page_size_should_be_immutable_after_creation(
312312
by subsequent changes to global options.
313313
"""
314314
with bf.option_context("display.repr_mode", "anywidget", "display.max_rows", 2):
315-
from bigframes.display import TableWidget
315+
from bigframes.display.anywidget import TableWidget
316316

317317
widget = TableWidget(paginated_bf_df)
318318
assert widget.page_size == 2
@@ -331,7 +331,7 @@ def test_widget_page_size_should_be_immutable_after_creation(
331331
def test_empty_widget_should_have_zero_row_count(empty_bf_df: bf.dataframe.DataFrame):
332332
"""Given an empty DataFrame, the widget's row count should be 0."""
333333
with bf.option_context("display.repr_mode", "anywidget"):
334-
from bigframes.display import TableWidget
334+
from bigframes.display.anywidget import TableWidget
335335

336336
widget = TableWidget(empty_bf_df)
337337

@@ -341,7 +341,7 @@ def test_empty_widget_should_have_zero_row_count(empty_bf_df: bf.dataframe.DataF
341341
def test_empty_widget_should_render_table_headers(empty_bf_df: bf.dataframe.DataFrame):
342342
"""Given an empty DataFrame, the widget should still render table headers."""
343343
with bf.option_context("display.repr_mode", "anywidget"):
344-
from bigframes.display import TableWidget
344+
from bigframes.display.anywidget import TableWidget
345345

346346
widget = TableWidget(empty_bf_df)
347347

@@ -477,10 +477,8 @@ def test_struct_column_anywidget_mode(mock_display, session: bf.Session):
477477
# Assert that we did NOT fall back to the deferred representation.
478478
mock_repr_query_job.assert_not_called()
479479

480-
# Assert that display was called with a TableWidget
481-
mock_display.assert_called_once()
482480
widget = mock_display.call_args[0][0]
483-
from bigframes.display import TableWidget
481+
from bigframes.display.anywidget import TableWidget
484482

485483
assert isinstance(widget, TableWidget)
486484

@@ -518,7 +516,7 @@ def test_json_column_anywidget_mode(mock_display, json_df: bf.dataframe.DataFram
518516
# Assert TableWidget was created and displayed
519517
mock_display.assert_called_once()
520518
widget = mock_display.call_args[0][0]
521-
from bigframes.display import TableWidget
519+
from bigframes.display.anywidget import TableWidget
522520

523521
assert isinstance(widget, TableWidget)
524522

0 commit comments

Comments
 (0)