Skip to content

Commit cde1c0f

Browse files
authored
chore(bigframes): fix mypy errors and JSON serialization order (#16755)
This PR fixes mypy errors regarding pyarrow.compute and a JSON serialization order mismatch in bigframes tests.
1 parent 655475d commit cde1c0f

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

packages/bigframes/bigframes/session/_io/pandas.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ def arrow_to_pandas(
8989
# Preserve NA/NaN distinction. Note: This is currently needed, even if we use
9090
# nullable Float64Dtype in the types_mapper. See:
9191
# https://github.com/pandas-dev/pandas/issues/55668
92-
mask = pyarrow.compute.is_null(column)
92+
mask = pyarrow.compute.is_null(column) # type: ignore[attr-defined]
9393
nonnull = pyarrow.compute.fill_null(column, float("nan"))
9494
# Regarding type: ignore, this class has been public at this
9595
# location since pandas 1.2.0. See:
@@ -106,7 +106,7 @@ def arrow_to_pandas(
106106
elif dtype == pandas.Int64Dtype():
107107
# Avoid out-of-bounds errors in Pandas 1.5.x, which incorrectly
108108
# casts to float64 in an intermediate step.
109-
mask = pyarrow.compute.is_null(column)
109+
mask = pyarrow.compute.is_null(column) # type: ignore[attr-defined]
110110
nonnull = pyarrow.compute.fill_null(column, 0)
111111
pd_array = pandas.arrays.IntegerArray(
112112
nonnull.to_numpy()

packages/bigframes/tests/system/small/bigquery/test_json.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ def test_to_json_from_struct():
404404

405405
actual = bbq.to_json(s)
406406
expected = bpd.Series(
407-
['{"project":"pandas","version":1}', '{"project":"numpy","version":2}'],
407+
['{"version":1,"project":"pandas"}', '{"version":2,"project":"numpy"}'],
408408
dtype=dtypes.JSON_DTYPE,
409409
)
410410

@@ -429,7 +429,7 @@ def test_to_json_string_from_struct():
429429

430430
actual = bbq.to_json_string(s)
431431
expected = bpd.Series(
432-
['{"project":"pandas","version":1}', '{"project":"numpy","version":2}'],
432+
['{"version":1,"project":"pandas"}', '{"version":2,"project":"numpy"}'],
433433
dtype=dtypes.STRING_DTYPE,
434434
)
435435

0 commit comments

Comments
 (0)