This is an automated email from the ASF dual-hosted git repository.
paleolimbot pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow-nanoarrow.git
The following commit(s) were added to refs/heads/main by this push:
new 06b34465 chore(r): Run devtools document on R pakage and test shared
dictionary read (#912)
06b34465 is described below
commit 06b34465c713c152f56e7140e4898b1db1b5e88b
Author: Dewey Dunnington <[email protected]>
AuthorDate: Wed Jul 29 22:39:18 2026 -0400
chore(r): Run devtools document on R pakage and test shared dictionary read
(#912)
Updates the roxygen generated docs for newer roxygen and adds one test
to ensure dictionary values are shared in a more realisitc test.
---
r/DESCRIPTION | 2 +-
r/NEWS.md | 5 ++
r/man/as_nanoarrow_schema.Rd | 4 +-
r/man/as_nanoarrow_schema.python.builtin.object.Rd | 2 +-
r/man/na_vctrs.Rd | 2 +-
r/man/nanoarrow-package.Rd | 1 +
r/tests/testthat/test-ipc.R | 58 ++++++++++++++++++++++
7 files changed, 69 insertions(+), 5 deletions(-)
diff --git a/r/DESCRIPTION b/r/DESCRIPTION
index 9cd9b273..60e4522f 100644
--- a/r/DESCRIPTION
+++ b/r/DESCRIPTION
@@ -19,7 +19,6 @@ Description: Provides an 'R' interface to the 'nanoarrow' 'C'
library and the
License: Apache License (>= 2)
Encoding: UTF-8
Roxygen: list(markdown = TRUE)
-RoxygenNote: 7.3.3
URL: https://arrow.apache.org/nanoarrow/latest/r/,
https://github.com/apache/arrow-nanoarrow
BugReports: https://github.com/apache/arrow-nanoarrow/issues
Suggests:
@@ -38,3 +37,4 @@ Suggests:
SystemRequirements: libzstd (optional)
Config/testthat/edition: 3
Config/build/bootstrap: TRUE
+Config/roxygen2/version: 8.0.0
diff --git a/r/NEWS.md b/r/NEWS.md
index a3cbe210..12dfb7df 100644
--- a/r/NEWS.md
+++ b/r/NEWS.md
@@ -17,6 +17,11 @@
under the License.
-->
+# nanoarrow 0.8.0-1
+
+- fix: Eliminate warnings for gcc16 and _FORTIFY_SOURCE=3 for snprintf (#892)
+- fix!: Ensure ArrowTypeString never returns NULL to fix warning on gcc (#885)
+
# nanoarrow 0.8.0
- Add reticulate/Python integration (#817)
diff --git a/r/man/as_nanoarrow_schema.Rd b/r/man/as_nanoarrow_schema.Rd
index db32ff32..b04a684e 100644
--- a/r/man/as_nanoarrow_schema.Rd
+++ b/r/man/as_nanoarrow_schema.Rd
@@ -33,8 +33,8 @@ An object of class 'nanoarrow_schema'
\description{
In nanoarrow a 'schema' refers to a \verb{struct ArrowSchema} as defined in the
Arrow C Data interface. This data structure can be used to represent an
-\code{\link[arrow:schema]{arrow::schema()}}, an
\code{\link[arrow:Field]{arrow::field()}}, or an \code{arrow::DataType}. Note
that
-in nanoarrow, an \code{\link[arrow:schema]{arrow::schema()}} and a
non-nullable \code{\link[arrow:data-type]{arrow::struct()}}
+\code{\link[arrow:schema]{arrow::schema()}}, an
\code{\link[arrow:field]{arrow::field()}}, or an \code{arrow::DataType}. Note
that
+in nanoarrow, an \code{\link[arrow:schema]{arrow::schema()}} and a
non-nullable \code{\link[arrow:struct]{arrow::struct()}}
are represented identically.
}
\examples{
diff --git a/r/man/as_nanoarrow_schema.python.builtin.object.Rd
b/r/man/as_nanoarrow_schema.python.builtin.object.Rd
index e2b0243e..a770aa51 100644
--- a/r/man/as_nanoarrow_schema.python.builtin.object.Rd
+++ b/r/man/as_nanoarrow_schema.python.builtin.object.Rd
@@ -35,7 +35,7 @@ nanoarrow_array_stream.
These functions enable Python wrapper objects created via reticulate to
be used with any function that uses
\code{\link[=as_nanoarrow_array]{as_nanoarrow_array()}} or
\code{\link[=as_nanoarrow_array_stream]{as_nanoarrow_array_stream()}} to
accept generic "arrowable" input.
-Implementations for
\code{\link[reticulate:r-py-conversion]{reticulate::py_to_r()}} and
\code{\link[reticulate:r-py-conversion]{reticulate::r_to_py()}}
+Implementations for \code{\link[reticulate:py_to_r]{reticulate::py_to_r()}}
and \code{\link[reticulate:r_to_py]{reticulate::r_to_py()}}
are also included such that nanoarrow's array/schema/array stream objects
can be passed as arguments to Python functions that would otherwise accept
an object implementing the Arrow PyCapsule protocol.
diff --git a/r/man/na_vctrs.Rd b/r/man/na_vctrs.Rd
index 6b918ca8..684fd595 100644
--- a/r/man/na_vctrs.Rd
+++ b/r/man/na_vctrs.Rd
@@ -20,7 +20,7 @@ A \link[=as_nanoarrow_schema]{nanoarrow_schema}.
The Arrow format provides a rich type system that can handle most R
vector types; however, many R vector types do not roundtrip perfectly
through Arrow memory. The vctrs extension type uses
\code{\link[vctrs:vec_data]{vctrs::vec_data()}},
-\code{\link[vctrs:vec_proxy]{vctrs::vec_restore()}}, and
\code{\link[vctrs:vec_ptype]{vctrs::vec_ptype()}} in calls to
+\code{\link[vctrs:vec_restore]{vctrs::vec_restore()}}, and
\code{\link[vctrs:vec_ptype]{vctrs::vec_ptype()}} in calls to
\code{\link[=as_nanoarrow_array]{as_nanoarrow_array()}} and
\code{\link[=convert_array]{convert_array()}} to ensure roundtrip fidelity.
}
\examples{
diff --git a/r/man/nanoarrow-package.Rd b/r/man/nanoarrow-package.Rd
index 106c080a..1ecde6c4 100644
--- a/r/man/nanoarrow-package.Rd
+++ b/r/man/nanoarrow-package.Rd
@@ -22,6 +22,7 @@ Useful links:
Authors:
\itemize{
+ \item Dewey Dunnington \email{[email protected]}
(\href{https://orcid.org/0000-0002-9415-4582}{ORCID})
\item Apache Arrow \email{[email protected]} [copyright holder]
}
diff --git a/r/tests/testthat/test-ipc.R b/r/tests/testthat/test-ipc.R
index ebf6bfd0..67043e92 100644
--- a/r/tests/testthat/test-ipc.R
+++ b/r/tests/testthat/test-ipc.R
@@ -364,3 +364,61 @@ test_that("read_nanoarrow() from connection errors when
called from another thre
"Can't read from R connection on a non-R thread"
)
})
+
+test_that("read_nanoarrow() works for dictionary arrays produced by arrow", {
+ skip_if_not_installed("arrow")
+
+ # Generate data with many small batches to stress the shared dictionary
+ levels <- LETTERS
+ df <- data.frame(
+ idx = 1:100,
+ col = factor(rep_len(rev(LETTERS), 100), levels = levels)
+ )
+ batch <- arrow::as_record_batch(df)
+
+ tf <- tempfile()
+ on.exit(unlink(tf))
+
+ # Write in small batches using RecordBatchStreamWriter
+ tbl <- arrow::Table$create(df)
+ sink <- arrow::FileOutputStream$create(tf)
+
+ writer <- arrow::RecordBatchStreamWriter$create(
+ sink,
+ batch$schema
+ )
+
+ for (i in 1:10) {
+ writer$write_batch(batch)
+ }
+
+ writer$close()
+ sink$close()
+
+ # Ensure we have a dictionary type
+ reader <- read_nanoarrow(tf)
+ schema <- reader$get_schema()
+ expect_true(batch$schema$Equals(arrow::as_schema(schema)))
+
+ # Ensure we have the expected number of batches
+ batches <- collect_array_stream(reader)
+ expect_identical(length(batches), 10L)
+
+ # Ensure all dictionaries are pointing to the same buffers (shared)
+ dictionaries <- lapply(batches, function(b) b$children$col$dictionary)
+ offsets_addr <-
nanoarrow_pointer_addr_chr(dictionaries[[1]]$buffers[[2]]$data)
+ data_addr <- nanoarrow_pointer_addr_chr(dictionaries[[1]]$buffers[[3]]$data)
+ for (dictionary in dictionaries[2:10]) {
+ offsets_addr <- nanoarrow_pointer_addr_chr(dictionary$buffers[[2]]$data)
+ data_addr <- nanoarrow_pointer_addr_chr(dictionary$buffers[[3]]$data)
+ }
+
+ # Ensure the result is correctly read into a factor
+ result <- convert_array_stream(read_nanoarrow(tf), to = df)
+ expect_identical(result, do.call(rbind, rep(list(df), 10)))
+
+ # Ensure the default read works too (by default dictionaries are expanded)
+ result <- convert_array_stream(read_nanoarrow(tf))
+ df$col <- as.character(df$col)
+ expect_identical(result, do.call(rbind, rep(list(df), 10)))
+})