21
21
["bigquery" , "impala" ], reason = "Backend doesn't yet implement map types"
22
22
),
23
23
pytest .mark .notimpl (
24
- ["datafusion" , " exasol" , "polars" , "druid" , "oracle" ],
24
+ ["exasol" , "polars" , "druid" , "oracle" ],
25
25
reason = "Not yet implemented in ibis" ,
26
26
),
27
27
]
39
39
reason = "function hstore(character varying[], character varying[]) does not exist" ,
40
40
)
41
41
42
+ mark_notyet_datafusion = pytest .mark .notyet (
43
+ ["datafusion" ], raises = Exception , reason = "only map and make_map are available"
44
+ )
45
+
42
46
43
47
@pytest .mark .notyet ("clickhouse" , reason = "nested types can't be NULL" )
44
48
@pytest .mark .notimpl (
54
58
param (None , None , id = "null_both" ),
55
59
],
56
60
)
61
+ @mark_notyet_datafusion
57
62
def test_map_nulls (con , k , v ):
58
63
k = ibis .literal (k , type = "array<string>" )
59
64
v = ibis .literal (v , type = "array<string>" )
@@ -74,6 +79,7 @@ def test_map_nulls(con, k, v):
74
79
param (None , None , id = "null_both" ),
75
80
],
76
81
)
82
+ @mark_notyet_datafusion
77
83
def test_map_keys_nulls (con , k , v ):
78
84
k = ibis .literal (k , type = "array<string>" )
79
85
v = ibis .literal (v , type = "array<string>" )
@@ -106,6 +112,7 @@ def test_map_keys_nulls(con, k, v):
106
112
param (ibis .literal (None , type = "map<string, string>" ), id = "null_map" ),
107
113
],
108
114
)
115
+ @mark_notyet_datafusion
109
116
def test_map_values_nulls (con , map ):
110
117
assert con .execute (map .values ()) is None
111
118
@@ -174,6 +181,7 @@ def test_map_values_nulls(con, map):
174
181
],
175
182
)
176
183
@pytest .mark .parametrize ("method" , ["get" , "contains" ])
184
+ @mark_notyet_datafusion
177
185
def test_map_get_contains_nulls (con , map , key , method ):
178
186
expr = getattr (map , method )
179
187
assert con .execute (expr (key )) is None
@@ -205,18 +213,21 @@ def test_map_get_contains_nulls(con, map, key, method):
205
213
),
206
214
],
207
215
)
216
+ @mark_notyet_datafusion
208
217
def test_map_merge_nulls (con , m1 , m2 ):
209
218
concatted = m1 + m2
210
219
assert con .execute (concatted ) is None
211
220
212
221
222
+ @mark_notyet_datafusion
213
223
def test_map_table (backend ):
214
224
table = backend .map
215
225
assert table .kv .type ().is_map ()
216
226
assert not table .limit (1 ).execute ().empty
217
227
218
228
219
229
@mark_notimpl_risingwave_hstore
230
+ @mark_notyet_datafusion
220
231
def test_column_map_values (backend ):
221
232
table = backend .map
222
233
expr = table .select ("idx" , vals = table .kv .values ()).order_by ("idx" )
@@ -225,6 +236,7 @@ def test_column_map_values(backend):
225
236
backend .assert_series_equal (result , expected )
226
237
227
238
239
+ @mark_notyet_datafusion
228
240
def test_column_map_merge (backend ):
229
241
table = backend .map
230
242
expr = table .select (
@@ -239,6 +251,7 @@ def test_column_map_merge(backend):
239
251
240
252
241
253
@mark_notimpl_risingwave_hstore
254
+ @mark_notyet_datafusion
242
255
def test_literal_map_keys (con ):
243
256
mapping = ibis .literal ({"1" : "a" , "2" : "b" })
244
257
expr = mapping .keys ().name ("tmp" )
@@ -250,6 +263,7 @@ def test_literal_map_keys(con):
250
263
251
264
252
265
@mark_notimpl_risingwave_hstore
266
+ @mark_notyet_datafusion
253
267
def test_literal_map_values (con ):
254
268
mapping = ibis .literal ({"1" : "a" , "2" : "b" })
255
269
expr = mapping .values ().name ("tmp" )
@@ -260,6 +274,7 @@ def test_literal_map_values(con):
260
274
261
275
@mark_notimpl_risingwave_hstore
262
276
@mark_notyet_postgres
277
+ @mark_notyet_datafusion
263
278
def test_scalar_isin_literal_map_keys (con ):
264
279
mapping = ibis .literal ({"a" : 1 , "b" : 2 })
265
280
a = ibis .literal ("a" )
@@ -272,6 +287,7 @@ def test_scalar_isin_literal_map_keys(con):
272
287
273
288
@mark_notimpl_risingwave_hstore
274
289
@mark_notyet_postgres
290
+ @mark_notyet_datafusion
275
291
def test_map_scalar_contains_key_scalar (con ):
276
292
mapping = ibis .literal ({"a" : 1 , "b" : 2 })
277
293
a = ibis .literal ("a" )
@@ -283,6 +299,7 @@ def test_map_scalar_contains_key_scalar(con):
283
299
284
300
285
301
@mark_notimpl_risingwave_hstore
302
+ @mark_notyet_datafusion
286
303
def test_map_scalar_contains_key_column (backend , alltypes , df ):
287
304
value = {"1" : "a" , "3" : "c" }
288
305
mapping = ibis .literal (value )
@@ -294,6 +311,7 @@ def test_map_scalar_contains_key_column(backend, alltypes, df):
294
311
295
312
@mark_notimpl_risingwave_hstore
296
313
@mark_notyet_postgres
314
+ @mark_notyet_datafusion
297
315
def test_map_column_contains_key_scalar (backend , alltypes , df ):
298
316
expr = ibis .map (ibis .array ([alltypes .string_col ]), ibis .array ([alltypes .int_col ]))
299
317
series = df .apply (lambda row : {row ["string_col" ]: row ["int_col" ]}, axis = 1 )
@@ -306,6 +324,7 @@ def test_map_column_contains_key_scalar(backend, alltypes, df):
306
324
307
325
@mark_notimpl_risingwave_hstore
308
326
@mark_notyet_postgres
327
+ @mark_notyet_datafusion
309
328
def test_map_column_contains_key_column (alltypes ):
310
329
map_expr = ibis .map (
311
330
ibis .array ([alltypes .string_col ]), ibis .array ([alltypes .int_col ])
@@ -317,6 +336,7 @@ def test_map_column_contains_key_column(alltypes):
317
336
318
337
@mark_notimpl_risingwave_hstore
319
338
@mark_notyet_postgres
339
+ @mark_notyet_datafusion
320
340
def test_literal_map_merge (con ):
321
341
a = ibis .literal ({"a" : 0 , "b" : 2 })
322
342
b = ibis .literal ({"a" : 1 , "c" : 3 })
@@ -326,6 +346,7 @@ def test_literal_map_merge(con):
326
346
327
347
328
348
@mark_notimpl_risingwave_hstore
349
+ @mark_notyet_datafusion
329
350
def test_literal_map_getitem_broadcast (backend , alltypes , df ):
330
351
value = {"1" : "a" , "2" : "b" }
331
352
@@ -472,6 +493,7 @@ def test_literal_map_getitem_broadcast(backend, alltypes, df):
472
493
@values
473
494
@keys
474
495
@mark_notimpl_risingwave_hstore
496
+ @mark_notyet_datafusion
475
497
def test_map_get_all_types (con , keys , values ):
476
498
m = ibis .map (ibis .array (keys ), ibis .array (values ))
477
499
for key , val in zip (keys , values ):
@@ -482,6 +504,7 @@ def test_map_get_all_types(con, keys, values):
482
504
483
505
@keys
484
506
@mark_notimpl_risingwave_hstore
507
+ @mark_notyet_datafusion
485
508
def test_map_contains_all_types (con , keys ):
486
509
a = ibis .array (keys )
487
510
m = ibis .map (a , a )
@@ -490,6 +513,7 @@ def test_map_contains_all_types(con, keys):
490
513
491
514
492
515
@mark_notimpl_risingwave_hstore
516
+ @mark_notyet_datafusion
493
517
def test_literal_map_get_broadcast (backend , alltypes , df ):
494
518
value = {"1" : "a" , "2" : "b" }
495
519
@@ -524,13 +548,14 @@ def test_map_construct_dict(con, keys, values):
524
548
assert result == dict (zip (keys , values ))
525
549
526
550
527
- @mark_notimpl_risingwave_hstore
528
- @mark_notyet_postgres
529
551
@pytest .mark .notimpl (
530
552
["flink" ],
531
553
raises = pa .lib .ArrowInvalid ,
532
554
reason = "Map array child array should have no nulls" ,
533
555
)
556
+ @mark_notimpl_risingwave_hstore
557
+ @mark_notyet_postgres
558
+ @mark_notyet_datafusion
534
559
def test_map_construct_array_column (con , alltypes , df ):
535
560
expr = ibis .map (ibis .array ([alltypes .string_col ]), ibis .array ([alltypes .int_col ]))
536
561
result = con .execute (expr )
@@ -541,6 +566,7 @@ def test_map_construct_array_column(con, alltypes, df):
541
566
542
567
@mark_notimpl_risingwave_hstore
543
568
@mark_notyet_postgres
569
+ @mark_notyet_datafusion
544
570
def test_map_get_with_compatible_value_smaller (con ):
545
571
value = ibis .literal ({"A" : 1000 , "B" : 2000 })
546
572
expr = value .get ("C" , 3 )
@@ -549,6 +575,7 @@ def test_map_get_with_compatible_value_smaller(con):
549
575
550
576
@mark_notimpl_risingwave_hstore
551
577
@mark_notyet_postgres
578
+ @mark_notyet_datafusion
552
579
def test_map_get_with_compatible_value_bigger (con ):
553
580
value = ibis .literal ({"A" : 1 , "B" : 2 })
554
581
expr = value .get ("C" , 3000 )
@@ -557,6 +584,7 @@ def test_map_get_with_compatible_value_bigger(con):
557
584
558
585
@mark_notimpl_risingwave_hstore
559
586
@mark_notyet_postgres
587
+ @mark_notyet_datafusion
560
588
def test_map_get_with_incompatible_value_different_kind (con ):
561
589
value = ibis .literal ({"A" : 1000 , "B" : 2000 })
562
590
expr = value .get ("C" , 3.0 )
@@ -565,6 +593,7 @@ def test_map_get_with_incompatible_value_different_kind(con):
565
593
566
594
@mark_notimpl_risingwave_hstore
567
595
@mark_notyet_postgres
596
+ @mark_notyet_datafusion
568
597
@pytest .mark .parametrize ("null_value" , [None , ibis .null ()])
569
598
def test_map_get_with_null_on_not_nullable (con , null_value ):
570
599
map_type = dt .Map (dt .string , dt .Int16 (nullable = False ))
@@ -579,18 +608,20 @@ def test_map_get_with_null_on_not_nullable(con, null_value):
579
608
["flink" ], raises = Py4JJavaError , reason = "Flink cannot handle typeless nulls"
580
609
)
581
610
@mark_notimpl_risingwave_hstore
611
+ @mark_notyet_datafusion
582
612
def test_map_get_with_null_on_null_type_with_null (con , null_value ):
583
613
value = ibis .literal ({"A" : None , "B" : None })
584
614
expr = value .get ("C" , null_value )
585
615
result = con .execute (expr )
586
616
assert pd .isna (result )
587
617
588
618
589
- @mark_notimpl_risingwave_hstore
590
- @mark_notyet_postgres
591
619
@pytest .mark .notyet (
592
620
["flink" ], raises = Py4JJavaError , reason = "Flink cannot handle typeless nulls"
593
621
)
622
+ @mark_notimpl_risingwave_hstore
623
+ @mark_notyet_postgres
624
+ @mark_notyet_datafusion
594
625
def test_map_get_with_null_on_null_type_with_non_null (con ):
595
626
value = ibis .literal ({"A" : None , "B" : None })
596
627
expr = value .get ("C" , 1 )
@@ -603,6 +634,7 @@ def test_map_get_with_null_on_null_type_with_non_null(con):
603
634
reason = "`tbl_properties` is required when creating table with schema" ,
604
635
)
605
636
@mark_notimpl_risingwave_hstore
637
+ @mark_notyet_datafusion
606
638
def test_map_create_table (con , temp_table ):
607
639
t = con .create_table (
608
640
temp_table ,
@@ -617,18 +649,21 @@ def test_map_create_table(con, temp_table):
617
649
reason = "No translation rule for <class 'ibis.expr.operations.maps.MapLength'>" ,
618
650
)
619
651
@mark_notimpl_risingwave_hstore
652
+ @mark_notyet_datafusion
620
653
def test_map_length (con ):
621
654
expr = ibis .literal (dict (a = "A" , b = "B" )).length ()
622
655
assert con .execute (expr ) == 2
623
656
624
657
658
+ @mark_notyet_datafusion
625
659
def test_map_keys_unnest (backend ):
626
660
expr = backend .map .kv .keys ().unnest ()
627
661
result = expr .to_pandas ()
628
662
assert frozenset (result ) == frozenset ("abcdef" )
629
663
630
664
631
665
@mark_notimpl_risingwave_hstore
666
+ @mark_notyet_datafusion
632
667
def test_map_contains_null (con ):
633
668
expr = ibis .map (["a" ], ibis .literal ([None ], type = "array<string>" ))
634
669
assert con .execute (expr .contains ("a" ))
0 commit comments