diff --git a/cpp/src/arrow/util/macros.h b/cpp/src/arrow/util/macros.h
index 2da3933f5043..ccfb960426be 100644
--- a/cpp/src/arrow/util/macros.h
+++ b/cpp/src/arrow/util/macros.h
@@ -152,13 +152,13 @@
#ifdef __clang__
# define ARROW_SUPPRESS_DEPRECATION_WARNING \
- _Pragma("clang diagnostic push"); \
- _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
+ _Pragma("clang diagnostic push") \
+ _Pragma("clang diagnostic ignored \"-Wdeprecated-declarations\"")
# define ARROW_UNSUPPRESS_DEPRECATION_WARNING _Pragma("clang diagnostic pop")
#elif defined(__GNUC__)
# define ARROW_SUPPRESS_DEPRECATION_WARNING \
- _Pragma("GCC diagnostic push"); \
- _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wdeprecated-declarations\"")
# define ARROW_UNSUPPRESS_DEPRECATION_WARNING _Pragma("GCC diagnostic pop")
#elif defined(_MSC_VER)
# define ARROW_SUPPRESS_DEPRECATION_WARNING \
@@ -174,8 +174,8 @@
// Macros to disable warnings about undeclared global functions
#if defined(__GNUC__)
# define ARROW_SUPPRESS_MISSING_DECLARATIONS_WARNING \
- _Pragma("GCC diagnostic push"); \
- _Pragma("GCC diagnostic ignored \"-Wmissing-declarations\"")
+ _Pragma("GCC diagnostic push") \
+ _Pragma("GCC diagnostic ignored \"-Wmissing-declarations\"")
# define ARROW_UNSUPPRESS_MISSING_DECLARATIONS_WARNING _Pragma("GCC diagnostic pop")
#else
# define ARROW_SUPPRESS_MISSING_DECLARATIONS_WARNING
diff --git a/r/NAMESPACE b/r/NAMESPACE
index f74034c965b7..f3e0b1a0dc91 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/NEWS.md b/r/NEWS.md
index f90d94d1bacb..92068e1bb04d 100644
--- a/r/NEWS.md
+++ b/r/NEWS.md
@@ -19,7 +19,44 @@
# arrow 25.0.0
-# arrow 24.0.0
+## Breaking changes
+
+- Arrow `uint64` types are now always converted to R `double` (numeric) vectors,
+ regardless of the values. Previously, small `uint64` values were converted to
+ R `integer`, which could cause inconsistent types within list columns when
+ different list elements had different value ranges (#50339).
+
+## New features
+
+- `Field` objects now support field-level metadata via `$metadata` and
+ `$with_metadata()` (@max-romagnoli, #33390).
+- Parquet files now support list-columns of ordered factors (ordered
+ dictionaries) (#49689).
+
+## Minor improvements and fixes
+
+- `Array$create()` now gives a clearer error message when given a `POSIXct`
+ object with an invalid timezone (#40886).
+- Dictionary arrays with `large_string` value types now convert correctly to R
+ factors (#39603).
+- `open_dataset()` now gives a clearer error message when providing a mix of
+ readr and Arrow options (@Rich-T-kid, #33420).
+- `read_parquet()` no longer triggers a C++ alignment warning from the Acero
+ source node (#46178).
+- `Schema` metadata partial matching on `$metadata$r` no longer errors when
+ other metadata keys start with "r" (#50163).
+- `to_arrow()` now preserves `group_by()` when converting from a dbplyr lazy
+ table (#40640).
+- `write_parquet()` now correctly validates that `max_rows_per_group` is a
+ positive number (#40742).
+- Stale S3 connections no longer cause a segfault during garbage collection
+ (#50009).
+- Spurious "Invalid metadata$r" warnings are no longer emitted when reading
+ files with custom schema metadata (#48712).
+
+## Installation
+
+- The R package now builds under r-universe/r-wasm (#49981).
# arrow 24.0.0
diff --git a/r/R/arrow-info.R b/r/R/arrow-info.R
index 699f94dcbdb5..38ff09127a53 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 60ede3553acb..7a230aaa752f 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 2f5bbc11b675..213d9eed232a 100644
--- a/r/R/dplyr-funcs-doc.R
+++ b/r/R/dplyr-funcs-doc.R
@@ -84,7 +84,7 @@
#' Functions can be called either as `pkg::fun()` or just `fun()`, i.e. both
#' `str_sub()` and `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 282 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
@@ -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/type.R b/r/R/type.R
index 27cb0afe3db6..42415c338061 100644
--- a/r/R/type.R
+++ b/r/R/type.R
@@ -88,12 +88,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) {
@@ -356,13 +350,14 @@ NestedType <- R6Class("NestedType", inherit = DataType)
#' `date32()` creates a datetime type with a "day" unit, like the R `Date`
#' class. `date64()` has a "ms" unit.
#'
-#' `uint32` (32 bit unsigned integer), `uint64` (64 bit unsigned integer), and
-#' `int64` (64-bit signed integer) types may contain values that exceed the
-#' range of R's `integer` type (32-bit signed integer). When these arrow objects
-#' are translated to R objects, `uint32` and `uint64` are converted to `double`
-#' ("numeric") and `int64` is converted to `bit64::integer64`. For `int64`
-#' types, this conversion can be disabled (so that `int64` always yields a
-#' `bit64::integer64` object) by setting `options(arrow.int64_downcast =
+#' `uint64` (64 bit unsigned integer) is always converted to `double`
+#' ("numeric") in R. Note that doubles cannot exactly represent all uint64
+#' values; precision may be lost for values above 2^53. `uint32` (32 bit unsigned integer) and `int64` (64-bit
+#' signed integer) types may contain values that exceed the range of R's
+#' `integer` type (32-bit signed integer). When they do, `uint32` is converted
+#' to `double` ("numeric") and `int64` is converted to `bit64::integer64`. For
+#' `int64` types, this conversion can be disabled (so that `int64` always yields
+#' a `bit64::integer64` object) by setting `options(arrow.int64_downcast =
#' FALSE)`.
#'
#' `decimal128()` creates a `Decimal128Type`. Arrow decimals are fixed-point
diff --git a/r/R/util.R b/r/R/util.R
index cc16bb7ccf4d..dc48c5fb8ff8 100644
--- a/r/R/util.R
+++ b/r/R/util.R
@@ -44,7 +44,7 @@ is_list_of <- function(object, class) {
is.list(object) && all(map_lgl(object, ~ inherits(., class)))
}
-empty_named_list <- function() structure(list(), .Names = character(0))
+empty_named_list <- function() structure(list(), names = character(0))
r_symbolic_constants <- c(
"pi",
diff --git a/r/README.md b/r/README.md
index 268ee24bdf00..d296143d276e 100644
--- a/r/README.md
+++ b/r/README.md
@@ -1,13 +1,5 @@
# arrow
-
-
-[](https://cran.r-project.org/package=arrow)
-[](https://github.com/apache/arrow/actions/workflows/r.yml?query=branch%3Amain+event%3Apush)
-[](https://apache.r-universe.dev)
-[](https://anaconda.org/conda-forge/r-arrow)
-
-
## Overview
diff --git a/r/data-raw/docgen.R b/r/data-raw/docgen.R
index 13e9195ccea3..7b577323f272 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/acero.Rd b/r/man/acero.Rd
index 3821eaef3a97..155e5a045894 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 282 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 a839d3ba8fd2..9585662e768f 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/data-type.Rd b/r/man/data-type.Rd
index aa11c222bc55..29fb667ed6ba 100644
--- a/r/man/data-type.Rd
+++ b/r/man/data-type.Rd
@@ -171,13 +171,14 @@ A few functions have aliases:
\code{date32()} creates a datetime type with a "day" unit, like the R \code{Date}
class. \code{date64()} has a "ms" unit.
-\code{uint32} (32 bit unsigned integer), \code{uint64} (64 bit unsigned integer), and
-\code{int64} (64-bit signed integer) types may contain values that exceed the
-range of R's \code{integer} type (32-bit signed integer). When these arrow objects
-are translated to R objects, \code{uint32} and \code{uint64} are converted to \code{double}
-("numeric") and \code{int64} is converted to \code{bit64::integer64}. For \code{int64}
-types, this conversion can be disabled (so that \code{int64} always yields a
-\code{bit64::integer64} object) by setting \code{options(arrow.int64_downcast = FALSE)}.
+\code{uint64} (64 bit unsigned integer) is always converted to \code{double}
+("numeric") in R. Note that doubles cannot exactly represent all uint64
+values; precision may be lost for values above 2^53. \code{uint32} (32 bit unsigned integer) and \code{int64} (64-bit
+signed integer) types may contain values that exceed the range of R's
+\code{integer} type (32-bit signed integer). When they do, \code{uint32} is converted
+to \code{double} ("numeric") and \code{int64} is converted to \code{bit64::integer64}. For
+\code{int64} types, this conversion can be disabled (so that \code{int64} always yields
+a \code{bit64::integer64} object) by setting \code{options(arrow.int64_downcast = FALSE)}.
\code{decimal128()} creates a \code{Decimal128Type}. Arrow decimals are fixed-point
decimal numbers encoded as a scalar integer. The \code{precision} is the number of
diff --git a/r/man/infer_type.Rd b/r/man/infer_type.Rd
index 1bba27255678..d1412693628b 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
diff --git a/r/src/array_to_vector.cpp b/r/src/array_to_vector.cpp
index 0992181acfe8..dc02c711d1eb 100644
--- a/r/src/array_to_vector.cpp
+++ b/r/src/array_to_vector.cpp
@@ -1296,13 +1296,8 @@ std::shared_ptr Converter::Make(
}
case Type::UINT64:
- if (ArraysCanFitInteger(chunked_array->chunks())) {
- return std::make_shared>(
- chunked_array);
- } else {
- return std::make_shared>(
- chunked_array);
- }
+ return std::make_shared>(
+ chunked_array);
case Type::HALF_FLOAT:
return std::make_shared>(
diff --git a/r/src/arrowExports.cpp b/r/src/arrowExports.cpp
index 5482c8679f68..8a67d0acd89d 100644
--- a/r/src/arrowExports.cpp
+++ b/r/src/arrowExports.cpp
@@ -3238,22 +3238,6 @@ BEGIN_CPP11
END_CPP11
}
// field.cpp
-bool Field__nullable(const std::shared_ptr& field);
-extern "C" SEXP _arrow_Field__nullable(SEXP field_sexp){
-BEGIN_CPP11
- arrow::r::Input&>::type field(field_sexp);
- return cpp11::as_sexp(Field__nullable(field));
-END_CPP11
-}
-// field.cpp
-std::shared_ptr Field__type(const std::shared_ptr& field);
-extern "C" SEXP _arrow_Field__type(SEXP field_sexp){
-BEGIN_CPP11
- arrow::r::Input&>::type field(field_sexp);
- return cpp11::as_sexp(Field__type(field));
-END_CPP11
-}
-// field.cpp
bool Field__HasMetadata(const std::shared_ptr& field);
extern "C" SEXP _arrow_Field__HasMetadata(SEXP field_sexp){
BEGIN_CPP11
@@ -3286,6 +3270,22 @@ BEGIN_CPP11
return cpp11::as_sexp(Field__RemoveMetadata(field));
END_CPP11
}
+// field.cpp
+bool Field__nullable(const std::shared_ptr& field);
+extern "C" SEXP _arrow_Field__nullable(SEXP field_sexp){
+BEGIN_CPP11
+ arrow::r::Input&>::type field(field_sexp);
+ return cpp11::as_sexp(Field__nullable(field));
+END_CPP11
+}
+// field.cpp
+std::shared_ptr Field__type(const std::shared_ptr& field);
+extern "C" SEXP _arrow_Field__type(SEXP field_sexp){
+BEGIN_CPP11
+ arrow::r::Input&>::type field(field_sexp);
+ return cpp11::as_sexp(Field__type(field));
+END_CPP11
+}
// filesystem.cpp
fs::FileType fs___FileInfo__type(const std::shared_ptr& x);
extern "C" SEXP _arrow_fs___FileInfo__type(SEXP x_sexp){
@@ -5878,10 +5878,10 @@ static const R_CallMethodDef CallEntries[] = {
{ "_arrow_compute__GetFunctionNames", (DL_FUNC) &_arrow_compute__GetFunctionNames, 0},
{ "_arrow_compute__Initialize", (DL_FUNC) &_arrow_compute__Initialize, 0},
{ "_arrow_RegisterScalarUDF", (DL_FUNC) &_arrow_RegisterScalarUDF, 2},
- { "_arrow_build_info", (DL_FUNC) &_arrow_build_info, 0},
- { "_arrow_runtime_info", (DL_FUNC) &_arrow_runtime_info, 0},
- { "_arrow_set_timezone_database", (DL_FUNC) &_arrow_set_timezone_database, 1},
- { "_arrow_csv___WriteOptions__initialize", (DL_FUNC) &_arrow_csv___WriteOptions__initialize, 1},
+ { "_arrow_build_info", (DL_FUNC) &_arrow_build_info, 0},
+ { "_arrow_runtime_info", (DL_FUNC) &_arrow_runtime_info, 0},
+ { "_arrow_set_timezone_database", (DL_FUNC) &_arrow_set_timezone_database, 1},
+ { "_arrow_csv___WriteOptions__initialize", (DL_FUNC) &_arrow_csv___WriteOptions__initialize, 1},
{ "_arrow_csv___ReadOptions__initialize", (DL_FUNC) &_arrow_csv___ReadOptions__initialize, 1},
{ "_arrow_csv___ParseOptions__initialize", (DL_FUNC) &_arrow_csv___ParseOptions__initialize, 1},
{ "_arrow_csv___ReadOptions__column_names", (DL_FUNC) &_arrow_csv___ReadOptions__column_names, 1},
@@ -6054,12 +6054,12 @@ static const R_CallMethodDef CallEntries[] = {
{ "_arrow_Field__ToString", (DL_FUNC) &_arrow_Field__ToString, 1},
{ "_arrow_Field__name", (DL_FUNC) &_arrow_Field__name, 1},
{ "_arrow_Field__Equals", (DL_FUNC) &_arrow_Field__Equals, 3},
- { "_arrow_Field__nullable", (DL_FUNC) &_arrow_Field__nullable, 1},
- { "_arrow_Field__type", (DL_FUNC) &_arrow_Field__type, 1},
{ "_arrow_Field__HasMetadata", (DL_FUNC) &_arrow_Field__HasMetadata, 1},
{ "_arrow_Field__metadata", (DL_FUNC) &_arrow_Field__metadata, 1},
{ "_arrow_Field__WithMetadata", (DL_FUNC) &_arrow_Field__WithMetadata, 2},
{ "_arrow_Field__RemoveMetadata", (DL_FUNC) &_arrow_Field__RemoveMetadata, 1},
+ { "_arrow_Field__nullable", (DL_FUNC) &_arrow_Field__nullable, 1},
+ { "_arrow_Field__type", (DL_FUNC) &_arrow_Field__type, 1},
{ "_arrow_fs___FileInfo__type", (DL_FUNC) &_arrow_fs___FileInfo__type, 1},
{ "_arrow_fs___FileInfo__set_type", (DL_FUNC) &_arrow_fs___FileInfo__set_type, 2},
{ "_arrow_fs___FileInfo__path", (DL_FUNC) &_arrow_fs___FileInfo__path, 1},
diff --git a/r/tests/testthat/test-Array.R b/r/tests/testthat/test-Array.R
index 9fcc3e6b868d..b5233eb30360 100644
--- a/r/tests/testthat/test-Array.R
+++ b/r/tests/testthat/test-Array.R
@@ -521,23 +521,25 @@ test_that("Array$as_vector() converts to integer (ARROW-3794)", {
expect_as_vector(a, u8)
})
-test_that("Arrays of {,u}int{32,64} convert to integer if they can fit", {
+test_that("Arrays of uint32 and int64 convert to integer if they can fit", {
u32 <- arrow_array(1L)$cast(uint32())
expect_identical(as.vector(u32), 1L)
- u64 <- arrow_array(1L)$cast(uint64())
- expect_identical(as.vector(u64), 1L)
-
i64 <- arrow_array(bit64::as.integer64(1:10))
expect_identical(as.vector(i64), 1:10)
})
-test_that("Arrays of uint{32,64} convert to numeric if they can't fit integer", {
+test_that("Arrays of uint32 convert to numeric if they can't fit integer", {
u32 <- arrow_array(bit64::as.integer64(1) + MAX_INT)$cast(uint32())
expect_identical(as.vector(u32), 1 + MAX_INT)
+})
- u64 <- arrow_array(bit64::as.integer64(1) + MAX_INT)$cast(uint64())
- expect_identical(as.vector(u64), 1 + MAX_INT)
+test_that("Arrays of uint64 always convert to numeric (double)", {
+ u64_small <- arrow_array(1L)$cast(uint64())
+ expect_identical(as.vector(u64_small), 1)
+
+ u64_large <- arrow_array(bit64::as.integer64(1) + MAX_INT)$cast(uint64())
+ expect_identical(as.vector(u64_large), 1 + MAX_INT)
})
test_that("arrow_array() recognise arrow::Array (ARROW-3815)", {
@@ -1453,3 +1455,14 @@ test_that("Array handles negative fractional dates correctly (GH-46873)", {
arr <- arrow_array(d)
expect_equal(as.vector(arr), as.Date("1969-12-31", origin = "1970-01-01"))
})
+
+test_that("uint64 inside list columns always converts to double (GH-50339)", {
+ list_arr <- arrow_array(
+ list(1, 9999999999),
+ type = list_of(uint64())
+ )
+
+ result <- as.vector(list_arr)
+ expect_type(result[[1]], "double")
+ expect_type(result[[2]], "double")
+})
diff --git a/r/tests/testthat/test-arrow-info.R b/r/tests/testthat/test-arrow-info.R
index addd3d740c2b..9eac6081486f 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 74c868faac2a..e45dd2c051c1 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())),
diff --git a/r/tools/checksums/r-libarrow-darwin-arm64-25.0.0.zip.sha512 b/r/tools/checksums/r-libarrow-darwin-arm64-25.0.0.zip.sha512
new file mode 100644
index 000000000000..af8d08d9d278
--- /dev/null
+++ b/r/tools/checksums/r-libarrow-darwin-arm64-25.0.0.zip.sha512
@@ -0,0 +1 @@
+e432c205d53cde3d3bc52dd62792f0cf6e9aa2848fa682e830a96458e28f3b929c8e685d93ed2dde6fcf4ff0c80c8f57b3fe63ac6e482fac5f212b9251952252 r-libarrow-darwin-arm64-25.0.0.zip
diff --git a/r/tools/checksums/r-libarrow-darwin-x86_64-25.0.0.zip.sha512 b/r/tools/checksums/r-libarrow-darwin-x86_64-25.0.0.zip.sha512
new file mode 100644
index 000000000000..19212a54ef7e
--- /dev/null
+++ b/r/tools/checksums/r-libarrow-darwin-x86_64-25.0.0.zip.sha512
@@ -0,0 +1 @@
+615890e76edb85689d840405c5d7a9d90ab9532341a450b8f371c9e59b5c2116c99e43d7f38871b46293c72cf2a8deb93d0f237ea49a7ba6898abf7e47f828a0 r-libarrow-darwin-x86_64-25.0.0.zip
diff --git a/r/tools/checksums/r-libarrow-linux-arm64-25.0.0.zip.sha512 b/r/tools/checksums/r-libarrow-linux-arm64-25.0.0.zip.sha512
new file mode 100644
index 000000000000..d99f254b6603
--- /dev/null
+++ b/r/tools/checksums/r-libarrow-linux-arm64-25.0.0.zip.sha512
@@ -0,0 +1 @@
+b275be8578fa69c4aaef84f884c5ca12290d0f75fc2663709d7f31ca45dfbf1894cd076743568ad89a8a918325624c1853617e5955a776180631b7332fedd891 r-libarrow-linux-arm64-25.0.0.zip
diff --git a/r/tools/checksums/r-libarrow-linux-x86_64-25.0.0.zip.sha512 b/r/tools/checksums/r-libarrow-linux-x86_64-25.0.0.zip.sha512
new file mode 100644
index 000000000000..8beff2dce457
--- /dev/null
+++ b/r/tools/checksums/r-libarrow-linux-x86_64-25.0.0.zip.sha512
@@ -0,0 +1 @@
+5326af62f01e032ed1122332ebe5aa2d77494f31c004c8b88bd1d504d732c6e7b6d6758029910714cbc0778287a44984bec117babbe5dff93a1a71296133e215 r-libarrow-linux-x86_64-25.0.0.zip
diff --git a/r/tools/checksums/r-libarrow-windows-x86_64-25.0.0.zip.sha512 b/r/tools/checksums/r-libarrow-windows-x86_64-25.0.0.zip.sha512
new file mode 100644
index 000000000000..9a7704f1268e
--- /dev/null
+++ b/r/tools/checksums/r-libarrow-windows-x86_64-25.0.0.zip.sha512
@@ -0,0 +1 @@
+eea74cf9f68a054f433cdddde449ca0575019dba409a8aa88a39875447c4ff1059133bfe51606f9383014b6a3a456ae4b64125bbbf8368a31c88651fd4767de6 r-libarrow-windows-x86_64-25.0.0.zip
diff --git a/r/tools/nixlibs.R b/r/tools/nixlibs.R
index ba705e03ad7e..dd230c3764ff 100644
--- a/r/tools/nixlibs.R
+++ b/r/tools/nixlibs.R
@@ -526,7 +526,8 @@ build_libarrow <- function(src_dir, dst_dir) {
# Set up make for parallel building
# CRAN policy says not to use more than 2 cores during checks
# If you have more and want to use more, set MAKEFLAGS or NOT_CRAN
- ncores <- parallel::detectCores()
+ # detectCores() returns NA if number of cores is unknown. Set ncores to 1 if NA.
+ ncores <- max(1, parallel::detectCores(), na.rm = TRUE)
if (!not_cran) {
ncores <- min(ncores, 2)
}
diff --git a/r/vignettes/data_types.Rmd b/r/vignettes/data_types.Rmd
index d5c70a8f02d5..e22830f83f3b 100644
--- a/r/vignettes/data_types.Rmd
+++ b/r/vignettes/data_types.Rmd
@@ -97,12 +97,15 @@ If the value in R does not fall within the permissible range for the correspondi
chunked_array(c(10L, 3L, 200L), type = int8())
```
-When translating from Arrow to R, integer types alway translate to R integers unless one of the following exceptions applies:
+When translating from Arrow to R, integer types always translate to R integers unless one of the following exceptions applies:
-- If the value of an Arrow uint32 or uint64 falls outside the range allowed for R integers, the result will be a numeric vector in R
+- If the value of an Arrow uint32 falls outside the range allowed for R integers, the result will be a numeric vector in R
- If the value of an Arrow int64 variable falls outside the range allowed for R integers, the result will be a `bit64::integer64` vector in R
- If the user sets `options(arrow.int64_downcast = FALSE)`, the Arrow int64 type always yields a `bit64::integer64` vector in R
regardless of the value
+ - Arrow uint64 types are always converted to numeric (double) vectors in R.
+ Note that doubles cannot exactly represent all uint64 values; precision may
+ be lost for values above 2^53.
## Floating point numeric types
@@ -351,7 +354,7 @@ to Arrow list type (which is a "list of" some type).
| uint8 | integer |
| uint16 | integer |
| uint32 | integer ^1^ |
-| uint64 | integer ^1^ |
+| uint64 | double |
| float16 | - ^2^ |
| float32 | double |
| float64 | double |
@@ -376,9 +379,9 @@ to Arrow list type (which is a "list of" some type).
| map | arrow_list ^5^ |
| union | - ^2^ |
-^1^: These integer types may contain values that exceed the range of R's
-`integer` type (32 bit signed integer). When they do, `uint32` and `uint64` are
-converted to `double` ("numeric") and `int64` is converted to
+^1^: These integer types may contain values that exceed the range of R's
+`integer` type (32 bit signed integer). When they do, `uint32` is
+converted to `double` ("numeric") and `int64` is converted to
`bit64::integer64`. This conversion can be disabled (so that `int64` always
yields a `bit64::integer64` vector) by setting `options(arrow.int64_downcast = FALSE)`.