@@ -28,6 +28,7 @@ def test_to_arrow_with_jobs_query_response():
28
28
"fields" : [
29
29
{"name" : "name" , "type" : "STRING" , "mode" : "NULLABLE" },
30
30
{"name" : "number" , "type" : "INTEGER" , "mode" : "NULLABLE" },
31
+ {"name" : "json" , "type" : "JSON" , "mode" : "NULLABLE" },
31
32
]
32
33
},
33
34
"jobReference" : {
@@ -37,15 +38,21 @@ def test_to_arrow_with_jobs_query_response():
37
38
},
38
39
"totalRows" : "9" ,
39
40
"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" : "[]" }]},
49
56
],
50
57
"totalBytesProcessed" : "154775150" ,
51
58
"jobComplete" : True ,
@@ -65,7 +72,7 @@ def test_to_arrow_with_jobs_query_response():
65
72
)
66
73
records = rows .to_arrow ()
67
74
68
- assert records .column_names == ["name" , "number" ]
75
+ assert records .column_names == ["name" , "number" , "json" ]
69
76
assert records ["name" ].to_pylist () == [
70
77
"Tiarra" ,
71
78
"Timothy" ,
@@ -78,6 +85,17 @@ def test_to_arrow_with_jobs_query_response():
78
85
"Tiffani" ,
79
86
]
80
87
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
+ ]
81
99
82
100
83
101
def 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():
87
105
"fields" : [
88
106
{"name" : "name" , "type" : "STRING" , "mode" : "NULLABLE" },
89
107
{"name" : "number" , "type" : "INTEGER" , "mode" : "NULLABLE" },
108
+ {"name" : "json" , "type" : "JSON" , "mode" : "NULLABLE" },
90
109
]
91
110
},
92
111
"jobReference" : {
@@ -96,15 +115,21 @@ def test_to_arrow_with_jobs_query_response_and_max_results():
96
115
},
97
116
"totalRows" : "9" ,
98
117
"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" : "[]" }]},
108
133
],
109
134
"totalBytesProcessed" : "154775150" ,
110
135
"jobComplete" : True ,
@@ -125,10 +150,11 @@ def test_to_arrow_with_jobs_query_response_and_max_results():
125
150
)
126
151
records = rows .to_arrow ()
127
152
128
- assert records .column_names == ["name" , "number" ]
153
+ assert records .column_names == ["name" , "number" , "json" ]
129
154
assert records ["name" ].to_pylist () == [
130
155
"Tiarra" ,
131
156
"Timothy" ,
132
157
"Tina" ,
133
158
]
134
159
assert records ["number" ].to_pylist () == [6 , 325 , 26 ]
160
+ assert records ["json" ].to_pylist () == ["123" , '{"key":"value"}' , "[1,2,3]" ]
0 commit comments