@@ -840,19 +840,21 @@ def test_read_pandas_json_index(session, write_engine):
840
840
)
841
841
def test_read_pandas_w_nested_json (session , write_engine ):
842
842
data = [
843
- {"json_field" : "1" },
844
- {"json_field" : None },
845
- {"json_field" : '["1","3","5"]' },
846
- {"json_field" : '{"a":1,"b":["x","y"],"c":{"x":[],"z":false}}' },
843
+ [ {"json_field" : "1" }] ,
844
+ [ {"json_field" : None }] ,
845
+ [ {"json_field" : '["1","3","5"]' }] ,
846
+ [ {"json_field" : '{"a":1,"b":["x","y"],"c":{"x":[],"z":false}}' }] ,
847
847
]
848
848
# PyArrow currently lacks support for creating structs or lists containing extension types.
849
849
# See issue: https://github.com/apache/arrow/issues/45262
850
- pa_array = pa .array (data , type = pa .struct ([("name" , pa .string ())]))
850
+ pa_array = pa .array (data , type = pa .list_ ( pa . struct ([("name" , pa .string ())]) ))
851
851
pd_s = pd .Series (
852
852
arrays .ArrowExtensionArray (pa_array ), # type: ignore
853
- dtype = pd .ArrowDtype (pa .struct ([("name" , bigframes .dtypes .JSON_ARROW_TYPE )])),
853
+ dtype = pd .ArrowDtype (
854
+ pa .list_ (pa .struct ([("name" , bigframes .dtypes .JSON_ARROW_TYPE )]))
855
+ ),
854
856
)
855
- with pytest .raises (NotImplementedError ):
857
+ with pytest .raises (NotImplementedError , match = "Nested JSON types, found in column" ):
856
858
# Until b/401630655 is resolved, json not compatible with allow_large_results=False
857
859
session .read_pandas (pd_s , write_engine = write_engine ).to_pandas (
858
860
allow_large_results = True
@@ -868,19 +870,21 @@ def test_read_pandas_w_nested_json(session, write_engine):
868
870
)
869
871
def test_read_pandas_w_nested_json_index (session , write_engine ):
870
872
data = [
871
- {"json_field" : "1" },
872
- {"json_field" : None },
873
- {"json_field" : '["1","3","5"]' },
874
- {"json_field" : '{"a":1,"b":["x","y"],"c":{"x":[],"z":false}}' },
873
+ [ {"json_field" : "1" }] ,
874
+ [ {"json_field" : None }] ,
875
+ [ {"json_field" : '["1","3","5"]' }] ,
876
+ [ {"json_field" : '{"a":1,"b":["x","y"],"c":{"x":[],"z":false}}' }] ,
875
877
]
876
878
# PyArrow currently lacks support for creating structs or lists containing extension types.
877
879
# See issue: https://github.com/apache/arrow/issues/45262
878
- pa_array = pa .array (data , type = pa .struct ([("name" , pa .string ())]))
880
+ pa_array = pa .array (data , type = pa .list_ ( pa . struct ([("name" , pa .string ())]) ))
879
881
pd_idx : pd .Index = pd .Index (
880
882
arrays .ArrowExtensionArray (pa_array ), # type: ignore
881
- dtype = pd .ArrowDtype (pa .struct ([("name" , bigframes .dtypes .JSON_ARROW_TYPE )])),
883
+ dtype = pd .ArrowDtype (
884
+ pa .list_ (pa .struct ([("name" , bigframes .dtypes .JSON_ARROW_TYPE )]))
885
+ ),
882
886
)
883
- with pytest .raises (NotImplementedError ):
887
+ with pytest .raises (NotImplementedError , match = "Nested JSON types, found in the index" ):
884
888
# Until b/401630655 is resolved, json not compatible with allow_large_results=False
885
889
session .read_pandas (pd_idx , write_engine = write_engine ).to_pandas (
886
890
allow_large_results = True
0 commit comments