Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix #758: "Can't read domain for dimensions of type UINT16" #759

Merged
merged 3 commits into from
Oct 2, 2024
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading