Skip to content

Commit dc7d98c

Browse files
committed
fix python 3.6
1 parent 5ff6602 commit dc7d98c

File tree

2 files changed

+7
-4
lines changed

2 files changed

+7
-4
lines changed

bigframes/core/utils.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -254,9 +254,10 @@ def _search_for_nested_json_type(arrow_type: pa.DataType) -> bool:
254254
if pa.types.is_list(arrow_type):
255255
return _search_for_nested_json_type(arrow_type.value_type)
256256
if pa.types.is_struct(arrow_type):
257-
return any(
258-
_search_for_nested_json_type(field.type) for field in arrow_type.fields
259-
)
257+
for i in range(arrow_type.num_fields):
258+
if _search_for_nested_json_type(arrow_type.field(i).type):
259+
return True
260+
return False
260261
return False
261262

262263

tests/system/small/test_session.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -884,7 +884,9 @@ def test_read_pandas_w_nested_json_index(session, write_engine):
884884
pa.list_(pa.struct([("name", bigframes.dtypes.JSON_ARROW_TYPE)]))
885885
),
886886
)
887-
with pytest.raises(NotImplementedError, match="Nested JSON types, found in the index"):
887+
with pytest.raises(
888+
NotImplementedError, match="Nested JSON types, found in the index"
889+
):
888890
# Until b/401630655 is resolved, json not compatible with allow_large_results=False
889891
session.read_pandas(pd_idx, write_engine=write_engine).to_pandas(
890892
allow_large_results=True

0 commit comments

Comments
 (0)