diff --git a/R/Dim.R b/R/Dim.R index 0da58f2ead..a98438fa85 100644 --- a/R/Dim.R +++ b/R/Dim.R @@ -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=","), "), ", diff --git a/src/libtiledb.cpp b/src/libtiledb.cpp index ecf6143a26..6f2ef8ac37 100644 --- a/src/libtiledb.cpp +++ b/src/libtiledb.cpp @@ -856,9 +856,8 @@ SEXP libtiledb_dim_get_domain(XPtr dim) { using DataType = tiledb::impl::tiledb_to_type::type; auto d1 = dim->domain().first; auto d2 = dim->domain().second; - if (d1 <= R_NaInt || d1 > std::numeric_limits::max() || - d2 <= R_NaInt || d2 > std::numeric_limits::max()) { - Rcpp::stop("tiledb_dim domain INT64 value not representable as an R integer64 type"); + if (d1 > std::numeric_limits::max() || d2 > std::numeric_limits::max()) { + return NumericVector({static_cast(d1), static_cast(d2)}); } std::vector v = { d1, d2 }; return makeInteger64(v); @@ -867,9 +866,8 @@ SEXP libtiledb_dim_get_domain(XPtr dim) { using DataType = tiledb::impl::tiledb_to_type::type; auto d1 = dim->domain().first; auto d2 = dim->domain().second; - if (d1 > std::numeric_limits::max() || - d2 > std::numeric_limits::max()) { - Rcpp::stop("tiledb_dim domain UINT64 value not representable as an R integer64 type"); + if (d1 > std::numeric_limits::max() || d2 > std::numeric_limits::max()) { + return NumericVector({static_cast(d1), static_cast(d2)}); } std::vector v = { static_cast(d1), static_cast(d2) }; return makeInteger64(v);