@@ -2273,17 +2273,18 @@ def test_sparse_mixed_domain_uint_float64(self, fx_sparse_cell_order):
2273
2273
"coords, expected_ned, allows_duplicates" ,
2274
2274
[
2275
2275
([b"aa" , b"bbb" , b"c" , b"dddd" ], [b"aa" , b"dddd" ], False ),
2276
+ ([b"" ], [b"" , b"" ], True ),
2276
2277
([b"" , b"" , b"" , b"" ], [b"" , b"" ], True ),
2277
2278
],
2278
2279
)
2279
2280
def test_sparse_string_domain (
2280
2281
self , coords , expected_ned , allows_duplicates , sparse_cell_order
2281
2282
):
2282
- if sparse_cell_order in ("hilbert" , "row-major" ) and allows_duplicates == True :
2283
- if tiledb .libtiledb .version () < (2 , 8 ):
2284
- pytest .xfail (
2285
- "Skipping known bug with legacy reader and hilbert or row-major layout "
2286
- )
2283
+ # if sparse_cell_order in ("hilbert", "row-major", "col -major") and allows_duplicates == True:
2284
+ # if tiledb.libtiledb.version() < (2, 8):
2285
+ # pytest.xfail(
2286
+ # "Skipping known bug with legacy reader and empty strings "
2287
+ # )
2287
2288
2288
2289
path = self .path ("sparse_string_domain" )
2289
2290
dom = tiledb .Domain (tiledb .Dim (name = "d" , domain = (None , None ), dtype = np .bytes_ ))
@@ -2298,20 +2299,33 @@ def test_sparse_string_domain(
2298
2299
)
2299
2300
tiledb .SparseArray .create (path , schema )
2300
2301
2301
- data = [1 , 2 , 3 , 4 ]
2302
+ data = [1 , 2 , 3 , 4 ][: len ( coords )]
2302
2303
2303
2304
with tiledb .open (path , "w" ) as A :
2305
+ breakpoint ()
2304
2306
A [coords ] = data
2305
2307
2306
2308
with tiledb .open (path ) as A :
2307
2309
ned = A .nonempty_domain ()[0 ]
2308
- res = A [ned [0 ] : ned [1 ]]
2309
- assert_array_equal (res ["a" ], data )
2310
- self .assertEqual (set (res ["d" ]), set (coords ))
2311
- # self.assertEqual(A.nonempty_domain(), ((b"aa", b"dddd"),))
2312
2310
self .assertEqual (A .nonempty_domain (), ((tuple (expected_ned )),))
2313
2311
2314
- def test_sparse_string_domain2 (self , fx_sparse_cell_order ):
2312
+ if not (
2313
+ sparse_cell_order in ("hilbert" , "row-major" , "col-major" )
2314
+ and allows_duplicates == True
2315
+ ):
2316
+ assert_array_equal (A [ned [0 ] : ned [1 ]]["a" ], data )
2317
+ self .assertEqual (set (A [ned [0 ] : ned [1 ]]["d" ]), set (coords ))
2318
+
2319
+ if allows_duplicates and sparse_cell_order != "hilbert" :
2320
+ res_u1 = A .query (order = "U" ).multi_index [ned [0 ] : ned [1 ]]
2321
+ assert_array_equal (res_u1 ["a" ], data )
2322
+ self .assertEqual (set (res_u1 ["d" ]), set (coords ))
2323
+
2324
+ res_u2 = A .query (order = "U" )[ned [0 ] : ned [1 ]]
2325
+ assert_array_equal (res_u2 ["a" ], data )
2326
+ self .assertEqual (set (res_u2 ["d" ]), set (coords ))
2327
+
2328
+ def test_sparse_string_domain2 (self , sparse_cell_order ):
2315
2329
path = self .path ("sparse_string_domain2" )
2316
2330
with self .assertRaises (ValueError ):
2317
2331
dims = [
0 commit comments