@@ -59,6 +59,7 @@ def test_engines_astype_int(scalars_array_value: array_value.ArrayValue, engine)
59
59
ops .AsTypeOp (to_type = bigframes .dtypes .INT_DTYPE ),
60
60
excluded_cols = ["string_col" ],
61
61
)
62
+
62
63
assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
63
64
64
65
@@ -73,6 +74,7 @@ def test_engines_astype_string_int(scalars_array_value: array_value.ArrayValue,
73
74
for val in vals
74
75
]
75
76
)
77
+
76
78
assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
77
79
78
80
@@ -83,6 +85,7 @@ def test_engines_astype_float(scalars_array_value: array_value.ArrayValue, engin
83
85
ops .AsTypeOp (to_type = bigframes .dtypes .FLOAT_DTYPE ),
84
86
excluded_cols = ["string_col" ],
85
87
)
88
+
86
89
assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
87
90
88
91
@@ -99,6 +102,7 @@ def test_engines_astype_string_float(
99
102
for val in vals
100
103
]
101
104
)
105
+
102
106
assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
103
107
104
108
@@ -107,6 +111,7 @@ def test_engines_astype_bool(scalars_array_value: array_value.ArrayValue, engine
107
111
arr = apply_op (
108
112
scalars_array_value , ops .AsTypeOp (to_type = bigframes .dtypes .BOOL_DTYPE )
109
113
)
114
+
110
115
assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
111
116
112
117
@@ -118,6 +123,7 @@ def test_engines_astype_string(scalars_array_value: array_value.ArrayValue, engi
118
123
ops .AsTypeOp (to_type = bigframes .dtypes .STRING_DTYPE ),
119
124
excluded_cols = ["float64_col" ],
120
125
)
126
+
121
127
assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
122
128
123
129
@@ -128,6 +134,7 @@ def test_engines_astype_numeric(scalars_array_value: array_value.ArrayValue, eng
128
134
ops .AsTypeOp (to_type = bigframes .dtypes .NUMERIC_DTYPE ),
129
135
excluded_cols = ["string_col" ],
130
136
)
137
+
131
138
assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
132
139
133
140
@@ -144,6 +151,7 @@ def test_engines_astype_string_numeric(
144
151
for val in vals
145
152
]
146
153
)
154
+
147
155
assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
148
156
149
157
@@ -154,6 +162,7 @@ def test_engines_astype_date(scalars_array_value: array_value.ArrayValue, engine
154
162
ops .AsTypeOp (to_type = bigframes .dtypes .DATE_DTYPE ),
155
163
excluded_cols = ["string_col" ],
156
164
)
165
+
157
166
assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
158
167
159
168
@@ -170,6 +179,7 @@ def test_engines_astype_string_date(
170
179
for val in vals
171
180
]
172
181
)
182
+
173
183
assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
174
184
175
185
@@ -180,6 +190,7 @@ def test_engines_astype_datetime(scalars_array_value: array_value.ArrayValue, en
180
190
ops .AsTypeOp (to_type = bigframes .dtypes .DATETIME_DTYPE ),
181
191
excluded_cols = ["string_col" ],
182
192
)
193
+
183
194
assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
184
195
185
196
@@ -196,6 +207,7 @@ def test_engines_astype_string_datetime(
196
207
for val in vals
197
208
]
198
209
)
210
+
199
211
assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
200
212
201
213
@@ -206,6 +218,7 @@ def test_engines_astype_timestamp(scalars_array_value: array_value.ArrayValue, e
206
218
ops .AsTypeOp (to_type = bigframes .dtypes .TIMESTAMP_DTYPE ),
207
219
excluded_cols = ["string_col" ],
208
220
)
221
+
209
222
assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
210
223
211
224
@@ -226,6 +239,7 @@ def test_engines_astype_string_timestamp(
226
239
for val in vals
227
240
]
228
241
)
242
+
229
243
assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
230
244
231
245
@@ -236,6 +250,7 @@ def test_engines_astype_time(scalars_array_value: array_value.ArrayValue, engine
236
250
ops .AsTypeOp (to_type = bigframes .dtypes .TIME_DTYPE ),
237
251
excluded_cols = ["string_col" , "int64_col" , "int64_too" ],
238
252
)
253
+
239
254
assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
240
255
241
256
@@ -256,6 +271,7 @@ def test_engines_astype_from_json(scalars_array_value: array_value.ArrayValue, e
256
271
),
257
272
]
258
273
arr , _ = scalars_array_value .compute_values (exprs )
274
+
259
275
assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
260
276
261
277
@@ -265,4 +281,112 @@ def test_engines_astype_timedelta(scalars_array_value: array_value.ArrayValue, e
265
281
scalars_array_value ,
266
282
ops .AsTypeOp (to_type = bigframes .dtypes .TIMEDELTA_DTYPE ),
267
283
)
284
+
285
+ assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
286
+
287
+
288
+ @pytest .mark .parametrize ("engine" , ["polars" , "bq" ], indirect = True )
289
+ def test_engines_where_op (scalars_array_value : array_value .ArrayValue , engine ):
290
+ arr , _ = scalars_array_value .compute_values (
291
+ [
292
+ ops .where_op .as_expr (
293
+ expression .deref ("int64_col" ),
294
+ expression .deref ("bool_col" ),
295
+ expression .deref ("float64_col" ),
296
+ )
297
+ ]
298
+ )
299
+
300
+ assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
301
+
302
+
303
+ @pytest .mark .parametrize ("engine" , ["polars" , "bq" ], indirect = True )
304
+ def test_engines_coalesce_op (scalars_array_value : array_value .ArrayValue , engine ):
305
+ arr , _ = scalars_array_value .compute_values (
306
+ [
307
+ ops .coalesce_op .as_expr (
308
+ expression .deref ("int64_col" ),
309
+ expression .deref ("float64_col" ),
310
+ )
311
+ ]
312
+ )
313
+
314
+ assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
315
+
316
+
317
+ @pytest .mark .parametrize ("engine" , ["polars" , "bq" ], indirect = True )
318
+ def test_engines_fillna_op (scalars_array_value : array_value .ArrayValue , engine ):
319
+ arr , _ = scalars_array_value .compute_values (
320
+ [
321
+ ops .fillna_op .as_expr (
322
+ expression .deref ("int64_col" ),
323
+ expression .deref ("float64_col" ),
324
+ )
325
+ ]
326
+ )
327
+
328
+ assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
329
+
330
+
331
+ @pytest .mark .parametrize ("engine" , ["polars" , "bq" ], indirect = True )
332
+ def test_engines_casewhen_op_single_case (
333
+ scalars_array_value : array_value .ArrayValue , engine
334
+ ):
335
+ arr , _ = scalars_array_value .compute_values (
336
+ [
337
+ ops .case_when_op .as_expr (
338
+ expression .deref ("bool_col" ),
339
+ expression .deref ("int64_col" ),
340
+ )
341
+ ]
342
+ )
343
+
344
+ assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
345
+
346
+
347
+ @pytest .mark .parametrize ("engine" , ["polars" , "bq" ], indirect = True )
348
+ def test_engines_casewhen_op_double_case (
349
+ scalars_array_value : array_value .ArrayValue , engine
350
+ ):
351
+ arr , _ = scalars_array_value .compute_values (
352
+ [
353
+ ops .case_when_op .as_expr (
354
+ ops .gt_op .as_expr (expression .deref ("int64_col" ), expression .const (3 )),
355
+ expression .deref ("int64_col" ),
356
+ ops .lt_op .as_expr (expression .deref ("int64_col" ), expression .const (- 3 )),
357
+ expression .deref ("int64_too" ),
358
+ )
359
+ ]
360
+ )
361
+
362
+ assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
363
+
364
+
365
+ @pytest .mark .parametrize ("engine" , ["polars" , "bq" ], indirect = True )
366
+ def test_engines_isnull_op (scalars_array_value : array_value .ArrayValue , engine ):
367
+ arr , _ = scalars_array_value .compute_values (
368
+ [ops .isnull_op .as_expr (expression .deref ("string_col" ))]
369
+ )
370
+
371
+ assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
372
+
373
+
374
+ @pytest .mark .parametrize ("engine" , ["polars" , "bq" ], indirect = True )
375
+ def test_engines_notnull_op (scalars_array_value : array_value .ArrayValue , engine ):
376
+ arr , _ = scalars_array_value .compute_values (
377
+ [ops .notnull_op .as_expr (expression .deref ("string_col" ))]
378
+ )
379
+
380
+ assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
381
+
382
+
383
+ @pytest .mark .parametrize ("engine" , ["polars" , "bq" ], indirect = True )
384
+ def test_engines_invert_op (scalars_array_value : array_value .ArrayValue , engine ):
385
+ arr , _ = scalars_array_value .compute_values (
386
+ [
387
+ ops .invert_op .as_expr (expression .deref ("bytes_col" )),
388
+ ops .invert_op .as_expr (expression .deref ("bool_col" )),
389
+ ]
390
+ )
391
+
268
392
assert_equivalence_execution (arr .node , REFERENCE_ENGINE , engine )
0 commit comments