Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kounelisagis committed Feb 20, 2025
1 parent 3bafb00 commit d61020d
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 7 deletions.
8 changes: 5 additions & 3 deletions tiledb/array.py
Original file line number Diff line number Diff line change
Expand Up @@ -673,10 +673,12 @@ def nonempty_domain(self):

res_x, res_y = self.array._non_empty_domain(dim_idx, dim_dtype)

# convert to bytes if needed
if dim_dtype == np.bytes_:
# convert to bytes if needed
res_x = bytes(res_x, encoding="utf8")
res_y = bytes(res_y, encoding="utf8")
if not isinstance(res_x, bytes):
res_x = bytes(res_x, encoding="utf8")
if not isinstance(res_y, bytes):
res_y = bytes(res_y, encoding="utf8")

if np.issubdtype(dim_dtype, np.datetime64):
# convert to np.datetime64
Expand Down
10 changes: 6 additions & 4 deletions tiledb/libtiledb/array.cc
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,13 @@ void init_array(py::module& m) {
} else if (n_type.is(py::dtype::of<float>())) {
auto domain = self.non_empty_domain<float>(dim_idx);
return py::make_tuple(domain.first, domain.second);
} else if (
py::getattr(n_type, "kind").is(py::str("S")) ||
py::getattr(n_type, "kind").is(py::str("U"))) {
} else if (py::getattr(n_type, "kind").is(py::str("S"))) {
auto domain = self.non_empty_domain_var(dim_idx);
return py::make_tuple(domain.first, domain.second);
return py::make_tuple(
py::bytes(domain.first), py::bytes(domain.second));
} else if (py::getattr(n_type, "kind").is(py::str("U"))) {
TPY_ERROR_LOC(
"Unicode strings are not supported as dimension types");
// np.datetime64
} else if (py::getattr(n_type, "kind").is(py::str("M"))) {
auto domain = self.non_empty_domain<int64_t>(dim_idx);
Expand Down

0 comments on commit d61020d

Please sign in to comment.