diff --git a/DESCRIPTION b/DESCRIPTION index fffd2e05de..251df8cabb 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,6 +1,6 @@ Package: tiledb Type: Package -Version: 0.20.1.3 +Version: 0.20.1.4 Title: Universal Storage Engine for Sparse and Dense Multidimensional 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 4213ba3d27..4fbd07b802 100644 --- a/NEWS.md +++ b/NEWS.md @@ -12,6 +12,10 @@ * The tile extend getter function is now able to access a wider range of possible values (#577) +## Build and Test Systems + +* The minimal version of TileDB Embedded that can be used with the R package is now release 2.7.0 (#578) + # tilebd 0.20.1 diff --git a/R/ArraySchema.R b/R/ArraySchema.R index 52d980d4cb..3604d4d29b 100644 --- a/R/ArraySchema.R +++ b/R/ArraySchema.R @@ -84,7 +84,7 @@ tiledb_array_schema <- function(domain, "tile_order argument must be a scalar string" = is.scalar(tile_order, "character"), "coords_filter_list must be a filter list" = is.null(coords_filter_list) || is(coords_filter_list, "tiledb_filter_list"), "offsets_filter_list must be a filter_list" = is.null(offsets_filter_list) || is(offsets_filter_list, "tiledb_filter_list"), - "validity_filter_list must be a_filter_list" = is.null(validity_filter_list) || is(validity_filter_list, "tiledb_filter_list") || (tiledb_version(TRUE) < "2.6.0"), + "validity_filter_list must be a_filter_list" = is.null(validity_filter_list) || is(validity_filter_list, "tiledb_filter_list"), "'sparse' must be TRUE or FALSE" = is.logical(sparse), "'allows_dups' must be TRUE or FALSE" = is.logical(allows_dups), "'allows_dups' requires 'sparse' TRUE" = !allows_dups || sparse) @@ -93,7 +93,7 @@ tiledb_array_schema <- function(domain, attr_ptr_list <- if (is.list(attrs)) lapply(attrs, function(obj) slot(obj, "ptr")) else list() coords_filter_list_ptr <- if (!is.null(coords_filter_list)) coords_filter_list@ptr else NULL offsets_filter_list_ptr <- if (!is.null(offsets_filter_list)) offsets_filter_list@ptr else NULL - validity_filter_list_ptr <- if (tiledb_version(TRUE) >= "2.6.0" && !is.null(validity_filter_list)) validity_filter_list@ptr else NULL + validity_filter_list_ptr <- if (!is.null(validity_filter_list)) validity_filter_list@ptr else NULL ptr <- libtiledb_array_schema(ctx@ptr, domain@ptr, attr_ptr_list, cell_order, tile_order, coords_filter_list_ptr, offsets_filter_list_ptr, @@ -143,7 +143,7 @@ setMethod("show", signature(object = "tiledb_array_schema"), fl <- filter_list(object) nfc <- nfilters(fl$coords) nfo <- nfilters(fl$offsets) - nfv <- if (tiledb_version(TRUE) >= "2.6.0") nfilters(fl$validity) else 0 + nfv <- nfilters(fl$validity) cat("tiledb_array_schema(\n domain=", .as_text_domain(domain(object)), ",\n", " attrs=c(\n ", paste(sapply(attrs(object), .as_text_attribute), collapse=",\n "), "\n ),\n", " cell_order=\"", cell_order(object), "\", ", @@ -155,7 +155,7 @@ setMethod("show", signature(object = "tiledb_array_schema"), sep="") if (nfc > 0) cat(" coords_filter_list=", .as_text_filter_list(fl$coords), if (nfo + nfv > 0) "," else "", "\n", sep="") if (nfo > 0) cat(" offsets_filter_list=", .as_text_filter_list(fl$offsets), if (nfv > 0) ",\n" else "", sep="") - if (tiledb_version(TRUE) >= "2.6.0" && nfv > 0) + if (nfv > 0) cat(" validity_filter_list=", .as_text_filter_list(fl$validity), "\n", sep="") cat(")\n", sep="") #cat("tiledb_array_create(uri=tempfile(), schema=sch)) # or assign your URI here\n") @@ -325,10 +325,10 @@ setGeneric("filter_list<-", function(x, value) standardGeneric("filter_list<-")) setMethod("filter_list", "tiledb_array_schema", function(object) { coords_ptr <- libtiledb_array_schema_get_coords_filter_list(object@ptr) offsets_ptr <- libtiledb_array_schema_get_offsets_filter_list(object@ptr) - validity_ptr <- if (tiledb_version(TRUE) >= "2.6.0") libtiledb_array_schema_get_validity_filter_list(object@ptr) else NULL + validity_ptr <- libtiledb_array_schema_get_validity_filter_list(object@ptr) return(c(coords = tiledb_filter_list.from_ptr(coords_ptr), offsets = tiledb_filter_list.from_ptr(offsets_ptr), - validity = if (tiledb_version(TRUE) >= "2.6.0") tiledb_filter_list.from_ptr(validity_ptr) else NULL)) + validity = tiledb_filter_list.from_ptr(validity_ptr))) }) # ' Set the Filter List for a TileDB Schema @@ -377,8 +377,7 @@ tiledb_array_schema_set_offsets_filter_list <- function(sch, fl) { #' @export tiledb_array_schema_set_validity_filter_list <- function(sch, fl) { stopifnot(`The 'sch' argument must be a tiledb_array_schema object` = is(sch, "tiledb_array_schema"), - `The 'fl' argument must be a tiledb_filter_list object` = is(fl, "tiledb_filter_list"), - `This function requires TileDB 2.6.0 or later` = tiledb_version(TRUE) >= "2.6.0") + `The 'fl' argument must be a tiledb_filter_list object` = is(fl, "tiledb_filter_list")) sch@ptr <- libtiledb_array_schema_set_validity_filter_list(sch@ptr, fl@ptr) sch } @@ -701,11 +700,9 @@ tiledb_schema_object <- function(array) { n_offsets <- nfilters(filterlist$offsets) offsets <- sapply(seq_len(n_offsets), function(i) tiledb_filter_type(filterlist$offsets[i-1])) offsetopts <- sapply(seq_len(n_offsets), function(i) .getFilterOption(filterlist$offsets[i-1])) - if (tiledb_version(TRUE) >= "2.6.0") { - n_validity <- nfilters(filterlist$validity) - validity <- sapply(seq_len(n_validity), function(i) tiledb_filter_type(filterlist$validity[i-1])) - validityopts <- sapply(seq_len(n_validity), function(i) .getFilterOption(filterlist$validity[i-1])) - } + n_validity <- nfilters(filterlist$validity) + validity <- sapply(seq_len(n_validity), function(i) tiledb_filter_type(filterlist$validity[i-1])) + validityopts <- sapply(seq_len(n_validity), function(i) .getFilterOption(filterlist$validity[i-1])) arrdesc <- data.frame(uri = uri, type = if (sparse) "sparse" else "dense", @@ -717,8 +714,8 @@ tiledb_schema_object <- function(array) { coord_options = paste0(coordopts, collapse=","), offset_filters = paste0(offsets, collapse=","), offset_options = paste0(offsetopts, collapse=","), - validity_filters = if (tiledb_version(TRUE) >= "2.6.0") paste0(validity, collapse=",") else "", - validity_options = if (tiledb_version(TRUE) >= "2.6.0") paste0(validityopts, collapse=",") else "" + validity_filters = paste0(validity, collapse=","), + validity_options = paste0(validityopts, collapse=",") ) dims <- dimensions(dom) @@ -757,7 +754,7 @@ tiledb_schema_object <- function(array) { if (nfilters(fltlst) == 0) "" else sapply(seq_len(nfilters(fltlst)), function(i) .getFilterOption(fltlst[i-1])) })) - attrfillvals <- sapply(attrs, function(a) if (tiledb_attribute_get_nullable(a) || tiledb_version(TRUE) < "2.1.0") "" + attrfillvals <- sapply(attrs, function(a) if (tiledb_attribute_get_nullable(a)) "" else format(tiledb_attribute_get_fill_value(a))) attrdesc <- data.frame(names = attrnames, @@ -839,12 +836,9 @@ tiledb_schema_object <- function(array) { ifelse(sch$offset_filters != "", .show_filter_list(sch$offset_filters, sch$offset_options, "\n\t\t\t offsets_filter_list="), "offset_filters=NULL"), ", ", - ifelse(tiledb_version(TRUE) >= "2.6.0", - ifelse(sch$validity_filters != "", - .show_filter_list(sch$validity_filters, sch$validity_options, "\n\t\t\t validity_filter_list="), - "validity_filters=NULL"), - ""), - ")\n", + ifelse(sch$validity_filters != "", + .show_filter_list(sch$validity_filters, sch$validity_options, "\n\t\t\t validity_filter_list="), + "validity_filters=NULL"), ")\n", "tiledb_array_create(uri=tempfile(), schema=sch)) # or assign your URI here\n", sep="") } diff --git a/R/ArraySchemaEvolution.R b/R/ArraySchemaEvolution.R index 81c2e24504..77c80e966b 100644 --- a/R/ArraySchemaEvolution.R +++ b/R/ArraySchemaEvolution.R @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2021 TileDB Inc. +# Copyright (c) 2023 TileDB Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -34,8 +34,7 @@ setClass("tiledb_array_schema_evolution", #' @return A 'array_schema_evolution' object #' @export tiledb_array_schema_evolution <- function(ctx = tiledb_get_context()) { - stopifnot(`The 'ctx' argument must be a Context object` = is(ctx, "tiledb_ctx"), - `This function needs TileDB 2.4.0 or newer` = tiledb_version(TRUE) >= "2.4.0") + stopifnot(`The 'ctx' argument must be a Context object` = is(ctx, "tiledb_ctx")) ptr <- libtiledb_array_schema_evolution(ctx@ptr) array_schema_evolution <- new("tiledb_array_schema_evolution", ptr = ptr) invisible(array_schema_evolution) diff --git a/R/BatchedQuery.R b/R/BatchedQuery.R index f736f1fdf5..ab891ee7c6 100644 --- a/R/BatchedQuery.R +++ b/R/BatchedQuery.R @@ -219,7 +219,7 @@ createBatched <- function(x) { res <- libtiledb_query_get_est_result_size(qryptr, name) else if (!is.na(varnum) && nullable) res <- libtiledb_query_get_est_result_size_nullable(qryptr, name)[1] - if (rangeunset && tiledb::tiledb_version(TRUE) >= "2.2.0") { + if (rangeunset) { sz <- tiledb_datatype_string_to_sizeof(datatype) res <- res / sz } diff --git a/R/Config.R b/R/Config.R index 407dd798b3..e81f6992f7 100644 --- a/R/Config.R +++ b/R/Config.R @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2017-2021 TileDB Inc. +# Copyright (c) 2017-2023 TileDB Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -234,15 +234,8 @@ limitTileDBCores <- function(ncores, verbose=FALSE) { } stopifnot(`The 'ncores' argument must be numeric or character` = is.numeric(ncores) || is.character(ncores)) cfg <- tiledb_config() - if (tiledb_version(TRUE) >= "2.1.0") { - cfg["sm.compute_concurrency_level"] <- ncores - cfg["sm.io_concurrency_level"] <- ncores - } else { - cfg["sm.num_reader_threads"] <- ncores - cfg["sm.num_writer_threads"] <- ncores - cfg["vfs.file.max_parallel_ops"] <- ncores - cfg["vfs.num_threads"] <- ncores - } + cfg["sm.compute_concurrency_level"] <- ncores + cfg["sm.io_concurrency_level"] <- ncores if (verbose) message("Limiting TileDB to ",ncores," cores. See ?limitTileDBCores.") invisible(cfg) } diff --git a/R/Ctx.R b/R/Ctx.R index 962a9f9c6a..426475eb72 100644 --- a/R/Ctx.R +++ b/R/Ctx.R @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2017-2021 TileDB Inc. +# Copyright (c) 2017-2023 TileDB Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -194,7 +194,6 @@ tiledb_ctx_set_default_tags <- function(object) { #' @return A JSON-formatted string with context statistics #' @export tiledb_ctx_stats <- function(object = tiledb_get_context()) { - stopifnot(`The 'object' variable must be a TileDB Context object` = is(object, "tiledb_ctx"), - `TileDB 2.4.0 or later is required` = tiledb_version(TRUE) >= "2.4.0") + stopifnot(`The 'object' variable must be a TileDB Context object` = is(object, "tiledb_ctx")) libtiledb_ctx_stats(object@ptr) } diff --git a/R/Error.R b/R/Error.R index 2972ea33a8..193bbbb750 100644 --- a/R/Error.R +++ b/R/Error.R @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2017-2021 TileDB Inc. +# Copyright (c) 2017-2023 TileDB Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -28,7 +28,6 @@ #' @return A character variable with the error message #' @export tiledb_error_message <- function(ctx = tiledb_get_context()) { - stopifnot(`The 'ctx' variable must be a TileDB Context object` = is(ctx, "tiledb_ctx"), - `TileDB 2.5.0 or later is required` = tiledb_version(TRUE) >= "2.5.0") + stopifnot(`The 'ctx' variable must be a TileDB Context object` = is(ctx, "tiledb_ctx")) libtiledb_error_message(ctx@ptr) } diff --git a/R/Query.R b/R/Query.R index b79ae9f23d..34a9d47fc3 100644 --- a/R/Query.R +++ b/R/Query.R @@ -568,8 +568,7 @@ tiledb_get_query_status <- function() { #' @return A JSON-formatted string with context statistics #' @export tiledb_query_stats <- function(query) { - stopifnot(`The 'query' argument must be a TileDB Query object` = is(query, "tiledb_query"), - `TileDB 2.4.0 or later is required` = tiledb_version(TRUE) >= "2.4.0") + stopifnot(`The 'query' argument must be a TileDB Query object` = is(query, "tiledb_query")) libtiledb_query_stats(query@ptr) } @@ -579,8 +578,7 @@ tiledb_query_stats <- function(query) { #' @return A TileDB Context object retrieved from the query #' @export tiledb_query_ctx <- function(query) { - stopifnot(`The 'query' argument must be a TileDB Query object` = is(query, "tiledb_query"), - `TileDB 2.6.0 or later is required` = tiledb_version(TRUE) >= "2.6.0") + stopifnot(`The 'query' argument must be a TileDB Query object` = is(query, "tiledb_query")) new("tiledb_ctx", ptr = libtiledb_query_get_ctx(query@ptr)) } diff --git a/R/QueryCondition.R b/R/QueryCondition.R index fcf3af446e..455388cd8a 100644 --- a/R/QueryCondition.R +++ b/R/QueryCondition.R @@ -37,8 +37,7 @@ setClass("tiledb_query_condition", #' @return A 'tiledb_query_condition' object #' @export tiledb_query_condition <- function(ctx = tiledb_get_context()) { - stopifnot("The argument must be a ctx object" = is(ctx, "tiledb_ctx"), - "This function needs TileDB 2.3.0 or newer" = tiledb_version(TRUE) >= "2.3.0") + stopifnot("The argument must be a ctx object" = is(ctx, "tiledb_ctx")) ptr <- libtiledb_query_condition(ctx@ptr) query_condition <- new("tiledb_query_condition", ptr = ptr, init = FALSE) invisible(query_condition) diff --git a/R/Stats.R b/R/Stats.R index 966faf8008..e1efdb9527 100644 --- a/R/Stats.R +++ b/R/Stats.R @@ -73,14 +73,10 @@ tiledb_stats_print <- function() { #' This function requires TileDB Embedded 2.0.3 or later. #' @examples #' \dontshow{ctx <- tiledb_ctx(limitTileDBCores())} -#' if (tiledb_version(TRUE) >= "2.0.3") { -#' txt <- tiledb_stats_raw_dump() -#' cat(txt, "\n") -#' } +#' txt <- tiledb_stats_raw_dump() +#' cat(txt, "\n") #' @export tiledb_stats_raw_dump <- function() { - stopifnot("Raw statistics are available with TileDB Embedded verion 2.0.3 or later" = - tiledb_version(TRUE) >= "2.0.3") libtiledb_stats_raw_dump() } @@ -90,8 +86,6 @@ tiledb_stats_raw_dump <- function() { #' It required TileDB Embedded 2.0.3 or later. #' @export tiledb_stats_raw_print <- function() { - stopifnot("Raw statistics are available with TileDB Embedded verion 2.0.3 or later" - = tiledb_version(TRUE) >= "2.0.3") cat(libtiledb_stats_raw_dump(), "\n") } @@ -102,8 +96,6 @@ tiledb_stats_raw_print <- function() { #' It required TileDB Embedded 2.0.3 or later. #' @export tiledb_stats_raw_get <- function() { - stopifnot("Raw statistics are available with TileDB Embedded verion 2.0.3 or later" - = tiledb_version(TRUE) >= "2.0.3") .Deprecated(msg="Use 'tiledb_stats_raw_dump' instead of 'tiledb_stats_raw_get'.") libtiledb_stats_raw_get() } diff --git a/R/Subarray.R b/R/Subarray.R index ad2a4168c0..8922a9998a 100644 --- a/R/Subarray.R +++ b/R/Subarray.R @@ -1,6 +1,6 @@ # MIT License # -# Copyright (c) 2017-2022 TileDB Inc. +# Copyright (c) 2017-2023 TileDB Inc. # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal @@ -39,8 +39,7 @@ tiledb_subarray.from_ptr <- function(ptr) { #' @return tiledb_subarray object #' @export tiledb_subarray <- function(query) { - stopifnot("Argument 'query' must be a tiledb_query object" = is(query, "tiledb_query"), - "Subarray functionality needs TileDB >= 2.7.0" = tiledb_version(TRUE) >= "2.6.0") + stopifnot("Argument 'query' must be a tiledb_query object" = is(query, "tiledb_query")) ptr <- libtiledb_subarray(query@ptr) return(new("tiledb_subarray", ptr = ptr)) } diff --git a/R/TileDBArray.R b/R/TileDBArray.R index 3e38cebb7c..45809a6762 100644 --- a/R/TileDBArray.R +++ b/R/TileDBArray.R @@ -815,7 +815,7 @@ setMethod("[", "tiledb_array", res <- libtiledb_query_get_est_result_size_nullable(qryptr, name)[1] spdl::debug("[getEstimatedSize] column '{}' (!is.na(varnum) and nullable) {}", name, res) } - if (rangeunset && tiledb::tiledb_version(TRUE) >= "2.2.0") { + if (rangeunset) { sz <- tiledb_datatype_string_to_sizeof(datatype) res <- res / sz spdl::debug("[getEstimatedSize] column '{}' rangeunset and res scaled to {}", name, res) @@ -1629,15 +1629,13 @@ array_consolidate <- function(uri, cfg = NULL, } if (!missing(start_time)) { - stopifnot(`Argument 'start_time' must be datetime object` = inherits(start_time, "POSIXt"), - `TileDB 2.3.0 or later is required` = tiledb_version(TRUE) >= "2.3.0") + stopifnot(`Argument 'start_time' must be datetime object` = inherits(start_time, "POSIXt")) start_time_int64 <- bit64::as.integer64(as.numeric(start_time) * 1000) cfg["sm.consolidation.timestamp_start"] = as.character(start_time_int64) } if (!missing(end_time)) { - stopifnot(`Argument 'end_time' must be datetime object` = inherits(end_time, "POSIXt"), - `TileDB 2.3.0 or later is required` = tiledb_version(TRUE) >= "2.3.0") + stopifnot(`Argument 'end_time' must be datetime object` = inherits(end_time, "POSIXt")) end_time_int64 <- bit64::as.integer64(as.numeric(end_time) * 1000) cfg["sm.consolidation.timestamp_end"] = as.character(end_time_int64) } @@ -1673,15 +1671,13 @@ array_vacuum <- function(uri, cfg = NULL, } if (!missing(start_time)) { - stopifnot(`Argument 'start_time' must be datetime object` = inherits(start_time, "POSIXt"), - `TileDB 2.3.0 or later is required` = tiledb_version(TRUE) >= "2.3.0") + stopifnot(`Argument 'start_time' must be datetime object` = inherits(start_time, "POSIXt")) start_time_int64 <- bit64::as.integer64(as.numeric(start_time) * 1000) cfg["sm.consolidation.timestamp_start"] = as.character(start_time_int64) } if (!missing(end_time)) { - stopifnot(`Argument 'end_time' must be datetime object` = inherits(end_time, "POSIXt"), - `TileDB 2.3.0 or later is required` = tiledb_version(TRUE) >= "2.3.0") + stopifnot(`Argument 'end_time' must be datetime object` = inherits(end_time, "POSIXt")) end_time_int64 <- bit64::as.integer64(as.numeric(end_time) * 1000) cfg["sm.consolidation.timestamp_end"] = as.character(end_time_int64) } diff --git a/configure b/configure index 481ceecd4d..e7a914f0f7 100755 --- a/configure +++ b/configure @@ -1,6 +1,6 @@ #! /bin/sh # Guess values for system-dependent variables and create Makefiles. -# Generated by GNU Autoconf 2.71 for TileDB-R 0.19.1. +# Generated by GNU Autoconf 2.71 for TileDB-R 0.20.1. # # # Copyright (C) 1992-1996, 1998-2017, 2020-2021 Free Software Foundation, @@ -607,8 +607,8 @@ MAKEFLAGS= # Identity of this package. PACKAGE_NAME='TileDB-R' PACKAGE_TARNAME='tiledb-r' -PACKAGE_VERSION='0.19.1' -PACKAGE_STRING='TileDB-R 0.19.1' +PACKAGE_VERSION='0.20.1' +PACKAGE_STRING='TileDB-R 0.20.1' PACKAGE_BUGREPORT='' PACKAGE_URL='' @@ -1269,7 +1269,7 @@ if test "$ac_init_help" = "long"; then # Omit some internal or obsolete options to make the list less imposing. # This message is too long to be a string in the A/UX 3.1 sh. cat <<_ACEOF -\`configure' configures TileDB-R 0.19.1 to adapt to many kinds of systems. +\`configure' configures TileDB-R 0.20.1 to adapt to many kinds of systems. Usage: $0 [OPTION]... [VAR=VALUE]... @@ -1331,7 +1331,7 @@ fi if test -n "$ac_init_help"; then case $ac_init_help in - short | recursive ) echo "Configuration of TileDB-R 0.19.1:";; + short | recursive ) echo "Configuration of TileDB-R 0.20.1:";; esac cat <<\_ACEOF @@ -1424,7 +1424,7 @@ fi test -n "$ac_init_help" && exit $ac_status if $ac_init_version; then cat <<\_ACEOF -TileDB-R configure 0.19.1 +TileDB-R configure 0.20.1 generated by GNU Autoconf 2.71 Copyright (C) 2021 Free Software Foundation, Inc. @@ -1571,7 +1571,7 @@ cat >config.log <<_ACEOF This file contains any messages produced by compilers while running configure, to aid debugging if configure makes a mistake. -It was created by TileDB-R $as_me 0.19.1, which was +It was created by TileDB-R $as_me 0.20.1, which was generated by GNU Autoconf 2.71. Invocation command line was $ $0$ac_configure_args_raw @@ -2695,11 +2695,11 @@ if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 printf %s "checking for $CXX option to enable C++11 features... " >&6; } -if test ${ac_cv_prog_cxx_11+y} +if test ${ac_cv_prog_cxx_cxx11+y} then : printf %s "(cached) " >&6 else $as_nop - ac_cv_prog_cxx_11=no + ac_cv_prog_cxx_cxx11=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -2741,11 +2741,11 @@ if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 printf %s "checking for $CXX option to enable C++98 features... " >&6; } -if test ${ac_cv_prog_cxx_98+y} +if test ${ac_cv_prog_cxx_cxx98+y} then : printf %s "(cached) " >&6 else $as_nop - ac_cv_prog_cxx_98=no + ac_cv_prog_cxx_cxx98=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -3195,11 +3195,11 @@ if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++11 features" >&5 printf %s "checking for $CXX option to enable C++11 features... " >&6; } -if test ${ac_cv_prog_cxx_11+y} +if test ${ac_cv_prog_cxx_cxx11+y} then : printf %s "(cached) " >&6 else $as_nop - ac_cv_prog_cxx_11=no + ac_cv_prog_cxx_cxx11=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -3241,11 +3241,11 @@ if test x$ac_prog_cxx_stdcxx = xno then : { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for $CXX option to enable C++98 features" >&5 printf %s "checking for $CXX option to enable C++98 features... " >&6; } -if test ${ac_cv_prog_cxx_98+y} +if test ${ac_cv_prog_cxx_cxx98+y} then : printf %s "(cached) " >&6 else $as_nop - ac_cv_prog_cxx_98=no + ac_cv_prog_cxx_cxx98=no ac_save_CXX=$CXX cat confdefs.h - <<_ACEOF >conftest.$ac_ext /* end confdefs.h. */ @@ -5949,12 +5949,12 @@ if test x"${have_pkg_config}" != x"no"; then { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pkg-config checking TileDB version" >&5 printf %s "checking for pkg-config checking TileDB version... " >&6; } if pkg-config --atleast-version=2.0.0 tiledb; then - { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: >= 2.0.0" >&5 -printf "%s\n" ">= 2.0.0" >&6; } + { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: >= 2.7.0" >&5 +printf "%s\n" ">= 2.7.0" >&6; } else { printf "%s\n" "$as_me:${as_lineno-$LINENO}: result: insufficient" >&5 printf "%s\n" "insufficient" >&6; } - as_fn_error $? "TileDB Embedded 2.0.0 or later is required." "$LINENO" 5 + as_fn_error $? "TileDB Embedded 2.7.0 or later is required." "$LINENO" 5 fi { printf "%s\n" "$as_me:${as_lineno-$LINENO}: checking for pkg-config checking TileDB deprecation silencer" >&5 printf %s "checking for pkg-config checking TileDB deprecation silencer... " >&6; } @@ -6859,7 +6859,7 @@ cat >>$CONFIG_STATUS <<\_ACEOF || ac_write_fail=1 # report actual input values of CONFIG_FILES etc. instead of their # values after options handling. ac_log=" -This file was extended by TileDB-R $as_me 0.19.1, which was +This file was extended by TileDB-R $as_me 0.20.1, which was generated by GNU Autoconf 2.71. Invocation command line was CONFIG_FILES = $CONFIG_FILES @@ -6914,7 +6914,7 @@ ac_cs_config_escaped=`printf "%s\n" "$ac_cs_config" | sed "s/^ //; s/'/'\\\\\\\\ cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1 ac_cs_config='$ac_cs_config_escaped' ac_cs_version="\\ -TileDB-R config.status 0.19.1 +TileDB-R config.status 0.20.1 configured by $0, generated by GNU Autoconf 2.71, with options \\"\$ac_cs_config\\" diff --git a/configure.ac b/configure.ac index a43d94dbff..332eb80ecd 100644 --- a/configure.ac +++ b/configure.ac @@ -24,7 +24,7 @@ ## require at least autoconf 2.69 AC_PREREQ([2.69]) -AC_INIT([TileDB-R],[0.19.1]) +AC_INIT([TileDB-R],[0.20.1]) ## -- Part 1: Setup ------------------------------------------------------------- ## @@ -81,10 +81,10 @@ fi if test x"${have_pkg_config}" != x"no"; then AC_MSG_CHECKING([for pkg-config checking TileDB version]) if pkg-config --atleast-version=2.0.0 tiledb; then - AC_MSG_RESULT([>= 2.0.0]) + AC_MSG_RESULT([>= 2.7.0]) else AC_MSG_RESULT([insufficient]) - AC_MSG_ERROR([TileDB Embedded 2.0.0 or later is required.]) + AC_MSG_ERROR([TileDB Embedded 2.7.0 or later is required.]) fi AC_MSG_CHECKING([for pkg-config checking TileDB deprecation silencer]) if pkg-config --atleast-version=2.15.0 tiledb; then diff --git a/inst/tinytest/test_arrowio.R b/inst/tinytest/test_arrowio.R index de1a3a740f..67af14d35d 100644 --- a/inst/tinytest/test_arrowio.R +++ b/inst/tinytest/test_arrowio.R @@ -6,8 +6,6 @@ if (isOldWindows) exit_file("skip this file on old Windows releases") ctx <- tiledb_ctx(limitTileDBCores()) -if (tiledb_version(TRUE) < "2.2.0") exit_file("TileDB ArrowIO types required TileDB 2.2.* or greater") - if (!requireNamespace("arrow", quietly=TRUE)) exit_file("No 'arrow' package.") suppressMessages(library(arrow)) diff --git a/inst/tinytest/test_attr.R b/inst/tinytest/test_attr.R index 1f66716bbb..7bfeadff68 100644 --- a/inst/tinytest/test_attr.R +++ b/inst/tinytest/test_attr.R @@ -54,7 +54,6 @@ expect_true(is.na(tiledb::cell_val_num(attrs))) #}) #test_that("tiledb_attr set fill", { -if (tiledb_version(TRUE) < "2.7.0") exit_file("Needs TileDB 2.7.* or later") if (isOldWindows) exit_file("skip remainder of this file on old Windows releases") ## test for default @@ -168,7 +167,6 @@ readdata <- arr2[] expect_true(all.equal(data, readdata, check.attributes=FALSE)) -if (tiledb_version(TRUE) < "2.2.0") exit_file("Needs TileDB 2.2.* or later") attrib <- tiledb_attr("a", type = "INT32") tiledb_attribute_set_nullable(attrib, TRUE) expect_true(tiledb_attribute_get_nullable(attrib)) diff --git a/inst/tinytest/test_dataframe.R b/inst/tinytest/test_dataframe.R index 625cb5a4c2..61e20a32e5 100644 --- a/inst/tinytest/test_dataframe.R +++ b/inst/tinytest/test_dataframe.R @@ -12,7 +12,6 @@ uri <- tempfile() irisdf <- within(iris, Species <- as.character(Species)) expect_error(fromDataFrame(uri, irisdf)) # arguments checked, error in this wrong case -if (tiledb_version(TRUE) < "2.7.0") exit_file("Needs TileDB 2.7.* or later") fromDataFrame(irisdf, uri) diff --git a/inst/tinytest/test_datetime.R b/inst/tinytest/test_datetime.R index 0fc9e1454f..2e540e6a50 100644 --- a/inst/tinytest/test_datetime.R +++ b/inst/tinytest/test_datetime.R @@ -3,7 +3,6 @@ library(tiledb) isOldWindows <- Sys.info()[["sysname"]] == "Windows" && grepl('Windows Server 2008', osVersion) if (isOldWindows) exit_file("skip this file on old Windows releases") -if (tiledb_version(TRUE) < "2.7.0") exit_file("Needs TileDB 2.7.* or later") isMacOS <- (Sys.info()['sysname'] == "Darwin") diff --git a/inst/tinytest/test_dim.R b/inst/tinytest/test_dim.R index 40c370497e..4203ccc1dc 100644 --- a/inst/tinytest/test_dim.R +++ b/inst/tinytest/test_dim.R @@ -78,13 +78,11 @@ dim <- tiledb_dim("", c(1, 100), type = "FLOAT64") expect_equal(tiledb::datatype(dim), "FLOAT64") #}) -t#est_that("tiledb_dim dim() method", { +#test_that("tiledb_dim dim() method", { d <- tiledb_dim("", c(-1L, 100L)) expect_equal(dim(d), 102L) #}) -if (tiledb_version(TRUE) < "2.7.0") exit_file("Needs TileDB 2.7.* or later") - ## test permissible types for dimension objects -- cf inst/examples/ex_dimensions.R ## quick check of various dimension types suppressMessages({ diff --git a/inst/tinytest/test_dimsubset.R b/inst/tinytest/test_dimsubset.R index 40ac6d04c9..500912221f 100644 --- a/inst/tinytest/test_dimsubset.R +++ b/inst/tinytest/test_dimsubset.R @@ -9,7 +9,6 @@ isOldWindows <- Sys.info()[["sysname"]] == "Windows" && grepl('Windows Server 20 if (isOldWindows) exit_file("skip this file on old Windows releases") if (!requireNamespace("nycflights13", quietly=TRUE)) exit_file("Needed 'nycflights13' package missing") -if (tiledb_version(TRUE) < "2.7.0") exit_file("Needs TileDB 2.7.* or later") log_setup("test_dimsubset", "warn") # but set the default level to 'warn' -> silent, activate via 'info' ctx <- tiledb_ctx(limitTileDBCores()) diff --git a/inst/tinytest/test_fragmentinfo.R b/inst/tinytest/test_fragmentinfo.R index 6d234069f1..e17a7cd884 100644 --- a/inst/tinytest/test_fragmentinfo.R +++ b/inst/tinytest/test_fragmentinfo.R @@ -1,8 +1,6 @@ library(tinytest) library(tiledb) -if (tiledb_version(TRUE) < "2.2.0") exit_file("Needs TileDB 2.2.* or later") - isOldWindows <- Sys.info()[["sysname"]] == "Windows" && grepl('Windows Server 2008', osVersion) if (isOldWindows) exit_file("skip this file on old Windows releases") isMacOS <- (Sys.info()['sysname'] == "Darwin") diff --git a/inst/tinytest/test_libtiledb.R b/inst/tinytest/test_libtiledb.R index a6465b8303..d5ab6c3476 100644 --- a/inst/tinytest/test_libtiledb.R +++ b/inst/tinytest/test_libtiledb.R @@ -209,7 +209,6 @@ qry <- tiledb:::libtiledb_query_set_buffer(qry, "a1", dat) qry <- tiledb:::libtiledb_query_submit(qry) tiledb:::libtiledb_array_close(arr) expect_true(is(qry, "externalptr")) -if (tiledb_version(TRUE) < "2.7.0") exit_file("Needs TileDB 2.7.* or later") res <- c(0, 0) sub <- c(1L, 2L) diff --git a/inst/tinytest/test_matrix.R b/inst/tinytest/test_matrix.R index 31a63aa0e6..3376e2d418 100644 --- a/inst/tinytest/test_matrix.R +++ b/inst/tinytest/test_matrix.R @@ -4,7 +4,6 @@ library(tiledb) isOldWindows <- Sys.info()[["sysname"]] == "Windows" && grepl('Windows Server 2008', osVersion) if (isOldWindows) exit_file("skip this file on old Windows releases") -if (tiledb_version(TRUE) < "2.7.0") exit_file("Needs TileDB 2.7.* or later") ctx <- tiledb_ctx(limitTileDBCores()) diff --git a/inst/tinytest/test_misc.R b/inst/tinytest/test_misc.R index b3bb03a802..d8f3445b99 100644 --- a/inst/tinytest/test_misc.R +++ b/inst/tinytest/test_misc.R @@ -7,8 +7,6 @@ if (isOldWindows) exit_file("skip this file on old Windows releases") ctx <- tiledb_ctx(limitTileDBCores()) -if (tiledb_version(TRUE) < "2.6.0") exit_file("These tests require TileDB 2.6.0 or newer") - if (is.null(get0("tiledb_error_message"))) exit_file("No 'tiledb_error_message'") expect_true(inherits(tiledb_error_message(), "character")) expect_true(is.character(tiledb_error_message())) diff --git a/inst/tinytest/test_query.R b/inst/tinytest/test_query.R index 8486a1ca45..dfa252b870 100644 --- a/inst/tinytest/test_query.R +++ b/inst/tinytest/test_query.R @@ -198,8 +198,6 @@ expect_equal(tiledb_query_status(qry), "COMPLETE") keydat <- tiledb:::libtiledb_query_get_buffer_ptr(buf, FALSE) -if (tiledb_version(TRUE) < "2.7.0") exit_file("Needs TileDB 2.7.* or later") - n <- tiledb_query_result_buffer_elements(qry, "rows") expect_equal(n, 4L) expect_equal(rowdat[1:n], rows[4:7]) @@ -208,8 +206,6 @@ expect_equal(keydat[1:n], keys[4:7]) n2 <- tiledb:::libtiledb_query_result_buffer_elements(qry@ptr, "rows", 0) expect_equal(n2, 0) # first element can be requested, is zero for fixed-sized -if (tiledb_version(TRUE) < "2.2.0") exit_file("Remaining tests require TileDB 2.2.* or later") - ## not as streamlined as it could, may need a wrapper for schema-from-query arrschptr <- tiledb:::libtiledb_query_get_schema(qry@ptr, tiledb_get_context()@ptr) sch <- tiledb:::tiledb_array_schema.from_ptr(arrschptr) @@ -244,7 +240,6 @@ array <- tiledb_array(tmp, return_as="data.frame") if (packageVersion("tiledb") <= "0.11.0") expect_warning(res <- array[]) # newer versions loop, no warning ## check for query stats -if (tiledb_version(TRUE) < "2.4.0") exit_file("TileDB Query + Ctx stats requires TileDB 2.4.* or greater") res <- tiledb_query_stats(qry) expect_true(is.character(res)) expect_true(nchar(res) > 1000) # safe lower boundary diff --git a/inst/tinytest/test_querycondition.R b/inst/tinytest/test_querycondition.R index e769d5b445..7a084cedbb 100644 --- a/inst/tinytest/test_querycondition.R +++ b/inst/tinytest/test_querycondition.R @@ -12,8 +12,6 @@ if (Sys.getenv("CI") != "") set_allocation_size_preference(1024*1024*5) ctx <- tiledb_ctx(limitTileDBCores()) -if (tiledb_version(TRUE) < "2.3.0") exit_file("TileDB Query Condition requires TileDB 2.3.* or greater") - ## simple data.frame to test against D <- data.frame(a=1:20, b=seq(101,120)+0.5) @@ -139,8 +137,6 @@ tiledb_array_close(arr) rm(qry) -if (tiledb_version(TRUE) < "2.7.0") exit_file("Needs TileDB 2.7.* or later") - ## tiledb_array support if (!requireNamespace("palmerpenguins", quietly=TRUE)) exit_file("remainder needs 'palmerpenguins'") library(palmerpenguins) diff --git a/inst/tinytest/test_shmem.R b/inst/tinytest/test_shmem.R index b543865db8..d7169e26e8 100644 --- a/inst/tinytest/test_shmem.R +++ b/inst/tinytest/test_shmem.R @@ -6,8 +6,6 @@ if (Sys.info()['sysname'] == "Darwin") exit_file("Skip on macOS") ctx <- tiledb_ctx(limitTileDBCores()) -if (tiledb_version(TRUE) < "2.7.0") exit_file("Needs TileDB 2.7.* or later") - uri <- tempfile() fromDataFrame(mtcars, uri) # create an array arr <- tiledb_array(uri, return_as="data.frame") diff --git a/inst/tinytest/test_tiledbarray.R b/inst/tinytest/test_tiledbarray.R index a20d5c63a0..2db2536f00 100644 --- a/inst/tinytest/test_tiledbarray.R +++ b/inst/tinytest/test_tiledbarray.R @@ -4,7 +4,6 @@ library(tiledb) isOldWindows <- Sys.info()[["sysname"]] == "Windows" && grepl('Windows Server 2008', osVersion) if (isOldWindows) exit_file("skip this file on old Windows releases") isMacOS <- (Sys.info()['sysname'] == "Darwin") -if (tiledb_version(TRUE) < "2.7.0") exit_file("Needs TileDB 2.7.* or later") ctx <- tiledb_ctx(limitTileDBCores()) @@ -1205,7 +1204,7 @@ arr2 <- tiledb_array(uri, return_as="matrix") res <- arr2[] expect_equal(dim(res), c(5,4)) expect_equal(sum(is.na(res[1:3,1:2])), 6) # arr[1:3,1:2] all NA -if (tiledb_version(TRUE) < "2.7.0" || Sys.Date() >= as.Date("2022-01-28")) expect_equal(res[1:3,3:4], mat[1:3,3:4]) ## Fix pending, cf SC-13735 +expect_equal(res[1:3,3:4], mat[1:3,3:4]) expect_equal(res[4:5,1:4], mat[4:5,1:4]) ## issue 259 dense array with n>2 dimensions @@ -1234,13 +1233,13 @@ expect_equal(array_consolidate(uri), NULL) expect_error(array_consolidate(uri, start_time="abc")) # not a datetime expect_error(array_consolidate(uri, end_time="def")) # not a datetime now <- Sys.time() -if (tiledb_version(TRUE) >= "2.3.0") expect_equal(array_consolidate(uri, start_time=now-60, end_time=now), NULL) +expect_equal(array_consolidate(uri, start_time=now-60, end_time=now), NULL) ## vaccum expect_equal(array_vacuum(uri), NULL) expect_error(array_vacuum(uri, start_time="abc")) # not a datetime expect_error(array_vacuum(uri, end_time="def")) # not a datetime -if (tiledb_version(TRUE) >= "2.3.0") expect_equal(array_vacuum(uri, start_time=now-60, end_time=now), NULL) +expect_equal(array_vacuum(uri, start_time=now-60, end_time=now), NULL) @@ -1318,7 +1317,6 @@ expect_true(inherits(res, "matrix")) set_return_as_preference(oldConversionValue) # reset baseline value ## test query_statistics setter and getter -if (tiledb_version(TRUE) < "2.4.0") exit_file("TileDB Query stats requires TileDB 2.4.* or greater") uri <- tempfile() fromDataFrame(mtcars, uri) arr <- tiledb_array(uri) diff --git a/inst/tinytest/test_timetravel.R b/inst/tinytest/test_timetravel.R index 81e116d320..bf977d4f79 100644 --- a/inst/tinytest/test_timetravel.R +++ b/inst/tinytest/test_timetravel.R @@ -7,8 +7,6 @@ isMacOS <- (Sys.info()['sysname'] == "Darwin") ctx <- tiledb_ctx(limitTileDBCores()) -if (tiledb_version(TRUE) < "2.7.0") exit_file("Needs TileDB 2.7.* or later") - ## tests formerly in test_tiledbarray.R diff --git a/inst/tinytest/test_timetravel_extra.R b/inst/tinytest/test_timetravel_extra.R index 85ed426fec..da1c10ad4c 100644 --- a/inst/tinytest/test_timetravel_extra.R +++ b/inst/tinytest/test_timetravel_extra.R @@ -8,8 +8,6 @@ isMacOS <- (Sys.info()['sysname'] == "Darwin") ctx <- tiledb_ctx(limitTileDBCores()) -if (tiledb_version(TRUE) < "2.7.0") exit_file("Needs TileDB 2.7.* or later") - ## earlier time travel test recast via timestamp_{start,end} ## time travel diff --git a/src/arrow_adapter.h b/src/arrow_adapter.h index bb7879f5c5..741aa34235 100644 --- a/src/arrow_adapter.h +++ b/src/arrow_adapter.h @@ -146,9 +146,7 @@ class ArrowAdapter { case TILEDB_STRING_UTF8: return "U"; // large because TileDB uses 64bit offsets case TILEDB_CHAR: -#if TILEDB_VERSION >= TileDB_Version(2,7,0) case TILEDB_BLOB: -#endif return "Z"; // large because TileDB uses 64bit offsets #if TILEDB_VERSION >= TileDB_Version(2,10,0) case TILEDB_BOOL: diff --git a/src/arrowio.cpp b/src/arrowio.cpp index eaf9568a03..de8a7caf74 100644 --- a/src/arrowio.cpp +++ b/src/arrowio.cpp @@ -23,10 +23,9 @@ #include "libtiledb.h" #include "tiledb_version.h" #include // for C interface to Arrow -#if TILEDB_VERSION >= TileDB_Version(2,2,0) + //#include #include "tiledb_arrowio.h" -#endif #include "column_buffer.h" #include "arrow_adapter.h" @@ -104,53 +103,38 @@ struct Pointer { }; -#if TILEDB_VERSION >= TileDB_Version(2,2,0) // these functions are local to this compilation unit as is the defintion of Pointer Pointer allocate_arrow_array() { return {}; } Pointer allocate_arrow_schema() { return {}; } void delete_arrow_array(Pointer ptr) { ptr.finalize(); } void delete_arrow_schema(Pointer ptr) { ptr.finalize(); } -#endif // [[Rcpp::export(.allocate_arrow_array_as_xptr)]] SEXP allocate_arrow_array_as_xptr() { -#if TILEDB_VERSION >= TileDB_Version(2,2,0) return allocate_arrow_array(); -#else - return R_NilValue; -#endif } // [[Rcpp::export(.allocate_arrow_schema_as_xptr)]] SEXP allocate_arrow_schema_as_xptr() { -#if TILEDB_VERSION >= TileDB_Version(2,2,0) return allocate_arrow_schema(); -#else - return R_NilValue; -#endif } // [[Rcpp::export(.delete_arrow_array_from_xptr)]] void delete_arrow_array_from_xptr(SEXP sxp) { -#if TILEDB_VERSION >= TileDB_Version(2,2,0) Pointer ptr(sxp); delete_arrow_array(ptr); -#endif } // [[Rcpp::export(.delete_arrow_schema_from_xptr)]] void delete_arrow_schema_from_xptr(SEXP sxp) { -#if TILEDB_VERSION >= TileDB_Version(2,2,0) Pointer ptr(sxp); delete_arrow_schema(ptr); -#endif } // [[Rcpp::export]] Rcpp::List libtiledb_query_export_buffer(XPtr ctx, XPtr query, std::string name) { -#if TILEDB_VERSION >= TileDB_Version(2,2,0) tiledb::arrow::ArrowAdapter adapter(ctx, query); //auto arrptr = allocate_arrow_array(); // external pointer object @@ -164,10 +148,6 @@ Rcpp::List libtiledb_query_export_buffer(XPtr ctx, SEXP xpschema = R_MakeExternalPtr((void*) schptr, R_NilValue, R_NilValue); SEXP xparray = R_MakeExternalPtr((void*) arrptr, R_NilValue, R_NilValue); return Rcpp::List::create(xparray, xpschema); -#else - Rcpp::stop("This function requires TileDB 2.2.0 or greater."); - return Rcpp::List::create(R_NilValue, R_NilValue); // not reached -#endif } // [[Rcpp::export]] @@ -175,15 +155,11 @@ XPtr libtiledb_query_import_buffer(XPtr ctx, XPtr query, std::string name, Rcpp::List arrowpointers) { -#if TILEDB_VERSION >= TileDB_Version(2,2,0) tiledb::arrow::ArrowAdapter adapter(ctx, query); adapter.import_buffer(name.c_str(), R_ExternalPtrAddr(arrowpointers[0]), R_ExternalPtrAddr(arrowpointers[1])); -#else - Rcpp::stop("This function requires TileDB 2.2.0 or greater."); -#endif return(query); } @@ -196,7 +172,6 @@ Rcpp::XPtr array_setup_struct(Rcpp::XPtr arrxp, int64_t Rcpp::List libtiledb_query_export_arrow_table(XPtr ctx, XPtr query, std::vector names) { -#if TILEDB_VERSION >= TileDB_Version(2,2,0) size_t ncol = names.size(); tiledb::arrow::ArrowAdapter adapter(ctx, query); @@ -231,10 +206,6 @@ Rcpp::List libtiledb_query_export_arrow_table(XPtr ctx, Rcpp::List as = Rcpp::List::create(Rcpp::Named("array_data") = arrayp, Rcpp::Named("schema") = schemap); return as; -#else - Rcpp::stop("This function requires TileDB (2.2.0 or greater)."); - return R_NilValue; // not reached -#endif } //' @noRd diff --git a/src/deprecation.cpp b/src/deprecation.cpp index 24dbfc7f13..4da6bf9810 100644 --- a/src/deprecation.cpp +++ b/src/deprecation.cpp @@ -167,7 +167,6 @@ XPtr libtiledb_query_add_range_with_type(XPtr quer int64_t stride = as(strides); query->add_range(uidx, start, end, stride); } -#if TILEDB_VERSION >= TileDB_Version(2,0,0) } else if (typestr == "ASCII" || typestr == "CHAR") { std::string start = as(starts); std::string end = as(ends); @@ -177,7 +176,6 @@ XPtr libtiledb_query_add_range_with_type(XPtr quer Rcpp::stop("Non-empty stride for string not supported yet."); } //query->set_subarray(sub); -#endif } else if (typestr == "FLOAT32") { float start = as(starts); float end = as(ends); @@ -216,7 +214,6 @@ XPtr libtiledb_query_add_range(XPtr query, int iid double end = as(ends); double stride = (strides == R_NilValue) ? 0 : Rcpp::as(strides); query->add_range(uidx, start, end, stride); -#if TILEDB_VERSION >= TileDB_Version(2,0,0) } else if (TYPEOF(starts) == STRSXP) { std::string start = as(starts); std::string end = as(ends); @@ -225,7 +222,6 @@ XPtr libtiledb_query_add_range(XPtr query, int iid } else { Rcpp::stop("Non-emoty stride for string not supported yet."); } -#endif } else { Rcpp::stop("Invalid data type for query range: '%s'", Rcpp::type2name(starts)); } diff --git a/src/libtiledb.cpp b/src/libtiledb.cpp index 636f2c1b0c..df9f48c380 100644 --- a/src/libtiledb.cpp +++ b/src/libtiledb.cpp @@ -92,10 +92,8 @@ const char* _tiledb_datatype_to_string(tiledb_datatype_t dtype) { return "DATETIME_FS"; case TILEDB_DATETIME_AS: return "DATETIME_AS"; -#if TILEDB_VERSION >= TileDB_Version(2,7,0) case TILEDB_BLOB: return "BLOB"; -#endif #if TILEDB_VERSION >= TileDB_Version(2,10,0) case TILEDB_BOOL: return "BOOL"; @@ -158,10 +156,8 @@ tiledb_datatype_t _string_to_tiledb_datatype(std::string typestr) { return TILEDB_DATETIME_AS; } else if (typestr == "UTF8") { return TILEDB_STRING_UTF8; -#if TILEDB_VERSION >= TileDB_Version(2,7,0) } else if (typestr == "BLOB") { return TILEDB_BLOB; -#endif #if TILEDB_VERSION >= TileDB_Version(2,10,0) } else if (typestr == "BOOL") { return TILEDB_BOOL; @@ -243,10 +239,8 @@ const char* _tiledb_layout_to_string(tiledb_layout_t layout) { return "GLOBAL_ORDER"; case TILEDB_UNORDERED: return "UNORDERED"; -#if TILEDB_VERSION >= TileDB_Version(2,2,0) case TILEDB_HILBERT: return "HILBERT"; -#endif default: Rcpp::stop("unknown tiledb_layout_t (%d)", layout); } @@ -261,10 +255,8 @@ tiledb_layout_t _string_to_tiledb_layout(std::string lstr) { return TILEDB_GLOBAL_ORDER; } else if (lstr == "UNORDERED") { return TILEDB_UNORDERED; -#if TILEDB_VERSION >= TileDB_Version(2,2,0) } else if (lstr == "HILBERT") { return TILEDB_HILBERT; -#endif } else { Rcpp::stop("Unknown TileDB layout '%s' ", lstr.c_str()); } @@ -533,10 +525,8 @@ bool libtiledb_ctx_is_supported_fs(XPtr ctx, std::string scheme return ctx->is_supported_fs(TILEDB_AZURE); } else if (scheme == "gcs") { return ctx->is_supported_fs(TILEDB_GCS); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) } else if (scheme == "memory") { return ctx->is_supported_fs(TILEDB_MEMFS); -#endif } else { Rcpp::stop("Unknown TileDB fs scheme: '%s'", scheme.c_str()); } @@ -550,12 +540,8 @@ void libtiledb_ctx_set_tag(XPtr ctx, std::string key, std::stri // [[Rcpp::export]] std::string libtiledb_ctx_stats(XPtr ctx) { -#if TILEDB_VERSION >= TileDB_Version(2,4,0) check_xptr_tag(ctx); return ctx->stats(); -#else - return std::string(""); -#endif } /** @@ -1110,7 +1096,6 @@ NumericVector dim_domain_subarray(NumericVector domain, NumericVector subscript) // [[Rcpp::export]] int libtiledb_dim_get_cell_val_num(XPtr dim) { -#if TILEDB_VERSION >= TileDB_Version(2,0,0) check_xptr_tag(dim); unsigned int ncells = dim->cell_val_num(); if (ncells == TILEDB_VAR_NUM) { @@ -1119,9 +1104,6 @@ int libtiledb_dim_get_cell_val_num(XPtr dim) { Rcpp::stop("tiledb_attr ncells value not representable as an R integer"); } return static_cast(ncells); -#else - return R_NaInt; -#endif } // [[Rcpp::export]] @@ -1445,9 +1427,7 @@ XPtr libtiledb_attribute(XPtr ctx, "-- seeing %s which is not", type.c_str()); } attr->set_filter_list(*fltrlst); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) attr->set_nullable(nullable); -#endif return attr; } @@ -1522,7 +1502,6 @@ void libtiledb_attribute_dump(XPtr attr) { // [[Rcpp::export]] void libtiledb_attribute_set_fill_value(XPtr attr, SEXP val) { -#if TILEDB_VERSION >= TileDB_Version(2,1,0) tiledb_datatype_t dtype = attr->type(); check_xptr_tag(attr); if (dtype == TILEDB_INT32) { @@ -1546,14 +1525,10 @@ void libtiledb_attribute_set_fill_value(XPtr attr, SEXP val) std::string typestr = _tiledb_datatype_to_string(dtype); Rcpp::stop("Type '%s' is not currently supported.", typestr.c_str()); } -#else - Rcpp::stop("libtiledb_attribute_set_fill_value_with_type only available with TileDB 2.1.0 or later"); -#endif } // [[Rcpp::export]] SEXP libtiledb_attribute_get_fill_value(XPtr attr) { -#if TILEDB_VERSION >= TileDB_Version(2,1,0) check_xptr_tag(attr); tiledb_datatype_t dtype = attr->type(); const void* valptr; @@ -1575,30 +1550,18 @@ SEXP libtiledb_attribute_get_fill_value(XPtr attr) { std::string typestr = _tiledb_datatype_to_string(dtype); Rcpp::stop("Type '%s' is not currently supported.", typestr.c_str()); } -#else - Rcpp::stop("libtiledb_attribute_get_fill_value_with_type only available with TileDB 2.1.0 or later"); - return R_NilValue; // not reached -#endif } // [[Rcpp::export]] void libtiledb_attribute_set_nullable(XPtr attr, const bool flag) { -#if TILEDB_VERSION >= TileDB_Version(2,2,0) check_xptr_tag(attr); attr->set_nullable(flag); -#else - Rcpp::stop("Nullable attributes are only available with TileDB 2.2.0 or later"); -#endif } // [[Rcpp::export]] bool libtiledb_attribute_get_nullable(XPtr attr) { -#if TILEDB_VERSION >= TileDB_Version(2,2,0) check_xptr_tag(attr); return attr->nullable(); -#else - return false; -#endif } /** @@ -1651,10 +1614,8 @@ libtiledb_array_schema(XPtr ctx, schema->set_offsets_filter_list(*xptr_offsets); } if (validity_filter_list.isNotNull()) { -#if TILEDB_VERSION >= TileDB_Version(2,6,0) XPtr xptr_validity(validity_filter_list); schema->set_validity_filter_list(*xptr_validity); -#endif } schema->check(); return schema; @@ -1780,21 +1741,15 @@ int libtiledb_array_schema_get_capacity(XPtr schema) { // [[Rcpp::export]] bool libtiledb_array_schema_get_allows_dups(XPtr schema) { -#if TILEDB_VERSION >= TileDB_Version(2,0,0) check_xptr_tag(schema); return schema->allows_dups(); -#else - return true; -#endif } // [[Rcpp::export]] XPtr libtiledb_array_schema_set_allows_dups(XPtr schema, bool allows_dups) { -#if TILEDB_VERSION >= TileDB_Version(2,0,0) check_xptr_tag(schema); schema->set_allows_dups(allows_dups); -#endif return schema; } @@ -1834,31 +1789,24 @@ libtiledb_array_schema_set_offsets_filter_list(XPtr schema, // [[Rcpp::export]] XPtr libtiledb_array_schema_get_validity_filter_list(XPtr schema) { -#if TILEDB_VERSION >= TileDB_Version(2,6,0) check_xptr_tag(schema); return make_xptr(new tiledb::FilterList(schema->validity_filter_list())); -#else - return make_xptr(R_NilValue); -#endif - } // [[Rcpp::export]] XPtr libtiledb_array_schema_set_validity_filter_list(XPtr schema, XPtr fltrlst) { -#if TILEDB_VERSION >= TileDB_Version(2,6,0) check_xptr_tag(schema); check_xptr_tag(fltrlst); schema->set_validity_filter_list(*fltrlst); -#endif return schema; } // [[Rcpp::export]] int libtiledb_array_schema_get_attribute_num(XPtr schema) { - check_xptr_tag(schema); + check_xptr_tag(schema); uint32_t attr_num = schema->attribute_num(); if (attr_num >= std::numeric_limits::max()) { Rcpp::stop("Overflow retrieving attribute number."); @@ -1921,14 +1869,9 @@ int libtiledb_array_schema_version(XPtr schema) { //[[Rcpp::export]] XPtr libtiledb_array_schema_evolution(XPtr ctx) { -#if TILEDB_VERSION >= TileDB_Version(2,4,0) check_xptr_tag(ctx); auto p = new tiledb::ArraySchemaEvolution(*ctx.get()); auto ptr = make_xptr(p); -#else - auto p = new tiledb::ArraySchemaEvolution(); // placeholder - auto ptr = make_xptr(p); -#endif return ptr; } @@ -1936,43 +1879,31 @@ libtiledb_array_schema_evolution(XPtr ctx) { XPtr libtiledb_array_schema_evolution_add_attribute(XPtr ase, XPtr attr) { -#if TILEDB_VERSION >= TileDB_Version(2,4,0) check_xptr_tag(ase); check_xptr_tag(attr); tiledb::ArraySchemaEvolution res = ase->add_attribute(*attr.get()); auto ptr = new tiledb::ArraySchemaEvolution(res); return make_xptr(ptr); -#else - return ase; -#endif } //[[Rcpp::export]] XPtr libtiledb_array_schema_evolution_drop_attribute(XPtr ase, const std::string & attrname) { -#if TILEDB_VERSION >= TileDB_Version(2,4,0) check_xptr_tag(ase); tiledb::ArraySchemaEvolution res = ase->drop_attribute(attrname); auto ptr = new tiledb::ArraySchemaEvolution(res); return make_xptr(ptr); -#else - return ase; -#endif } //[[Rcpp::export]] XPtr libtiledb_array_schema_evolution_array_evolve(XPtr ase, const std::string & uri) { -#if TILEDB_VERSION >= TileDB_Version(2,4,0) check_xptr_tag(ase); tiledb::ArraySchemaEvolution res = ase->array_evolve(uri); auto ptr = new tiledb::ArraySchemaEvolution(res); return make_xptr(ptr); -#else - return ase; -#endif } /** @@ -2013,11 +1944,9 @@ XPtr libtiledb_array_open_at(XPtr ctx, std::stri #if TILEDB_VERSION >= TileDB_Version(2,15,0) auto ptr = new tiledb::Array(*ctx.get(), uri, query_type, tiledb::TemporalPolicy(tiledb::TimeTravel, ts_ms)); ptr->set_open_timestamp_end(ts_ms); -#elif TILEDB_VERSION >= TileDB_Version(2,3,0) +#else auto ptr = new tiledb::Array(*ctx.get(), uri, query_type); ptr->set_open_timestamp_end(ts_ms); -#else - auto ptr = new tiledb::Array(*ctx.get(), uri, query_type, ts_ms); #endif return make_xptr(ptr); } @@ -2138,20 +2067,15 @@ List libtiledb_array_get_non_empty_domain(XPtr array) { // [[Rcpp::export]] CharacterVector libtiledb_array_get_non_empty_domain_var_from_name(XPtr array, std::string name) { -#if TILEDB_VERSION >= TileDB_Version(2,0,0) check_xptr_tag(array); auto res = array->non_empty_domain_var(name); return CharacterVector::create(res.first, res.second); -#else - return CharacterVector::create("NA", "NA"); -#endif } // [[Rcpp::export]] CharacterVector libtiledb_array_get_non_empty_domain_var_from_index(XPtr array, int32_t idx, std::string typestr = "ASCII") { -#if TILEDB_VERSION >= TileDB_Version(2,0,0) check_xptr_tag(array); if (typestr == "ASCII") { auto res = array->non_empty_domain_var(idx); @@ -2161,16 +2085,12 @@ CharacterVector libtiledb_array_get_non_empty_domain_var_from_index(XPtr array, std::string name, std::string typestr) { -#if TILEDB_VERSION >= TileDB_Version(2,0,0) check_xptr_tag(array); if (typestr == "INT64") { auto p = array->non_empty_domain(name); @@ -2228,9 +2148,6 @@ NumericVector libtiledb_array_get_non_empty_domain_from_name(XPtr Rcpp::stop("Currently unsupported tiledb domain type: '%s'", typestr.c_str()); return NumericVector::create(NA_REAL, NA_REAL); // not reached } -#else - return NumericVector::create(NA_REAL, NA_REAL); -#endif } @@ -2238,7 +2155,6 @@ NumericVector libtiledb_array_get_non_empty_domain_from_name(XPtr NumericVector libtiledb_array_get_non_empty_domain_from_index(XPtr array, int32_t idx, std::string typestr) { -#if TILEDB_VERSION >= TileDB_Version(2,0,0) check_xptr_tag(array); if (typestr == "INT64") { auto p = array->non_empty_domain(idx); @@ -2296,9 +2212,6 @@ NumericVector libtiledb_array_get_non_empty_domain_from_index(XPtr array, std::string key) // [[Rcpp::export]] XPtr libtiledb_array_set_open_timestamp_start(XPtr array, Rcpp::Datetime tstamp) { -#if TILEDB_VERSION >= TileDB_Version(2,3,0) check_xptr_tag(array); uint64_t ts_ms = static_cast(std::round(tstamp.getFractionalTimestamp() * 1000)); array->set_open_timestamp_start(ts_ms); -#endif return array; } // [[Rcpp::export]] Rcpp::Datetime libtiledb_array_open_timestamp_start(XPtr array) { -#if TILEDB_VERSION >= TileDB_Version(2,3,0) check_xptr_tag(array); uint64_t ts_ms = array->open_timestamp_start(); double ts = ts_ms / 1000.0; return(Rcpp::Datetime(ts)); -#else - return(Rcpp::Datetime(0.0)); -#endif } // [[Rcpp::export]] XPtr libtiledb_array_set_open_timestamp_end(XPtr array, Rcpp::Datetime tstamp) { -#if TILEDB_VERSION >= TileDB_Version(2,3,0) check_xptr_tag(array); uint64_t ts_ms = static_cast(std::round(tstamp.getFractionalTimestamp() * 1000)); array->set_open_timestamp_end(ts_ms); -#endif return array; } // [[Rcpp::export]] Rcpp::Datetime libtiledb_array_open_timestamp_end(XPtr array) { -#if TILEDB_VERSION >= TileDB_Version(2,3,0) check_xptr_tag(array); uint64_t ts_ms = array->open_timestamp_end(); double ts = ts_ms / 1000.0; return(Rcpp::Datetime(ts)); -#else - return(Rcpp::Datetime(0.0)); -#endif } // [[Rcpp::export]] @@ -2596,7 +2497,6 @@ std::string libtiledb_query_layout(XPtr query) { XPtr libtiledb_query_set_subarray_with_type(XPtr query, SEXP subarray, std::string typestr) { check_xptr_tag(query); -#if TILEDB_VERSION >= TileDB_Version(2,7,0) spdl::debug(tfm::format("libtiledb_query_set_subarray_with_type] setting subarray for type %s", typestr)); tiledb::Subarray subarr(query->ctx(), query->array()); if (typestr == "INT32") { @@ -2638,7 +2538,6 @@ XPtr libtiledb_query_set_subarray_with_type(XPtr q Rcpp::stop("currently unsupported subarray datatype '%s'", typestr.c_str()); } query->set_subarray(subarr); -#endif return query; } @@ -2646,7 +2545,6 @@ XPtr libtiledb_query_set_subarray_with_type(XPtr q XPtr libtiledb_query_set_subarray(XPtr query, SEXP subarray) { check_xptr_tag(query); -#if TILEDB_VERSION >= TileDB_Version(2,7,0) spdl::debug(tfm::format("libtiledb_query_set_subarray] setting subarray for type %s", Rf_type2char(TYPEOF(subarray)))); tiledb::Subarray subarr(query->ctx(), query->array()); if (TYPEOF(subarray) == INTSXP) { @@ -2659,7 +2557,6 @@ XPtr libtiledb_query_set_subarray(XPtr query, Rcpp::stop("currently unsupported subarray datatype"); } query->set_subarray(subarr); -#endif return query; } @@ -2670,27 +2567,15 @@ XPtr libtiledb_query_set_buffer(XPtr query, check_xptr_tag(query); if (TYPEOF(buffer) == INTSXP) { IntegerVector vec(buffer); -#if TILEDB_VERSION >= TileDB_Version(2,4,0) query->set_data_buffer(attr, vec.begin(), vec.length()); -#else - query->set_buffer(attr, vec.begin(), vec.length()); -#endif return query; } else if (TYPEOF(buffer) == REALSXP) { NumericVector vec(buffer); -#if TILEDB_VERSION >= TileDB_Version(2,4,0) query->set_data_buffer(attr, vec.begin(), vec.length()); -#else - query->set_buffer(attr, vec.begin(), vec.length()); -#endif return query; } else if (TYPEOF(buffer) == LGLSXP) { LogicalVector vec(buffer); // note that it is really an int at the element storage -#if TILEDB_VERSION >= TileDB_Version(2,4,0) query->set_data_buffer(attr, vec.begin(), vec.length()); -#else - query->set_buffer(attr, vec.begin(), vec.length()); -#endif return query; } else { Rcpp::stop("Invalid attribute buffer type for attribute '%s': %s", @@ -2770,24 +2655,12 @@ XPtr libtiledb_query_set_buffer_var_char(XPtr quer XPtr bufptr) { check_xptr_tag(query); check_xptr_tag(bufptr); -#if TILEDB_VERSION >= TileDB_Version(2,4,0) if (bufptr->nullable) { query->set_validity_buffer(attr, bufptr->validity_map); } query->set_data_buffer(attr, bufptr->str); query->set_offsets_buffer(attr, bufptr->offsets); return query; -#elif TILEDB_VERSION >= TileDB_Version(2,2,4) - if (bufptr->nullable) { - query->set_buffer_nullable(attr, bufptr->offsets, bufptr->str, bufptr->validity_map); - } else { - query->set_buffer(attr, bufptr->offsets, bufptr->str); - } - return query; -#else - query->set_buffer(attr, bufptr->offsets, bufptr->str); - return query; -#endif } // 'len' is the length of the query result set, i.e. buffer elements for standard columns @@ -2866,19 +2739,11 @@ XPtr libtiledb_query_set_buffer_var_vec(XPtr query std::string attr, XPtr buf) { check_xptr_tag(buf); if (buf->dtype == TILEDB_INT32) { -#if TILEDB_VERSION >= TileDB_Version(2,4,0) query->set_data_buffer(attr, buf->idata); query->set_offsets_buffer(attr, buf->offsets); -#else - query->set_buffer(attr, buf->offsets, buf->idata); -#endif } else if (buf->dtype == TILEDB_FLOAT64) { -#if TILEDB_VERSION >= TileDB_Version(2,4,0) query->set_data_buffer(attr, buf->ddata); query->set_offsets_buffer(attr, buf->offsets); -#else - query->set_buffer(attr, buf->offsets, buf->ddata); -#endif } else { Rcpp::stop("Unsupported type '%s' for buffer", _tiledb_datatype_to_string(buf->dtype)); } @@ -2937,10 +2802,8 @@ XPtr libtiledb_query_buffer_alloc_ptr(std::string domaintype, buf->size = sizeof(int16_t); } else if (domaintype == "INT8" || domaintype == "UINT8") { buf->size = sizeof(int8_t); -#if TILEDB_VERSION >= TileDB_Version(2,7,0) } else if (domaintype == "BLOB") { buf->size = sizeof(int8_t); -#endif #if TILEDB_VERSION >= TileDB_Version(2,10,0) } else if (domaintype == "BOOL") { buf->size = sizeof(uint8_t); @@ -3119,23 +2982,11 @@ XPtr libtiledb_query_buffer_assign_ptr(XPtr buf, std:: XPtr libtiledb_query_set_buffer_ptr(XPtr query, std::string attr, XPtr buf) { - check_xptr_tag(query); -#if TILEDB_VERSION >= TileDB_Version(2,4,0) + check_xptr_tag(query); if (buf->nullable) { query->set_validity_buffer(attr, buf->validity_map); } query->set_data_buffer(attr, static_cast(buf->vec.data()), buf->ncells); -#elif TILEDB_VERSION >= TileDB_Version(2,2,0) - if (buf->nullable) { - query->set_buffer_nullable(attr, static_cast(buf->vec.data()), buf->ncells, - buf->validity_map.data(), - static_cast(buf->validity_map.size())); - } else { - query->set_buffer(attr, static_cast(buf->vec.data()), buf->ncells); - } -#else - query->set_buffer(attr, static_cast(buf->vec.data()), buf->ncells); -#endif return query; } @@ -3272,7 +3123,6 @@ RObject libtiledb_query_get_buffer_ptr(XPtr buf, bool asint64 = fal if (buf->nullable) setValidityMapForInteger(out, buf->validity_map, buf->numvar); return out; -#if TILEDB_VERSION >= TileDB_Version(2,7,0) } else if (dtype == "BLOB") { size_t n = buf->ncells; Rcpp::RawVector out(n); @@ -3281,7 +3131,6 @@ RObject libtiledb_query_get_buffer_ptr(XPtr buf, bool asint64 = fal // if (buf->nullable) // setValidityMapForRaw(out, buf->validity_map); return out; -#endif #if TILEDB_VERSION >= TileDB_Version(2,10,0) } else if (dtype == "BOOL") { size_t n = buf->ncells; @@ -3368,7 +3217,6 @@ NumericVector libtiledb_query_result_buffer_elements_vec(XPtr que std::string attribute, bool nullable = false) { check_xptr_tag(query); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) if (nullable) { auto nelem = query->result_buffer_elements_nullable()[attribute]; auto vec = NumericVector( { @@ -3381,10 +3229,6 @@ NumericVector libtiledb_query_result_buffer_elements_vec(XPtr que auto nelem = query->result_buffer_elements()[attribute]; return NumericVector( { static_cast(nelem.first), static_cast(nelem.second) }); } -#else - auto nelem = query->result_buffer_elements()[attribute]; - return NumericVector( { static_cast(nelem.first), static_cast(nelem.second) }); -#endif } // [[Rcpp::export]] @@ -3422,11 +3266,7 @@ Rcpp::DatetimeVector libtiledb_query_get_fragment_timestamp_range(XPtr libtiledb_subarray(XPtr query) { -#if TILEDB_VERSION >= TileDB_Version(2,7,0) return make_xptr(new tiledb::Subarray(query->ctx(), query->array())); -#else - return make_xptr(R_NilValue); -#endif } // [[Rcpp::export]] @@ -3434,7 +3274,6 @@ XPtr libtiledb_subarray_add_range(XPtr subar int iidx, SEXP starts, SEXP ends, SEXP strides = R_NilValue) { check_xptr_tag(subarr); -#if TILEDB_VERSION >= TileDB_Version(2,7,0) spdl::debug("libtiledb_query_add_range] setting subarray"); if (TYPEOF(starts) != TYPEOF(ends)) { Rcpp::stop("'start' and 'end' must be of identical types"); @@ -3461,7 +3300,6 @@ XPtr libtiledb_subarray_add_range(XPtr subar } else { Rcpp::stop("Invalid data type for query range: '%s'", Rcpp::type2name(starts)); } -#endif return subarr; } @@ -3473,7 +3311,6 @@ XPtr libtiledb_subarray_add_range_with_type(XPtr(subarr); -#if TILEDB_VERSION >= TileDB_Version(2,7,0) if (TYPEOF(starts) != TYPEOF(ends)) { Rcpp::stop("'start' and 'end' must be of identical types"); } @@ -3551,7 +3388,6 @@ XPtr libtiledb_subarray_add_range_with_type(XPtr(strides)); subarr->add_range(uidx, start, end, stride); spdl::debug(tfm::format("[libtiledb_subarry_add_range_with type] %s dim %d added %d to %d by %d", typestr, uidx, start, end, stride)); -#if TILEDB_VERSION >= TileDB_Version(2,0,0) } else if (typestr == "ASCII" || typestr == "CHAR") { std::string start = as(starts); std::string end = as(ends); @@ -3560,7 +3396,6 @@ XPtr libtiledb_subarray_add_range_with_type(XPtradd_range(uidx, start, end); spdl::debug(tfm::format("[libtiledb_subarry_add_range_with type] %s dim %d added %s to %s", typestr, uidx, start, end)); -#endif } else if (typestr == "FLOAT32") { float start = as(starts); float end = as(ends); @@ -3570,7 +3405,6 @@ XPtr libtiledb_subarray_add_range_with_type(XPtr libtiledb_subarray_add_range_with_type(XPtr libtiledb_query_set_subarray_object(XPtr query, XPtr subarr) { check_xptr_tag(query); check_xptr_tag(subarr); -#if TILEDB_VERSION >= TileDB_Version(2,7,0) query->set_subarray(*subarr.get()); -#endif return query; } @@ -3596,70 +3428,48 @@ R_xlen_t libtiledb_query_get_est_result_size(XPtr query, std::str // [[Rcpp::export]] NumericVector libtiledb_query_get_est_result_size_nullable(XPtr query, std::string attr) { check_xptr_tag(query); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) std::array est = query->est_result_size_nullable(attr); return Rcpp::NumericVector::create(static_cast(est[0]), static_cast(est[1])); -#else - return Rcpp::NumericVector::create(R_NaReal,R_NaReal); -#endif } // [[Rcpp::export]] NumericVector libtiledb_query_get_est_result_size_var(XPtr query, std::string attr) { check_xptr_tag(query); -#if TILEDB_VERSION < TileDB_Version(2,2,0) - std::pair est = query->est_result_size_var(attr); - return NumericVector::create(static_cast(est.first), static_cast(est.second)); -#else std::array est = query->est_result_size_var(attr); return NumericVector::create(static_cast(est[0]), static_cast(est[1])); -#endif } // [[Rcpp::export]] NumericVector libtiledb_query_get_est_result_size_var_nullable(XPtr query, std::string attr) { check_xptr_tag(query); -#if TILEDB_VERSION < TileDB_Version(2,2,0) - return Rcpp::NumericVector::create(R_NaReal,R_NaReal,R_NaReal); -#else std::array est = query->est_result_size_var_nullable(attr); return Rcpp::NumericVector::create(static_cast(est[0]), static_cast(est[1]), static_cast(est[2])); -#endif } // [[Rcpp::export]] double libtiledb_query_get_range_num(XPtr query, int dim_idx) { check_xptr_tag(query); -#if TILEDB_VERSION >= TileDB_Version(2,7,0) tiledb::Array arr = query->array(); tiledb::Context ctx = query->ctx(); tiledb::Subarray sub(ctx, arr); query->update_subarray_from_query(&sub); uint64_t range_num = sub.range_num(static_cast(dim_idx)); -#else - uint64_t range_num = query->range_num(static_cast(dim_idx)); -#endif return static_cast(range_num); } // [[Rcpp::export]] IntegerVector libtiledb_query_get_range(XPtr query, int dim_idx, int rng_idx) { check_xptr_tag(query); -#if TILEDB_VERSION >= TileDB_Version(2,7,0) tiledb::Array arr = query->array(); tiledb::Context ctx = query->ctx(); tiledb::Subarray sub(ctx, arr); query->update_subarray_from_query(&sub); std::array rng = sub.range(static_cast(dim_idx), static_cast(rng_idx)); -#else - std::array rng = query->range(static_cast(dim_idx), - static_cast(rng_idx)); -#endif return IntegerVector::create(rng[0], // start rng[1], // end rng[2]); // stride @@ -3668,15 +3478,11 @@ IntegerVector libtiledb_query_get_range(XPtr query, int dim_idx, // [[Rcpp::export]] CharacterVector libtiledb_query_get_range_var(XPtr query, int dim_idx, int rng_idx) { check_xptr_tag(query); -#if TILEDB_VERSION >= TileDB_Version(2,7,0) tiledb::Array arr = query->array(); tiledb::Context ctx = query->ctx(); tiledb::Subarray sub(ctx, arr); query->update_subarray_from_query(&sub); std::array rng = sub.range(static_cast(dim_idx), static_cast(rng_idx)); -#else - std::array rng = query->range(static_cast(dim_idx), static_cast(rng_idx)); -#endif return CharacterVector::create(rng[0], rng[1]); // start and end } @@ -3684,10 +3490,8 @@ CharacterVector libtiledb_query_get_range_var(XPtr query, int dim XPtr libtiledb_query_set_condition(XPtr query, XPtr query_cond) { check_xptr_tag(query); -#if TILEDB_VERSION >= TileDB_Version(2,3,0) - query->set_condition(*query_cond.get()); -#endif - return query; + query->set_condition(*query_cond.get()); + return query; } // Note that the Array pointer returned here from a Query object is not owned and will not @@ -3697,53 +3501,36 @@ XPtr libtiledb_query_set_condition(XPtr query, XPtr libtiledb_query_get_array(XPtr query, XPtr ctx) { check_xptr_tag(query); check_xptr_tag(ctx); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) auto arr = query->array(); auto cptr = arr.ptr().get(); return make_xptr(new tiledb::Array(*ctx.get(), cptr, false)); -#else - return make_xptr(R_NilValue); -#endif } // [[Rcpp::export]] XPtr libtiledb_query_get_schema(XPtr query, XPtr ctx) { check_xptr_tag(query); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) auto arr = query->array(); return libtiledb_array_schema_load(ctx, arr.uri()); // returns an XPtr -#else - return make_xptr(R_NilValue); -#endif } // [[Rcpp::export]] std::string libtiledb_query_stats(XPtr query) { check_xptr_tag(query); -#if TILEDB_VERSION >= TileDB_Version(2,4,0) return query->stats(); -#else - return std::string(""); -#endif } // [[Rcpp::export]] XPtr libtiledb_query_get_ctx(XPtr query) { check_xptr_tag(query); -#if TILEDB_VERSION >= TileDB_Version(2,6,0) auto ctx = query->ctx(); return make_xptr(new tiledb::Context(ctx)); -#else - return make_xptr(R_NilValue); -#endif } /** * Query Condition */ -#if TILEDB_VERSION >= TileDB_Version(2,3,0) const char* _tiledb_query_condition_op_to_string(tiledb_query_condition_op_t op) { switch (op) { case TILEDB_LT: @@ -3805,16 +3592,12 @@ tiledb_query_condition_combination_op_t _tiledb_query_string_to_condition_combin Rcpp::stop("Unknown TileDB combination op string '%s'", opstr.c_str()); } } -#endif + // [[Rcpp::export]] XPtr libtiledb_query_condition(XPtr ctx) { check_xptr_tag(ctx); -#if TILEDB_VERSION >= TileDB_Version(2,3,0) auto ptr = make_xptr(new tiledb::QueryCondition(*ctx.get())); -#else - auto ptr = make_xptr(new tiledb::QueryCondition()); -#endif return ptr; } @@ -3825,7 +3608,6 @@ void libtiledb_query_condition_init(XPtr query_cond, const std::string& cond_val_type, const std::string& cond_op_string) { check_xptr_tag(query_cond); -#if TILEDB_VERSION >= TileDB_Version(2,3,0) tiledb_query_condition_op_t op = _tiledb_query_string_to_condition_op(cond_op_string); if (cond_val_type == "INT32" || cond_val_type == "UINT32") { int v = as(condition_value); @@ -3869,7 +3651,6 @@ void libtiledb_query_condition_init(XPtr query_cond, } else { Rcpp::stop("Currently unsupported type: %s", cond_val_type); } -#endif } // [[Rcpp::export]] @@ -3878,13 +3659,9 @@ XPtr libtiledb_query_condition_combine(XPtr(lhs); check_xptr_tag(lhs); -#if TILEDB_VERSION >= TileDB_Version(2,3,0) tiledb_query_condition_combination_op_t op = _tiledb_query_string_to_condition_combination_op(str); tiledb::QueryCondition res = lhs->combine(*rhs.get(), op); auto query_cond = make_xptr(new tiledb::QueryCondition(res)); -#else - auto query_cond = make_xptr(new tiledb::QueryCondition()); -#endif return query_cond; } @@ -4232,24 +4009,15 @@ void libtiledb_stats_dump(std::string path = "") { // [[Rcpp::export]] std::string libtiledb_stats_raw_dump() { -#if TILEDB_VERSION < TileDB_Version(2,0,3) - Rcpp::stop("This function requires TileDB Embedded 2.0.3 or later."); -#else std::string txt; tiledb::Stats::raw_dump(&txt); return txt; -#endif } // [[Rcpp::export]] std::string libtiledb_stats_raw_get() { -#if TILEDB_VERSION < TileDB_Version(2,0,3) - Rcpp::stop("This function requires TileDB Embedded 2.0.3 or later."); - return(std::string());//not reached -#else Rcpp::message(Rcpp::wrap("This function is deprecated, please use 'libtiledb_stats_raw_dump'.")); return libtiledb_stats_raw_dump(); -#endif } /** @@ -4258,23 +4026,15 @@ std::string libtiledb_stats_raw_get() { // [[Rcpp::export]] XPtr libtiledb_fragment_info(XPtr ctx, const std::string& uri) { -#if TILEDB_VERSION >= TileDB_Version(2,2,0) auto ptr = make_xptr(new tiledb::FragmentInfo(*ctx.get(), uri)); ptr->load(); // also load -#else - auto ptr = make_xptr(new tiledb::FragmentInfo()); // placeholder class to permit compilation -#endif return ptr; } // [[Rcpp::export]] std::string libtiledb_fragment_info_uri(XPtr fi, int32_t fid) { check_xptr_tag(fi); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) return fi->fragment_uri(static_cast(fid)); -#else - return std::string("NA"); -#endif } // [[Rcpp::export]] @@ -4282,7 +4042,6 @@ Rcpp::NumericVector libtiledb_fragment_info_get_non_empty_domain_index(XPtr(fi); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) if (typestr == "INT64") { std::vector non_empty_dom(2); fi->get_non_empty_domain(fid, did, &non_empty_dom[0]); @@ -4308,23 +4067,23 @@ Rcpp::NumericVector libtiledb_fragment_info_get_non_empty_domain_index(XPtr non_empty_dom(2); fi->get_non_empty_domain(fid, did, &non_empty_dom[0]); return NumericVector::create(non_empty_dom[0], non_empty_dom[1]); - } else if (typestr == "INT8") { + } else if (typestr == "INT8") { std::vector non_empty_dom(2); fi->get_non_empty_domain(fid, did, &non_empty_dom[0]); return NumericVector::create(non_empty_dom[0], non_empty_dom[1]); - } else if (typestr == "UINT8") { + } else if (typestr == "UINT8") { std::vector non_empty_dom(2); fi->get_non_empty_domain(fid, did, &non_empty_dom[0]); return NumericVector::create(non_empty_dom[0], non_empty_dom[1]); - } else if (typestr == "FLOAT64") { + } else if (typestr == "FLOAT64") { std::vector non_empty_dom(2); fi->get_non_empty_domain(fid, did, &non_empty_dom[0]); return NumericVector::create(non_empty_dom[0], non_empty_dom[1]); - } else if (typestr == "FLOAT32") { + } else if (typestr == "FLOAT32") { std::vector non_empty_dom(2); fi->get_non_empty_domain(fid, did, &non_empty_dom[0]); return NumericVector::create(non_empty_dom[0], non_empty_dom[1]); - } else if (typestr == "DATETIME_YEAR" || + } else if (typestr == "DATETIME_YEAR" || typestr == "DATETIME_MONTH" || typestr == "DATETIME_WEEK" || typestr == "DATETIME_DAY" || @@ -4348,9 +4107,6 @@ Rcpp::NumericVector libtiledb_fragment_info_get_non_empty_domain_index(XPtr(fi); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) if (typestr == "INT64") { std::vector non_empty_dom(2); fi->get_non_empty_domain(fid, dim_name, &non_empty_dom[0]); @@ -4425,9 +4180,6 @@ Rcpp::NumericVector libtiledb_fragment_info_get_non_empty_domain_name(XPtr fi, int32_t fid, int32_t did) { check_xptr_tag(fi); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) auto sp = fi->non_empty_domain_var(static_cast(fid), static_cast(did)); return CharacterVector::create(sp.first, sp.second); -#else - return CharacterVector::create(NA_STRING, NA_STRING); -#endif } // [[Rcpp::export]] @@ -4449,143 +4197,89 @@ libtiledb_fragment_info_get_non_empty_domain_var_name(XPtr int32_t fid, const std::string& dim_name) { check_xptr_tag(fi); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) auto sp = fi->non_empty_domain_var(static_cast(fid), dim_name); return CharacterVector::create(sp.first, sp.second); -#else - return CharacterVector::create(NA_STRING, NA_STRING); -#endif } // [[Rcpp::export]] double libtiledb_fragment_info_num(XPtr fi) { check_xptr_tag(fi); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) return static_cast(fi->fragment_num()); -#else - return NA_REAL; -#endif } // [[Rcpp::export]] double libtiledb_fragment_info_size(XPtr fi, int32_t fid) { check_xptr_tag(fi); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) return static_cast(fi->fragment_size(static_cast(fid))); -#else - return NA_REAL; -#endif } // [[Rcpp::export]] bool libtiledb_fragment_info_dense(XPtr fi, int32_t fid) { check_xptr_tag(fi); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) return fi->dense(static_cast(fid)); -#else - return NA_LOGICAL; -#endif } // [[Rcpp::export]] bool libtiledb_fragment_info_sparse(XPtr fi, int32_t fid) { check_xptr_tag(fi); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) return fi->sparse(static_cast(fid)); -#else - return NA_LOGICAL; -#endif } // [[Rcpp::export]] Rcpp::DatetimeVector libtiledb_fragment_info_timestamp_range(XPtr fi, int32_t fid) { check_xptr_tag(fi); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) auto range = fi->timestamp_range(static_cast(fid)); return Rcpp::DatetimeVector::create(range.first/1000.0, range.second/1000.0); -#else - return DatetimeVector::create(NA_REAL, NA_REAL); -#endif } // [[Rcpp::export]] double libtiledb_fragment_info_cell_num(XPtr fi, int32_t fid) { check_xptr_tag(fi); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) return static_cast(fi->cell_num(static_cast(fid))); -#else - return NA_REAL; -#endif } // [[Rcpp::export]] int libtiledb_fragment_info_version(XPtr fi, int32_t fid) { check_xptr_tag(fi); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) return static_cast(fi->version(static_cast(fid))); -#else - return NA_INTEGER; -#endif } // [[Rcpp::export]] bool libtiledb_fragment_info_has_consolidated_metadata(XPtr fi, int32_t fid) { check_xptr_tag(fi); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) return fi->has_consolidated_metadata(static_cast(fid)); -#else - return NA_LOGICAL; -#endif } // [[Rcpp::export]] double libtiledb_fragment_info_unconsolidated_metadata_num(XPtr fi) { check_xptr_tag(fi); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) return static_cast(fi->unconsolidated_metadata_num()); -#else - return NA_REAL; -#endif } // [[Rcpp::export]] double libtiledb_fragment_info_to_vacuum_num(XPtr fi) { check_xptr_tag(fi); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) return static_cast(fi->to_vacuum_num()); -#else - return NA_REAL; -#endif } // [[Rcpp::export]] std::string libtiledb_fragment_info_to_vacuum_uri(XPtr fi, int32_t fid) { check_xptr_tag(fi); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) return fi->to_vacuum_uri(static_cast(fid)); -#else - return std::string("NA"); -#endif } // [[Rcpp::export]] void libtiledb_fragment_info_dump(XPtr fi) { check_xptr_tag(fi); -#if TILEDB_VERSION >= TileDB_Version(2,2,0) return fi->dump(); -#endif } // [[Rcpp::export]] std::string libtiledb_error_message(XPtr ctx) { check_xptr_tag(ctx); -#if TILEDB_VERSION >= TileDB_Version(2,5,0) tiledb::Error error(*ctx.get()); std::string txt(error.error_message()); -#else - std::string txt("This function requires TileDB 2.5.0 or later."); -#endif return txt; } diff --git a/src/updated_arrow_io_impl.h b/src/updated_arrow_io_impl.h index 3872e0e148..39ca5a1274 100644 --- a/src/updated_arrow_io_impl.h +++ b/src/updated_arrow_io_impl.h @@ -204,10 +204,8 @@ ArrowInfo tiledb_buffer_arrow_fmt(BufferInfo bufferinfo, bool use_list = true) { return ArrowInfo("f"); case TILEDB_FLOAT64: return ArrowInfo("g"); -#if TILEDB_VERSION >= TileDB_Version(2,7,0) case TILEDB_BLOB: return ArrowInfo("B"); -#endif case TILEDB_INT8: return ArrowInfo("c"); case TILEDB_UINT8: @@ -289,10 +287,8 @@ TypeInfo arrow_type_to_tiledb(ArrowSchema* arw_schema) { return {TILEDB_FLOAT32, 4, 1, large, nullable}; else if (fmt == "g") return {TILEDB_FLOAT64, 8, 1, large, nullable}; -#if TILEDB_VERSION >= TileDB_Version(2,7,0) else if (fmt == "B") return {TILEDB_BLOB, 1, 1, large, nullable}; -#endif else if (fmt == "c") return {TILEDB_INT8, 1, 1, large, nullable}; else if (fmt == "C")