From baf6fd57ce722f52b07afa0bf12d503c4450cce2 Mon Sep 17 00:00:00 2001 From: John Kerl Date: Tue, 1 Oct 2024 22:10:58 -0400 Subject: [PATCH 1/2] Fix #758: "Can't read domain for dimensions of type UINT16" (#759) * Fix #758 * add unit-test coverage * DESCRIPTION NEWS.md --- DESCRIPTION | 2 +- NEWS.md | 5 +++++ inst/tinytest/test_dim.R | 6 +++++- src/libtiledb.cpp | 6 +++--- 4 files changed, 14 insertions(+), 5 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index b3b40bf8c6..f14df3c360 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -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 = "dirk@tiledb.com", role = "cre")) diff --git a/NEWS.md b/NEWS.md index b3715fcc68..d023d0b4fb 100644 --- a/NEWS.md +++ b/NEWS.md @@ -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) diff --git a/inst/tinytest/test_dim.R b/inst/tinytest/test_dim.R index 99b0255d1b..9100138fc2 100644 --- a/inst/tinytest/test_dim.R +++ b/inst/tinytest/test_dim.R @@ -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) diff --git a/src/libtiledb.cpp b/src/libtiledb.cpp index be816188a8..887aa09b59 100644 --- a/src/libtiledb.cpp +++ b/src/libtiledb.cpp @@ -757,7 +757,7 @@ XPtr libtiledb_dim(XPtr ctx, Rcpp::stop("dimension domain must be a c(lower bound, upper bound) pair"); } std::array _domain = {static_cast(domain_vec[0]), static_cast(domain_vec[1])}; - int16_t _tile_extent = Rcpp::as(tile_extent); + uint16_t _tile_extent = Rcpp::as(tile_extent); auto dim = new tiledb::Dimension(tiledb::Dimension::create(*ctx.get(), name, _domain, _tile_extent)); auto ptr = make_xptr(dim); return ptr; @@ -925,7 +925,7 @@ SEXP libtiledb_dim_get_domain(XPtr dim) { dim->domain().second}); } case TILEDB_UINT16: { - using DataType = tiledb::impl::tiledb_to_type::type; + using DataType = tiledb::impl::tiledb_to_type::type; return IntegerVector({dim->domain().first, dim->domain().second}); } @@ -1027,7 +1027,7 @@ SEXP libtiledb_dim_get_tile_extent(XPtr dim) { return Rcpp::wrap(static_cast(dim->tile_extent())); } case TILEDB_UINT16: { - using DataType = tiledb::impl::tiledb_to_type::type; + using DataType = tiledb::impl::tiledb_to_type::type; return Rcpp::wrap(static_cast(dim->tile_extent())); } case TILEDB_INT32: { From 851018ea5f8df18b92693f34e943b22e62d02418 Mon Sep 17 00:00:00 2001 From: John Kerl Date: Tue, 1 Oct 2024 22:15:58 -0400 Subject: [PATCH 2/2] Fix MacOS rpath (#760) * Fix MacOS rpath * DESCRIPTION NEWS.md [skip ci] --- DESCRIPTION | 2 +- NEWS.md | 3 ++- src/Makevars.in | 19 +++++++++++-------- 3 files changed, 14 insertions(+), 10 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index f14df3c360..ba78185a02 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: tiledb Type: Package -Version: 0.30.1.1 +Version: 0.30.1.2 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 = "dirk@tiledb.com", role = "cre")) diff --git a/NEWS.md b/NEWS.md index d023d0b4fb..7aa9e6392d 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,7 +1,8 @@ # Unreleased -* Fix [#758](https://github.com/TileDB-Inc/TileDB-R/issues/758) "Can't read domain for dimensions of type UINT16" +* [#760](https://github.com/TileDB-Inc/TileDB-R/issues/758) Fix MacOS `rpath` +* [#758](https://github.com/TileDB-Inc/TileDB-R/issues/758) Fix "Can't read domain for dimensions of type UINT16" # tiledb 0.30.1 diff --git a/src/Makevars.in b/src/Makevars.in index 507a774559..114d4cca8e 100644 --- a/src/Makevars.in +++ b/src/Makevars.in @@ -11,14 +11,17 @@ LIB_CON_DIR = ../inst/lib$(R_ARCH) LIB_CON = $(LIB_CON_DIR)/libconnection@DYLIB_EXT@ all: $(OBJECTS) $(LIB_CON) $(SHLIB) - # if we are - # - on macOS aka Darwin which needs this - # - the library is present (implying non-system library use) - # then let us call install_name_tool - @if [ `uname -s` = 'Darwin' ] && [ -f ../inst/tiledb/lib/libtiledb.dylib ] && [ -f tiledb.so ]; then \ - install_name_tool -change libz.1.dylib @rpath/libz.1.dylib ../inst/tiledb/lib/libtiledb.dylib; \ - install_name_tool -add_rpath @loader_path/../tiledb/lib tiledb.so; \ - install_name_tool -add_rpath @loader_path/../tiledb/lib $(LIB_CON); \ + # On macOS aka Darwin we call install_name_tool + # Case one: If we had a downloaded TileDB Core artifact, adjust zlib path and add to @rpath + # Case two: If we see the system libraries (on macOS) ensure /usr/local/lib rpath is considered + @if [ `uname -s` = 'Darwin' ] && [ -f tiledb.so ]; then \ + if [ -f ../inst/tiledb/lib/libtiledb.dylib ] ; then \ + install_name_tool -change libz.1.dylib @rpath/libz.1.dylib ../inst/tiledb/lib/libtiledb.dylib; \ + install_name_tool -add_rpath @loader_path/../tiledb/lib tiledb.so; \ + fi; \ + if [ -f /usr/local/lib/libtiledb.dylib ] ; then \ + install_name_tool -add_rpath /usr/local/lib tiledb.so; \ + fi; \ fi $(LIB_CON): connection/connection.o