Skip to content

Commit 930f7b3

Browse files
ihnortonkounelisagis
authored andcommitted
WIP - needs verification
1 parent c61ed8e commit 930f7b3

File tree

2 files changed

+26
-12
lines changed

2 files changed

+26
-12
lines changed

tiledb/tests/common.py

+1-1
Original file line numberDiff line numberDiff line change
@@ -375,6 +375,6 @@ def assert_captured(cap, expected):
375375
assert expected in out
376376

377377

378-
@pytest.fixture(scope="module", params=["hilbert", "row-major"])
378+
@pytest.fixture(scope="module", params=["hilbert", "row-major", "col-major"])
379379
def fx_sparse_cell_order(request):
380380
yield request.param

tiledb/tests/test_libtiledb.py

+25-11
Original file line numberDiff line numberDiff line change
@@ -2273,17 +2273,18 @@ def test_sparse_mixed_domain_uint_float64(self, fx_sparse_cell_order):
22732273
"coords, expected_ned, allows_duplicates",
22742274
[
22752275
([b"aa", b"bbb", b"c", b"dddd"], [b"aa", b"dddd"], False),
2276+
([b""], [b"", b""], True),
22762277
([b"", b"", b"", b""], [b"", b""], True),
22772278
],
22782279
)
22792280
def test_sparse_string_domain(
22802281
self, coords, expected_ned, allows_duplicates, sparse_cell_order
22812282
):
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+
# )
22872288

22882289
path = self.path("sparse_string_domain")
22892290
dom = tiledb.Domain(tiledb.Dim(name="d", domain=(None, None), dtype=np.bytes_))
@@ -2298,20 +2299,33 @@ def test_sparse_string_domain(
22982299
)
22992300
tiledb.SparseArray.create(path, schema)
23002301

2301-
data = [1, 2, 3, 4]
2302+
data = [1, 2, 3, 4][: len(coords)]
23022303

23032304
with tiledb.open(path, "w") as A:
2305+
breakpoint()
23042306
A[coords] = data
23052307

23062308
with tiledb.open(path) as A:
23072309
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"),))
23122310
self.assertEqual(A.nonempty_domain(), ((tuple(expected_ned)),))
23132311

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):
23152329
path = self.path("sparse_string_domain2")
23162330
with self.assertRaises(ValueError):
23172331
dims = [

0 commit comments

Comments
 (0)