Skip to content

Commit e6c5cb6

Browse files
committed
Use matching query for the two_way_query, fixes SC-18696
1 parent 966a03e commit e6c5cb6

File tree

1 file changed

+8
-5
lines changed

1 file changed

+8
-5
lines changed

tiledb/tests/test_multi_index-hp.py

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ def is_boundserror(exc: Exception):
2929
return any(x in str(exc) for x in vals)
3030

3131

32-
def _direct_query_ranges(array: SparseArray, ranges):
32+
def _direct_query_ranges(array: SparseArray, ranges, order):
33+
order_map = {"C": 0, "F": 1, "U": 3}
34+
layout = order_map[order]
3335
with tiledb.scope_ctx() as ctx:
34-
q = tiledb.main.PyQuery(ctx, array, ("a",), (), 0, False)
36+
q = tiledb.main.PyQuery(ctx, array, ("a",), (), layout, False)
3537
q.set_ranges(ranges)
3638
q.submit()
3739
return {k: v[0].view(array.attr(0).dtype) for k, v in q.results().items()}
@@ -77,8 +79,9 @@ def create_array(uri):
7779

7880
return uri
7981

82+
@pytest.mark.parametrize("order", ["C", "F", "U"])
8083
@given(st.lists(bounded_ntuple(length=2, min_value=-100, max_value=100)))
81-
def test_multi_index_two_way_query(self, sparse_array_1d, ranges):
84+
def test_multi_index_two_way_query(self, order, sparse_array_1d, ranges):
8285
"""This test checks the result of "direct" range queries using PyQuery
8386
against the result of `multi_index` on the same ranges."""
8487

@@ -89,8 +92,8 @@ def test_multi_index_two_way_query(self, sparse_array_1d, ranges):
8992

9093
try:
9194
with tiledb.open(uri) as A:
92-
r1 = A.multi_index[ranges]["a"]
93-
r2 = _direct_query_ranges(A, [ranges])["a"]
95+
r1 = A.query(order=order).multi_index[ranges]["a"]
96+
r2 = _direct_query_ranges(A, [ranges], order)["a"]
9497

9598
assert_array_equal(r1, r2)
9699
except tiledb.TileDBError as exc:

0 commit comments

Comments
 (0)