Skip to content

Commit

Permalink
Fix #758: "Can't read domain for dimensions of type UINT16" (#759)
Browse files Browse the repository at this point in the history
* Fix #758

* add unit-test coverage

* DESCRIPTION NEWS.md
  • Loading branch information
johnkerl authored Oct 2, 2024
1 parent 321175a commit baf6fd5
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 5 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
Package: tiledb
Type: Package
Version: 0.30.1
Version: 0.30.1.1
Title: Modern Database Engine for Complex Data Based on Multi-Dimensional Arrays
Authors@R: c(person("TileDB, Inc.", role = c("aut", "cph")),
person("Dirk", "Eddelbuettel", email = "[email protected]", role = "cre"))
Expand Down
5 changes: 5 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# Unreleased

* Fix [#758](https://github.com/TileDB-Inc/TileDB-R/issues/758) "Can't read domain for dimensions of type UINT16"


# tiledb 0.30.1

* This release of the R package builds against [TileDB 2.26.1](https://github.com/TileDB-Inc/TileDB/releases/tag/2.26.1), and has also been tested against earlier releases as well as the development version (#757)
Expand Down
6 changes: 5 additions & 1 deletion inst/tinytest/test_dim.R
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,11 @@ for (dtype in dimtypes) {
"INT64" = as.integer64(1000),
1000) # default is 1000

domain <- tiledb_domain(tiledb_dim("row", dom, tile, dtype))
dimension <- tiledb_dim("row", dom, tile, dtype)
if (dtype != "ASCII") { # no extent for string dims
expect_silent(tile(dimension))
}
domain <- tiledb_domain(dimension)
attrib <- tiledb_attr("attr", type = "INT32")
schema <- tiledb_array_schema(domain, attrib, sparse=TRUE)
tiledb_array_create(uri, schema)
Expand Down
6 changes: 3 additions & 3 deletions src/libtiledb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,7 +757,7 @@ XPtr<tiledb::Dimension> libtiledb_dim(XPtr<tiledb::Context> ctx,
Rcpp::stop("dimension domain must be a c(lower bound, upper bound) pair");
}
std::array<uint16_t, 2> _domain = {static_cast<uint16_t>(domain_vec[0]), static_cast<uint16_t>(domain_vec[1])};
int16_t _tile_extent = Rcpp::as<int16_t>(tile_extent);
uint16_t _tile_extent = Rcpp::as<uint16_t>(tile_extent);
auto dim = new tiledb::Dimension(tiledb::Dimension::create<uint16_t>(*ctx.get(), name, _domain, _tile_extent));
auto ptr = make_xptr<tiledb::Dimension>(dim);
return ptr;
Expand Down Expand Up @@ -925,7 +925,7 @@ SEXP libtiledb_dim_get_domain(XPtr<tiledb::Dimension> dim) {
dim->domain<DataType>().second});
}
case TILEDB_UINT16: {
using DataType = tiledb::impl::tiledb_to_type<TILEDB_INT16>::type;
using DataType = tiledb::impl::tiledb_to_type<TILEDB_UINT16>::type;
return IntegerVector({dim->domain<DataType>().first,
dim->domain<DataType>().second});
}
Expand Down Expand Up @@ -1027,7 +1027,7 @@ SEXP libtiledb_dim_get_tile_extent(XPtr<tiledb::Dimension> dim) {
return Rcpp::wrap(static_cast<int32_t>(dim->tile_extent<DataType>()));
}
case TILEDB_UINT16: {
using DataType = tiledb::impl::tiledb_to_type<TILEDB_INT16>::type;
using DataType = tiledb::impl::tiledb_to_type<TILEDB_UINT16>::type;
return Rcpp::wrap(static_cast<int32_t>(dim->tile_extent<DataType>()));
}
case TILEDB_INT32: {
Expand Down

0 comments on commit baf6fd5

Please sign in to comment.