Skip to content

Commit d0f0bb0

Browse files
authored
[r] Repace $attributes() accessor with one that uses libtiledbsoma (#3834)
Replace `TileDBArray$attributes()` with new `SOMAArrayBase$attributes()`; this method uses a libtiledbsoma/Rcpp function rather than `tiledb::attrs()` and returns a named list instead of a tiledb-r wrapper around external pointers [SC-64814](https://app.shortcut.com/tiledb-inc/story/64814) continues work for #2406
1 parent 691a15e commit d0f0bb0

12 files changed

+270
-8
lines changed

apis/r/R/RcppExports.R

+4
Original file line numberDiff line numberDiff line change
@@ -246,6 +246,10 @@ c_allows_dups <- function(uri, ctxxp) {
246246
.Call(`_tiledbsoma_c_allows_dups`, uri, ctxxp)
247247
}
248248

249+
c_attributes <- function(uri, ctxxp) {
250+
.Call(`_tiledbsoma_c_attributes`, uri, ctxxp)
251+
}
252+
249253
resize <- function(uri, new_shape, function_name_for_messages, check_only, ctxxp) {
250254
.Call(`_tiledbsoma_resize`, uri, new_shape, function_name_for_messages, check_only, ctxxp)
251255
}

apis/r/R/SOMAArrayBase.R

+24
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,30 @@ SOMAArrayBase <- R6::R6Class(
1616
#'
1717
allows_duplicates = \() c_allows_dups(self$uri, private$.soma_context),
1818

19+
#' @description Retrieve the array attributes
20+
#'
21+
#' @return A named list of array attributes; each entry contains the
22+
#' following named entries:
23+
#' \itemize{
24+
#' \item \dQuote{\code{name}}: name of the attribute
25+
#' \item \dQuote{\code{type}}: datatype of the attribute
26+
#' \item \dQuote{\code{ncells}}: number of values per dimension cell
27+
#' \item \dQuote{\code{nullable}}: is the attribute nullable
28+
#' \item \dQuote{\code{filter_list}}: a list with filter information; this
29+
#' list contains the following entries:
30+
#' \itemize{
31+
#' \item \dQuote{\code{filter_type}}
32+
#' \item \dQuote{\code{compression_level}}
33+
#' \item \dQuote{\code{bit_width}}
34+
#' \item \dQuote{\code{positive_delta}}
35+
#' \item \dQuote{\code{float_bytewidth}}
36+
#' \item \dQuote{\code{float_factor}}
37+
#' \item \dQuote{\code{float_offset}}
38+
#' }
39+
#' }
40+
#'
41+
attributes = \() c_attributes(self$uri, private$.soma_context),
42+
1943
#' @description Is an array sparse?
2044
#'
2145
#' @return \code{TRUE} if the underlying TileDB array is sparse;

apis/r/man/SOMAArrayBase.Rd

+32-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/r/man/SOMADataFrame.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/r/man/SOMADenseNDArray.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/r/man/SOMANDArrayBase.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/r/man/SOMASparseNDArray.Rd

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

apis/r/src/RcppExports.cpp

+13
Original file line numberDiff line numberDiff line change
@@ -576,6 +576,18 @@ BEGIN_RCPP
576576
return rcpp_result_gen;
577577
END_RCPP
578578
}
579+
// c_attributes
580+
Rcpp::List c_attributes(const std::string& uri, Rcpp::XPtr<somactx_wrap_t> ctxxp);
581+
RcppExport SEXP _tiledbsoma_c_attributes(SEXP uriSEXP, SEXP ctxxpSEXP) {
582+
BEGIN_RCPP
583+
Rcpp::RObject rcpp_result_gen;
584+
Rcpp::RNGScope rcpp_rngScope_gen;
585+
Rcpp::traits::input_parameter< const std::string& >::type uri(uriSEXP);
586+
Rcpp::traits::input_parameter< Rcpp::XPtr<somactx_wrap_t> >::type ctxxp(ctxxpSEXP);
587+
rcpp_result_gen = Rcpp::wrap(c_attributes(uri, ctxxp));
588+
return rcpp_result_gen;
589+
END_RCPP
590+
}
579591
// resize
580592
std::string resize(const std::string& uri, Rcpp::NumericVector new_shape, std::string function_name_for_messages, bool check_only, Rcpp::XPtr<somactx_wrap_t> ctxxp);
581593
RcppExport SEXP _tiledbsoma_resize(SEXP uriSEXP, SEXP new_shapeSEXP, SEXP function_name_for_messagesSEXP, SEXP check_onlySEXP, SEXP ctxxpSEXP) {
@@ -866,6 +878,7 @@ static const R_CallMethodDef CallEntries[] = {
866878
{"_tiledbsoma_c_schema", (DL_FUNC) &_tiledbsoma_c_schema, 2},
867879
{"_tiledbsoma_c_is_sparse", (DL_FUNC) &_tiledbsoma_c_is_sparse, 2},
868880
{"_tiledbsoma_c_allows_dups", (DL_FUNC) &_tiledbsoma_c_allows_dups, 2},
881+
{"_tiledbsoma_c_attributes", (DL_FUNC) &_tiledbsoma_c_attributes, 2},
869882
{"_tiledbsoma_resize", (DL_FUNC) &_tiledbsoma_resize, 5},
870883
{"_tiledbsoma_resize_soma_joinid_shape", (DL_FUNC) &_tiledbsoma_resize_soma_joinid_shape, 4},
871884
{"_tiledbsoma_tiledbsoma_upgrade_shape", (DL_FUNC) &_tiledbsoma_tiledbsoma_upgrade_shape, 5},

0 commit comments

Comments
 (0)