Skip to content
Merged
Show file tree
Hide file tree
Changes from all 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
2 changes: 1 addition & 1 deletion R/Dim.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ tiledb_dim <- function(name, domain, tile, type, ctx = tiledb_get_context()) {
nf <- nfilters(fl)
tp <- datatype(object)
dm <- if (is.na(cells)) "" else paste0(domain(object), if (grepl("INT", tp)) "L" else "", collape="")
ex <- if (is.na(cells)) "" else paste0(dim(object), if (grepl("INT", tp)) "L" else "", collape="")
ex <- if (is.na(cells)) "" else paste0(tile(object), if (grepl("INT", tp)) "L" else "", collape="")
txt <- paste0("tiledb_dim(name=\"", name(object), "\", ",
"domain=c(", if (is.na(cells)) "NULL,NULL"
else paste0(dm, collapse=","), "), ",
Expand Down
10 changes: 4 additions & 6 deletions src/libtiledb.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -856,9 +856,8 @@ SEXP libtiledb_dim_get_domain(XPtr<tiledb::Dimension> dim) {
using DataType = tiledb::impl::tiledb_to_type<TILEDB_INT64>::type;
auto d1 = dim->domain<DataType>().first;
auto d2 = dim->domain<DataType>().second;
if (d1 <= R_NaInt || d1 > std::numeric_limits<int64_t>::max() ||
d2 <= R_NaInt || d2 > std::numeric_limits<int64_t>::max()) {
Rcpp::stop("tiledb_dim domain INT64 value not representable as an R integer64 type");
if (d1 > std::numeric_limits<int64_t>::max() || d2 > std::numeric_limits<int64_t>::max()) {
return NumericVector({static_cast<double>(d1), static_cast<double>(d2)});
}
std::vector<int64_t> v = { d1, d2 };
return makeInteger64(v);
Expand All @@ -867,9 +866,8 @@ SEXP libtiledb_dim_get_domain(XPtr<tiledb::Dimension> dim) {
using DataType = tiledb::impl::tiledb_to_type<TILEDB_UINT64>::type;
auto d1 = dim->domain<DataType>().first;
auto d2 = dim->domain<DataType>().second;
if (d1 > std::numeric_limits<int64_t>::max() ||
d2 > std::numeric_limits<int64_t>::max()) {
Rcpp::stop("tiledb_dim domain UINT64 value not representable as an R integer64 type");
if (d1 > std::numeric_limits<int64_t>::max() || d2 > std::numeric_limits<int64_t>::max()) {
return NumericVector({static_cast<double>(d1), static_cast<double>(d2)});
}
std::vector<int64_t> v = { static_cast<int64_t>(d1), static_cast<int64_t>(d2) };
return makeInteger64(v);
Expand Down