This is an automated email from the ASF dual-hosted git repository. thisisnic pushed a commit to branch maint-25.0.1-r in repository https://gitbox.apache.org/repos/asf/arrow.git
commit a518a81e694508136782b94888c40c055957f695 Author: Nic Crane <[email protected]> AuthorDate: Mon Aug 3 13:51:43 2026 -0400 GH-50495: [R] 25.0.0 Release followups (#50786) Changes from release branch need porting to main Port them to main No Sure, we removed two defunct funcs * GitHub Issue: #50495 Authored-by: Nic Crane <[email protected]> Signed-off-by: Nic Crane <[email protected]> --- r/NAMESPACE | 2 - r/R/arrow-info.R | 6 -- r/R/dataset-format.R | 1 - r/R/dplyr-funcs-doc.R | 34 +++++------ r/R/filesystem.R | 121 +++++++++++++++++++++++++++++++++++++ r/R/type.R | 8 --- r/data-raw/docgen.R | 8 ++- r/man/FileSystem.Rd | 35 +++++++++++ r/man/acero.Rd | 36 +++++------ r/man/arrow_info.Rd | 3 - r/man/infer_type.Rd | 5 +- r/src/type_infer.cpp | 2 +- r/tests/testthat/test-arrow-info.R | 4 -- r/tests/testthat/test-type.R | 9 --- 14 files changed, 200 insertions(+), 74 deletions(-) diff --git a/r/NAMESPACE b/r/NAMESPACE index f74034c965..f3e0b1a0dc 100644 --- a/r/NAMESPACE +++ b/r/NAMESPACE @@ -278,7 +278,6 @@ export(Type) export(UnionDataset) export(all_of) export(arrow_array) -export(arrow_available) export(arrow_info) export(arrow_table) export(arrow_with_acero) @@ -403,7 +402,6 @@ export(time64) export(timestamp) export(to_arrow) export(to_duckdb) -export(type) export(uint16) export(uint32) export(uint64) diff --git a/r/R/arrow-info.R b/r/R/arrow-info.R index 699f94dcbd..38ff09127a 100644 --- a/r/R/arrow-info.R +++ b/r/R/arrow-info.R @@ -73,12 +73,6 @@ arrow_info <- function() { structure(out, class = "arrow_info") } -#' @rdname arrow_info -#' @export -arrow_available <- function() { - .Deprecated(msg = "Arrow C++ is always available as of 7.0.0") - TRUE -} #' @rdname arrow_info #' @export diff --git a/r/R/dataset-format.R b/r/R/dataset-format.R index 60ede3553a..7a230aaa75 100644 --- a/r/R/dataset-format.R +++ b/r/R/dataset-format.R @@ -142,7 +142,6 @@ IpcFileFormat <- R6Class("IpcFileFormat", inherit = FileFormat) #' @rdname JsonFileFormat #' @name JsonFileFormat #' @seealso [FileFormat] -#' @examplesIf arrow_with_dataset() #' #' @export JsonFileFormat <- R6Class("JsonFileFormat", inherit = FileFormat) diff --git a/r/R/dplyr-funcs-doc.R b/r/R/dplyr-funcs-doc.R index 2f5bbc11b6..1adf23fba1 100644 --- a/r/R/dplyr-funcs-doc.R +++ b/r/R/dplyr-funcs-doc.R @@ -100,24 +100,24 @@ #' #' ## base #' -#' * [`!`][!()] -#' * [`!=`][!=()] -#' * [`%%`][%%()] -#' * [`%/%`][%/%()] -#' * [`%in%`][%in%()] -#' * [`&`][&()] -#' * [`*`][*()] -#' * [`+`][+()] -#' * [`-`][-()] -#' * [`/`][/()] -#' * [`<`][<()] -#' * [`<=`][<=()] -#' * [`==`][==()] -#' * [`>`][>()] -#' * [`>=`][>=()] +#' * [`!`][base::!()] +#' * [`!=`][base::!=()] +#' * [`%%`][base::%%()] +#' * [`%/%`][base::%/%()] +#' * [`%in%`][base::%in%()] +#' * [`&`][base::&()] +#' * [`*`][base::*()] +#' * [`+`][base::+()] +#' * [`-`][base::-()] +#' * [`/`][base::/()] +#' * [`<`][base::<()] +#' * [`<=`][base::<=()] +#' * [`==`][base::==()] +#' * [`>`][base::>()] +#' * [`>=`][base::>=()] #' * [`ISOdate()`][base::ISOdate()] #' * [`ISOdatetime()`][base::ISOdatetime()] -#' * [`^`][^()] +#' * [`^`][base::^()] #' * [`abs()`][base::abs()] #' * [`acos()`][base::acos()] #' * [`acosh()`][base::acosh()] @@ -195,7 +195,7 @@ #' * [`tolower()`][base::tolower()] #' * [`toupper()`][base::toupper()] #' * [`trunc()`][base::trunc()] -#' * [`|`][|()] +#' * [`|`][base::|()] #' #' ## bit64 #' diff --git a/r/R/filesystem.R b/r/R/filesystem.R index 99c09c40dc..3ef5f483e2 100644 --- a/r/R/filesystem.R +++ b/r/R/filesystem.R @@ -189,6 +189,31 @@ FileSelector$create <- function(base_dir, allow_not_found = FALSE, recursive = F #' - `default_metadata`: default metadata to write in new objects. #' - `project_id`: the project to use for creating buckets. #' +#' `AzureFileSystem$create()` takes following required argument: +#' +#' - `account_name`: Azure Blob Storage account name. +#' +#' `AzureFileSystem$create()` takes following optional arguments: +#' +#' - `account_key`: Account key of the storage account. Cannot be used with +#' `sas_token`. +#' - `blob_storage_authority`: Hostname of the blob service, defaulting to +#' `"blob.core.windows.net"`. +#' - `blob_storage_scheme`: Either `"http"` or `"https"` (the default). +#' - `client_id`: The client/application ID for Azure Active Directory +#' authentication. If used with `client_secret` and `tenant_id` then it is the +#' application ID for a registered Azure AD application. Otherwise, it is the +#' client ID of a user-assigned managed identity. +#' - `client_secret`: Client secret for Azure Active Directory authentication. +#' Must be provided with both `client_id` and `tenant_id`. +#' - `dfs_storage_authority`: Hostname of the data lake (gen 2) service, +#' defaulting to `"dfs.core.windows.net"`. +#' - `dfs_storage_scheme`: Either `"http"` or `"https"` (the default). +#' - `sas_token`: Shared access signature (SAS) token for the storage account. +#' Cannot be used with `account key`. +#' - `tenant_id`: Tenant ID for Azure Active Directory authentication. Must +#' be provided with both `client_id` and `client_secret`. +#' #' @section Methods: #' #' - `path(x)`: Create a `SubTreeFileSystem` from the current `FileSystem` @@ -253,6 +278,13 @@ FileSelector$create <- function(base_dir, allow_not_found = FALSE, recursive = F #' (the default), 'ERROR', 'WARN', 'INFO', 'DEBUG' (recommended), 'TRACE', and #' 'OFF'. #' +#' On `AzureFileSystem`, passing no arguments for authentication uses the +#' `AzureDefaultCredential` for authentication, so that several authentication +#' types are tried until one succeeds. +#' +#' `AzureFileSystem` is not presently supported on Windows due to upstream +#' compatibility issues between the Azure C++ SDK and the MinGW toolchain. +#' #' @usage NULL #' @format NULL #' @docType class @@ -645,6 +677,95 @@ GcsFileSystem$create <- function(anonymous = FALSE, retry_limit_seconds = 15, .. fs___GcsFileSystem__Make(anonymous, options) } +#' @usage NULL +#' @format NULL +#' @rdname FileSystem +#' @importFrom utils modifyList +#' @export +AzureFileSystem <- R6Class( + "AzureFileSystem", + inherit = FileSystem +) + +AzureFileSystem$create <- function(account_name, ...) { + options <- list(...) + valid_opts <- c( + "account_key", + "blob_storage_authority", + "blob_storage_scheme", + "client_id", + "client_secret", + "dfs_storage_authority", + "dfs_storage_scheme", + "sas_token", + "tenant_id" + ) + + invalid_opts <- setdiff(names(options), valid_opts) + if (length(invalid_opts)) { + stop( + "Invalid options for AzureFileSystem: ", + oxford_paste(invalid_opts), + call. = FALSE + ) + } + # The c++ code assumes that the various combinations of authentication methods + # have been validated in this function. + if (!is.null(options$tenant_id) || !is.null(options$client_id) || !is.null(options$client_secret)) { + if (is.null(options$client_id)) { + stop( + "`client_id` must be given with `tenant_id` and `client_secret`", + call. = FALSE + ) + } + if (sum(is.null(options$tenant_id), is.null(options$client_secret)) == 1) { + stop( + "Provide only `client_id` to authenticate with ", + "Managed Identity Credential, or provide `client_id`, `tenant_id`, ", + "and`client_secret` to authenticate with Client Secret Credential", + call. = FALSE + ) + } + } else if (!is.null(options$account_key) && !is.null(options$sas_token)) { + stop( + "Cannot specify both `account_key` and `sas_token`", + call. = FALSE + ) + } + + fs___AzureFileSystem__Make(c(account_name = account_name, options)) +} + +#' Connect to an Azure Blob Storage container +#' +#' `az_conainer` is a convenience function to create an `AzureFileSystem` object +#' that provides a file system interface for blob storage containers in an Azure +#' Storage Account. +#' +#' @param container_path string Container name or path. +#' @param ... Additional connection options, passed to `AzureFileSystem$create()`. +#' +#' @return A `SubTreeFileSystem` containing an `AzureFileSystem` and the container's +#' relative path. Note that this function's success does not guarantee that you +#' are authorized to access the container's contents. +#' @examplesIf FALSE +#' container_fs <- az_container( +#' container_path = "arrow-datasets", +#' account_name = azurite_account_name, +#' account_key = azurite_account_key, +#' blob_storage_authority = azurite_blob_storage_authority, +#' blob_storage_scheme = azurite_blob_storage_scheme +#' ) +#' @export +az_container <- function(container_path, ...) { + assert_that(is.string(container_path)) + args <- list2(...) + + fs <- exec(AzureFileSystem$create, !!!args) + + SubTreeFileSystem$create(container_path, fs) +} + #' @usage NULL #' @format NULL #' @rdname FileSystem diff --git a/r/R/type.R b/r/R/type.R index 14a4c8f1d2..da60b027de 100644 --- a/r/R/type.R +++ b/r/R/type.R @@ -69,8 +69,6 @@ FLOAT_TYPES <- c("float16", "float32", "float64", "halffloat", "float", "double" #' Infer the arrow Array type from an R object #' -#' [type()] is deprecated in favor of [infer_type()]. -#' #' @param x an R object (usually a vector) to be converted to an [Array] or #' [ChunkedArray]. #' @param ... Passed to S3 methods @@ -88,12 +86,6 @@ FLOAT_TYPES <- c("float16", "float32", "float64", "halffloat", "float", "double" #' @export infer_type <- function(x, ...) UseMethod("infer_type") -#' @rdname infer_type -#' @export -type <- function(x) { - .Deprecated("infer_type") - infer_type(x) -} #' @export infer_type.default <- function(x, ..., from_array_infer_type = FALSE) { diff --git a/r/data-raw/docgen.R b/r/data-raw/docgen.R index 13e9195cce..7b577323f2 100644 --- a/r/data-raw/docgen.R +++ b/r/data-raw/docgen.R @@ -101,10 +101,16 @@ render_fun <- function(fun, pkg_fun, notes) { # Make it \code{} for better formatting fun <- paste0("`", fun, "`") # Wrap in \link{} + # Operators need base:: prefix to disambiguate from other packages (e.g. bit64) + link_target <- ifelse( + !not_operators & !grepl("::", pkg_fun), + paste0("base::", pkg_fun), + pkg_fun + ) out <- ifelse( pkg_fun %in% do_not_link, fun, - paste0("[", fun, "][", pkg_fun, "()]") + paste0("[", fun, "][", link_target, "()]") ) # Add notes after :, if exist has_notes <- nzchar(notes) diff --git a/r/man/FileSystem.Rd b/r/man/FileSystem.Rd index 83e7fc6526..f21c69c0a5 100644 --- a/r/man/FileSystem.Rd +++ b/r/man/FileSystem.Rd @@ -6,6 +6,7 @@ \alias{LocalFileSystem} \alias{S3FileSystem} \alias{GcsFileSystem} +\alias{AzureFileSystem} \alias{SubTreeFileSystem} \title{FileSystem classes} \description{ @@ -89,6 +90,33 @@ the filesystem encounters errors. Default is 15 seconds. \item \code{default_metadata}: default metadata to write in new objects. \item \code{project_id}: the project to use for creating buckets. } + +\code{AzureFileSystem$create()} takes following required argument: +\itemize{ +\item \code{account_name}: Azure Blob Storage account name. +} + +\code{AzureFileSystem$create()} takes following optional arguments: +\itemize{ +\item \code{account_key}: Account key of the storage account. Cannot be used with +\code{sas_token}. +\item \code{blob_storage_authority}: Hostname of the blob service, defaulting to +\code{"blob.core.windows.net"}. +\item \code{blob_storage_scheme}: Either \code{"http"} or \code{"https"} (the default). +\item \code{client_id}: The client/application ID for Azure Active Directory +authentication. If used with \code{client_secret} and \code{tenant_id} then it is the +application ID for a registered Azure AD application. Otherwise, it is the +client ID of a user-assigned managed identity. +\item \code{client_secret}: Client secret for Azure Active Directory authentication. +Must be provided with both \code{client_id} and \code{tenant_id}. +\item \code{dfs_storage_authority}: Hostname of the data lake (gen 2) service, +defaulting to \code{"dfs.core.windows.net"}. +\item \code{dfs_storage_scheme}: Either \code{"http"} or \code{"https"} (the default). +\item \code{sas_token}: Shared access signature (SAS) token for the storage account. +Cannot be used with \verb{account key}. +\item \code{tenant_id}: Tenant ID for Azure Active Directory authentication. Must +be provided with both \code{client_id} and \code{client_secret}. +} } \section{Methods}{ @@ -161,5 +189,12 @@ environment variable \code{ARROW_S3_LOG_LEVEL} (e.g., to running any code that interacts with S3. Possible values include 'FATAL' (the default), 'ERROR', 'WARN', 'INFO', 'DEBUG' (recommended), 'TRACE', and 'OFF'. + +On \code{AzureFileSystem}, passing no arguments for authentication uses the +\code{AzureDefaultCredential} for authentication, so that several authentication +types are tried until one succeeds. + +\code{AzureFileSystem} is not presently supported on Windows due to upstream +compatibility issues between the Azure C++ SDK and the MinGW toolchain. } diff --git a/r/man/acero.Rd b/r/man/acero.Rd index 3821eaef3a..0cd6e284e4 100644 --- a/r/man/acero.Rd +++ b/r/man/acero.Rd @@ -72,7 +72,7 @@ can assume that the function works in Acero just as it does in R. Functions can be called either as \code{pkg::fun()} or just \code{fun()}, i.e. both \code{str_sub()} and \code{stringr::str_sub()} work. -In addition to these functions, you can call any of Arrow's 281 compute +In addition to these functions, you can call any of Arrow's 254 compute functions directly. Arrow has many functions that don't map to an existing R function. In other cases where there is an R function mapping, you can still call the Arrow function directly if you don't want the adaptations that the R @@ -89,24 +89,24 @@ as \code{arrow_ascii_is_decimal}. \subsection{base}{ \itemize{ -\item \code{\link{!}} -\item \code{\link{!=}} -\item \code{\link{\%\%}} -\item \code{\link{\%/\%}} -\item \code{\link{\%in\%}} -\item \code{\link{&}} -\item \code{\link{*}} -\item \code{\link{+}} -\item \code{\link{-}} -\item \code{\link{/}} -\item \code{\link{<}} -\item \code{\link{<=}} -\item \code{\link{==}} -\item \code{\link{>}} -\item \code{\link{>=}} +\item \code{\link[base:!]{!}} +\item \code{\link[base:!=]{!=}} +\item \code{\link[base:\%\%]{\%\%}} +\item \code{\link[base:\%/\%]{\%/\%}} +\item \code{\link[base:\%in\%]{\%in\%}} +\item \code{\link[base:&]{&}} +\item \code{\link[base:*]{*}} +\item \code{\link[base:+]{+}} +\item \code{\link[base:-]{-}} +\item \code{\link[base:/]{/}} +\item \code{\link[base:<]{<}} +\item \code{\link[base:<=]{<=}} +\item \code{\link[base:==]{==}} +\item \code{\link[base:>]{>}} +\item \code{\link[base:>=]{>=}} \item \code{\link[base:ISOdate]{ISOdate()}} \item \code{\link[base:ISOdatetime]{ISOdatetime()}} -\item \code{\link{^}} +\item \code{\link[base:^]{^}} \item \code{\link[base:abs]{abs()}} \item \code{\link[base:acos]{acos()}} \item \code{\link[base:acosh]{acosh()}} @@ -184,7 +184,7 @@ Valid values are "s", "ms" (default), "us", "ns". \item \code{\link[base:tolower]{tolower()}} \item \code{\link[base:toupper]{toupper()}} \item \code{\link[base:trunc]{trunc()}} -\item \code{\link{|}} +\item \code{\link[base:|]{|}} } } diff --git a/r/man/arrow_info.Rd b/r/man/arrow_info.Rd index a839d3ba8f..9585662e76 100644 --- a/r/man/arrow_info.Rd +++ b/r/man/arrow_info.Rd @@ -2,7 +2,6 @@ % Please edit documentation in R/arrow-info.R \name{arrow_info} \alias{arrow_info} -\alias{arrow_available} \alias{arrow_with_acero} \alias{arrow_with_dataset} \alias{arrow_with_substrait} @@ -14,8 +13,6 @@ \usage{ arrow_info() -arrow_available() - arrow_with_acero() arrow_with_dataset() diff --git a/r/man/infer_type.Rd b/r/man/infer_type.Rd index 1bba272556..92c430d415 100644 --- a/r/man/infer_type.Rd +++ b/r/man/infer_type.Rd @@ -2,12 +2,9 @@ % Please edit documentation in R/type.R \name{infer_type} \alias{infer_type} -\alias{type} \title{Infer the arrow Array type from an R object} \usage{ infer_type(x, ...) - -type(x) } \arguments{ \item{x}{an R object (usually a vector) to be converted to an \link{Array} or @@ -19,7 +16,7 @@ type(x) An arrow \link[=data-type]{data type} } \description{ -\code{\link[=type]{type()}} is deprecated in favor of \code{\link[=infer_type]{infer_type()}}. +Infer the arrow Array type from an R object } \examples{ infer_type(1:10) diff --git a/r/src/type_infer.cpp b/r/src/type_infer.cpp index 76a1499305..b492cfde1c 100644 --- a/r/src/type_infer.cpp +++ b/r/src/type_infer.cpp @@ -222,7 +222,7 @@ std::shared_ptr<arrow::DataType> InferArrowType(SEXP x) { cpp11::sexp type_result = cpp11::package("arrow")["infer_type"]( x, cpp11::named_arg("from_array_infer_type") = true); if (!Rf_inherits(type_result, "DataType")) { - cpp11::stop("type() did not return an object of type DataType"); + cpp11::stop("infer_type() did not return an object of type DataType"); } return cpp11::as_cpp<std::shared_ptr<arrow::DataType>>(type_result); diff --git a/r/tests/testthat/test-arrow-info.R b/r/tests/testthat/test-arrow-info.R index addd3d740c..9eac608148 100644 --- a/r/tests/testthat/test-arrow-info.R +++ b/r/tests/testthat/test-arrow-info.R @@ -21,7 +21,3 @@ test_that("arrow_info()", { options(arrow.foo = FALSE) expect_output(print(arrow_info()), "arrow.foo") }) - -test_that("arrow_available() is deprecated", { - expect_deprecated(arrow_available(), "always") -}) diff --git a/r/tests/testthat/test-type.R b/r/tests/testthat/test-type.R index 74c868faac..e45dd2c051 100644 --- a/r/tests/testthat/test-type.R +++ b/r/tests/testthat/test-type.R @@ -327,15 +327,6 @@ test_that("infer_type() infers type for vctrs", { ) }) -test_that("type() is deprecated", { - a <- Array$create(1:10) - expect_deprecated( - a_type <- type(a), - "infer_type" - ) - expect_equal(a_type, a$type) -}) - test_that("infer_type() infers type for lists of raw() as binary()", { expect_equal( infer_type(list(raw())),
