@@ -28,6 +28,7 @@ def test_to_arrow_with_jobs_query_response():
2828 "fields" : [
2929 {"name" : "name" , "type" : "STRING" , "mode" : "NULLABLE" },
3030 {"name" : "number" , "type" : "INTEGER" , "mode" : "NULLABLE" },
31+ {"name" : "json" , "type" : "JSON" , "mode" : "NULLABLE" },
3132 ]
3233 },
3334 "jobReference" : {
@@ -37,15 +38,21 @@ def test_to_arrow_with_jobs_query_response():
3738 },
3839 "totalRows" : "9" ,
3940 "rows" : [
40- {"f" : [{"v" : "Tiarra" }, {"v" : "6" }]},
41- {"f" : [{"v" : "Timothy" }, {"v" : "325" }]},
42- {"f" : [{"v" : "Tina" }, {"v" : "26" }]},
43- {"f" : [{"v" : "Tierra" }, {"v" : "10" }]},
44- {"f" : [{"v" : "Tia" }, {"v" : "17" }]},
45- {"f" : [{"v" : "Tiara" }, {"v" : "22" }]},
46- {"f" : [{"v" : "Tiana" }, {"v" : "6" }]},
47- {"f" : [{"v" : "Tiffany" }, {"v" : "229" }]},
48- {"f" : [{"v" : "Tiffani" }, {"v" : "8" }]},
41+ {"f" : [{"v" : "Tiarra" }, {"v" : "6" }, {"v" : "123" }]},
42+ {"f" : [{"v" : "Timothy" }, {"v" : "325" }, {"v" : '{"key":"value"}' }]},
43+ {"f" : [{"v" : "Tina" }, {"v" : "26" }, {"v" : "[1,2,3]" }]},
44+ {
45+ "f" : [
46+ {"v" : "Tierra" },
47+ {"v" : "10" },
48+ {"v" : '{"aKey": {"bKey": {"cKey": -123}}}' },
49+ ]
50+ },
51+ {"f" : [{"v" : "Tia" }, {"v" : "17" }, {"v" : None }]},
52+ {"f" : [{"v" : "Tiara" }, {"v" : "22" }, {"v" : '"some-json-string"' }]},
53+ {"f" : [{"v" : "Tiana" }, {"v" : "6" }, {"v" : '{"nullKey":null}' }]},
54+ {"f" : [{"v" : "Tiffany" }, {"v" : "229" }, {"v" : '""' }]},
55+ {"f" : [{"v" : "Tiffani" }, {"v" : "8" }, {"v" : "[]" }]},
4956 ],
5057 "totalBytesProcessed" : "154775150" ,
5158 "jobComplete" : True ,
@@ -65,7 +72,7 @@ def test_to_arrow_with_jobs_query_response():
6572 )
6673 records = rows .to_arrow ()
6774
68- assert records .column_names == ["name" , "number" ]
75+ assert records .column_names == ["name" , "number" , "json" ]
6976 assert records ["name" ].to_pylist () == [
7077 "Tiarra" ,
7178 "Timothy" ,
@@ -78,6 +85,17 @@ def test_to_arrow_with_jobs_query_response():
7885 "Tiffani" ,
7986 ]
8087 assert records ["number" ].to_pylist () == [6 , 325 , 26 , 10 , 17 , 22 , 6 , 229 , 8 ]
88+ assert records ["json" ].to_pylist () == [
89+ "123" ,
90+ '{"key":"value"}' ,
91+ "[1,2,3]" ,
92+ '{"aKey": {"bKey": {"cKey": -123}}}' ,
93+ None ,
94+ '"some-json-string"' ,
95+ '{"nullKey":null}' ,
96+ '""' ,
97+ "[]" ,
98+ ]
8199
82100
83101def test_to_arrow_with_jobs_query_response_and_max_results ():
@@ -87,6 +105,7 @@ def test_to_arrow_with_jobs_query_response_and_max_results():
87105 "fields" : [
88106 {"name" : "name" , "type" : "STRING" , "mode" : "NULLABLE" },
89107 {"name" : "number" , "type" : "INTEGER" , "mode" : "NULLABLE" },
108+ {"name" : "json" , "type" : "JSON" , "mode" : "NULLABLE" },
90109 ]
91110 },
92111 "jobReference" : {
@@ -96,15 +115,21 @@ def test_to_arrow_with_jobs_query_response_and_max_results():
96115 },
97116 "totalRows" : "9" ,
98117 "rows" : [
99- {"f" : [{"v" : "Tiarra" }, {"v" : "6" }]},
100- {"f" : [{"v" : "Timothy" }, {"v" : "325" }]},
101- {"f" : [{"v" : "Tina" }, {"v" : "26" }]},
102- {"f" : [{"v" : "Tierra" }, {"v" : "10" }]},
103- {"f" : [{"v" : "Tia" }, {"v" : "17" }]},
104- {"f" : [{"v" : "Tiara" }, {"v" : "22" }]},
105- {"f" : [{"v" : "Tiana" }, {"v" : "6" }]},
106- {"f" : [{"v" : "Tiffany" }, {"v" : "229" }]},
107- {"f" : [{"v" : "Tiffani" }, {"v" : "8" }]},
118+ {"f" : [{"v" : "Tiarra" }, {"v" : "6" }, {"v" : "123" }]},
119+ {"f" : [{"v" : "Timothy" }, {"v" : "325" }, {"v" : '{"key":"value"}' }]},
120+ {"f" : [{"v" : "Tina" }, {"v" : "26" }, {"v" : "[1,2,3]" }]},
121+ {
122+ "f" : [
123+ {"v" : "Tierra" },
124+ {"v" : "10" },
125+ {"v" : '{"aKey": {"bKey": {"cKey": -123}}}' },
126+ ]
127+ },
128+ {"f" : [{"v" : "Tia" }, {"v" : "17" }, {"v" : None }]},
129+ {"f" : [{"v" : "Tiara" }, {"v" : "22" }, {"v" : '"some-json-string"' }]},
130+ {"f" : [{"v" : "Tiana" }, {"v" : "6" }, {"v" : '{"nullKey":null}' }]},
131+ {"f" : [{"v" : "Tiffany" }, {"v" : "229" }, {"v" : '""' }]},
132+ {"f" : [{"v" : "Tiffani" }, {"v" : "8" }, {"v" : "[]" }]},
108133 ],
109134 "totalBytesProcessed" : "154775150" ,
110135 "jobComplete" : True ,
@@ -125,10 +150,11 @@ def test_to_arrow_with_jobs_query_response_and_max_results():
125150 )
126151 records = rows .to_arrow ()
127152
128- assert records .column_names == ["name" , "number" ]
153+ assert records .column_names == ["name" , "number" , "json" ]
129154 assert records ["name" ].to_pylist () == [
130155 "Tiarra" ,
131156 "Timothy" ,
132157 "Tina" ,
133158 ]
134159 assert records ["number" ].to_pylist () == [6 , 325 , 26 ]
160+ assert records ["json" ].to_pylist () == ["123" , '{"key":"value"}' , "[1,2,3]" ]
0 commit comments