Skip to content

Commit 0d66958

Browse files
committed
fix presumbit error
1 parent 14515de commit 0d66958

File tree

3 files changed

+29
-36
lines changed

3 files changed

+29
-36
lines changed

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": [
@@ -205,7 +205,7 @@
205205
{
206206
"data": {
207207
"application/vnd.jupyter.widget-view+json": {
208-
"model_id": "fd00566103744c189a52033df9c9db7a",
208+
"model_id": "88d370b617b545809eb7bb8e5c66ea0e",
209209
"version_major": 2,
210210
"version_minor": 0
211211
},
@@ -239,7 +239,7 @@
239239
},
240240
{
241241
"cell_type": "code",
242-
"execution_count": 8,
242+
"execution_count": 9,
243243
"id": "12b68f15",
244244
"metadata": {},
245245
"outputs": [
@@ -276,7 +276,7 @@
276276
},
277277
{
278278
"cell_type": "code",
279-
"execution_count": 9,
279+
"execution_count": 10,
280280
"id": "a9d5d13a",
281281
"metadata": {},
282282
"outputs": [
@@ -304,7 +304,7 @@
304304
{
305305
"data": {
306306
"application/vnd.jupyter.widget-view+json": {
307-
"model_id": "2233934e95b84a87b01b9352ca36346d",
307+
"model_id": "dec19e8788b74219b88bccfc65e3b9c0",
308308
"version_major": 2,
309309
"version_minor": 0
310310
},
@@ -335,15 +335,15 @@
335335
},
336336
{
337337
"cell_type": "code",
338-
"execution_count": 10,
338+
"execution_count": 11,
339339
"id": "added-cell-1",
340340
"metadata": {},
341341
"outputs": [
342342
{
343343
"data": {
344344
"text/html": [
345345
"✅ Completed. \n",
346-
" Query processed 85.9 kB in 11 seconds of slot time.\n",
346+
" Query processed 85.9 kB in 21 seconds of slot time.\n",
347347
" "
348348
],
349349
"text/plain": [
@@ -382,7 +382,7 @@
382382
{
383383
"data": {
384384
"application/vnd.jupyter.widget-view+json": {
385-
"model_id": "3e3e09d7adee4bcaa5b3540603c2418a",
385+
"model_id": "774357b4083c47c8a5e1fd33bb6af188",
386386
"version_major": 2,
387387
"version_minor": 0
388388
},
@@ -400,7 +400,7 @@
400400
"Computation deferred. Computation will process 0 Bytes"
401401
]
402402
},
403-
"execution_count": 10,
403+
"execution_count": 11,
404404
"metadata": {},
405405
"output_type": "execute_result"
406406
}

tests/system/small/test_anywidget.py

Lines changed: 12 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -62,11 +62,11 @@ 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-
from bigframes import display
65+
from bigframes.display.anywidget import TableWidget
6666

6767
with bf.option_context("display.repr_mode", "anywidget", "display.max_rows", 2):
6868
# Delay context manager cleanup of `max_rows` until after tests finish.
69-
yield display.TableWidget(paginated_bf_df)
69+
yield TableWidget(paginated_bf_df)
7070

7171

7272
@pytest.fixture(scope="module")
@@ -91,10 +91,10 @@ def small_bf_df(
9191
@pytest.fixture
9292
def small_widget(small_bf_df):
9393
"""Helper fixture for tests using a DataFrame smaller than the page size."""
94-
from bigframes import display
94+
from bigframes.display.anywidget import TableWidget
9595

9696
with bf.option_context("display.repr_mode", "anywidget", "display.max_rows", 5):
97-
yield display.TableWidget(small_bf_df)
97+
yield TableWidget(small_bf_df)
9898

9999

100100
@pytest.fixture(scope="module")
@@ -151,10 +151,10 @@ def test_widget_initialization_should_calculate_total_row_count(
151151
paginated_bf_df: bf.dataframe.DataFrame,
152152
):
153153
"""A TableWidget should correctly calculate the total row count on creation."""
154-
from bigframes import display
154+
from bigframes.display.anywidget import TableWidget
155155

156156
with bf.option_context("display.repr_mode", "anywidget", "display.max_rows", 2):
157-
widget = display.TableWidget(paginated_bf_df)
157+
widget = TableWidget(paginated_bf_df)
158158

159159
assert widget.row_count == EXPECTED_ROW_COUNT
160160

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

270270
widget = TableWidget(paginated_bf_df)
271271
assert widget.page_size == 3
@@ -311,7 +311,7 @@ def test_widget_page_size_should_be_immutable_after_creation(
311311
by subsequent changes to global options.
312312
"""
313313
with bf.option_context("display.repr_mode", "anywidget", "display.max_rows", 2):
314-
from bigframes.display import TableWidget
314+
from bigframes.display.anywidget import TableWidget
315315

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

335335
widget = TableWidget(empty_bf_df)
336336

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

345345
widget = TableWidget(empty_bf_df)
346346

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

479-
# Assert that display was called with a TableWidget
480-
mock_display.assert_called_once()
481479
widget = mock_display.call_args[0][0]
482-
from bigframes.display import TableWidget
480+
from bigframes.display.anywidget import TableWidget
483481

484482
assert isinstance(widget, TableWidget)
485483

@@ -517,7 +515,7 @@ def test_json_column_anywidget_mode(mock_display, json_df: bf.dataframe.DataFram
517515
# Assert TableWidget was created and displayed
518516
mock_display.assert_called_once()
519517
widget = mock_display.call_args[0][0]
520-
from bigframes.display import TableWidget
518+
from bigframes.display.anywidget import TableWidget
521519

522520
assert isinstance(widget, TableWidget)
523521

0 commit comments

Comments
 (0)