|
1 | 1 | import pytest |
2 | 2 |
|
3 | | -import math |
4 | 3 | import numpy as np |
5 | | -from numpy.testing import assert_array_equal |
6 | 4 | import string |
7 | 5 |
|
8 | 6 | import tiledb |
@@ -638,3 +636,32 @@ def test_dense_datetime(self): |
638 | 636 | result = A.query(attr_cond=qc).df[:] |
639 | 637 |
|
640 | 638 | assert all(self.filter_dense(result["dates"], dt_mask) == A[idx]["dates"]) |
| 639 | + |
| 640 | + def test_array_with_bool_but_unused(self): |
| 641 | + path = self.path("test_array_with_bool_but_unused") |
| 642 | + |
| 643 | + dom = tiledb.Domain( |
| 644 | + tiledb.Dim(name="d", domain=(1, 3), tile=1, dtype=np.uint32) |
| 645 | + ) |
| 646 | + attrs = [ |
| 647 | + tiledb.Attr(name="myint", dtype=int), |
| 648 | + tiledb.Attr(name="mystr", dtype=str), |
| 649 | + tiledb.Attr(name="mybool", dtype=bool), |
| 650 | + ] |
| 651 | + |
| 652 | + schema = tiledb.ArraySchema(domain=dom, attrs=attrs, sparse=True) |
| 653 | + tiledb.Array.create(path, schema) |
| 654 | + |
| 655 | + data = { |
| 656 | + "myint": np.asarray([10, 20, 30]), |
| 657 | + "mystr": np.asarray(["apple", "ball", "cat"]), |
| 658 | + "mybool": np.asarray([True, False, True]), |
| 659 | + } |
| 660 | + |
| 661 | + with tiledb.open(path, "w") as A: |
| 662 | + A[np.arange(1, 4)] = data |
| 663 | + |
| 664 | + with tiledb.open(path) as A: |
| 665 | + qc = tiledb.QueryCondition("myint > 10") |
| 666 | + result = A.query(attr_cond=qc, attrs=["myint"])[:] |
| 667 | + assert all(result["myint"] > 10) |
0 commit comments