You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by th...@apache.org on 2023/06/30 12:55:36 UTC
[arrow] branch main updated: GH-36396: [R] Non-existent functions called in array tests (#36397)
This is an automated email from the ASF dual-hosted git repository.
thisisnic pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new 5a06b2ec2a GH-36396: [R] Non-existent functions called in array tests (#36397)
5a06b2ec2a is described below
commit 5a06b2ec2a8eed9612ceb6866b8f8a4fecdfc607
Author: Nic Crane <th...@gmail.com>
AuthorDate: Fri Jun 30 13:55:30 2023 +0100
GH-36396: [R] Non-existent functions called in array tests (#36397)
* Closes GH-36396
* Closes: #36396
Authored-by: Nic Crane <th...@gmail.com>
Signed-off-by: Nic Crane <th...@gmail.com>
---
r/NAMESPACE | 1 +
r/R/array.R | 1 +
r/R/scalar.R | 2 +-
r/man/scalar.Rd | 1 +
r/tests/testthat/test-Array.R | 14 +++++++-------
5 files changed, 11 insertions(+), 8 deletions(-)
diff --git a/r/NAMESPACE b/r/NAMESPACE
index a60c15fbbf..aa7b30252b 100644
--- a/r/NAMESPACE
+++ b/r/NAMESPACE
@@ -274,6 +274,7 @@ export(TimestampParser)
export(Type)
export(UnionDataset)
export(all_of)
+export(arrow_array)
export(arrow_available)
export(arrow_info)
export(arrow_table)
diff --git a/r/R/array.R b/r/R/array.R
index 0202e8681d..0b8db8f449 100644
--- a/r/R/array.R
+++ b/r/R/array.R
@@ -561,4 +561,5 @@ MapArray <- R6Class("MapArray",
#' na_array <- arrow_array(c(1:5, NA))
#' na_array2 <- na_array
#' na_array2 == na_array # element-wise comparison
+#' @export
arrow_array <- Array$create
diff --git a/r/R/scalar.R b/r/R/scalar.R
index 1ada5a9f4e..11d3115e94 100644
--- a/r/R/scalar.R
+++ b/r/R/scalar.R
@@ -122,7 +122,7 @@ Scalar$create <- function(x, type = NULL) {
#' @export
scalar <- Scalar$create
-#' @rdname array
+#' @rdname scalar
#' @usage NULL
#' @format NULL
#' @export
diff --git a/r/man/scalar.Rd b/r/man/scalar.Rd
index 5b35104c16..2866e65dbf 100644
--- a/r/man/scalar.Rd
+++ b/r/man/scalar.Rd
@@ -2,6 +2,7 @@
% Please edit documentation in R/scalar.R
\name{scalar}
\alias{scalar}
+\alias{StructScalar}
\title{Create an Arrow Scalar}
\usage{
scalar(x, type = NULL)
diff --git a/r/tests/testthat/test-Array.R b/r/tests/testthat/test-Array.R
index be43a54e1f..960faa8bb7 100644
--- a/r/tests/testthat/test-Array.R
+++ b/r/tests/testthat/test-Array.R
@@ -545,13 +545,13 @@ test_that("StructArray methods", {
test_that("StructArray creation", {
# from data.frame
- a <- Structarrow_array(example_data)
+ a <- StructArray$create(example_data)
expect_identical(names(a), c("int", "dbl", "dbl2", "lgl", "false", "chr", "fct"))
expect_identical(dim(a), c(10L, 7L))
expect_r6_class(a, "StructArray")
# from Arrays
- str_array <- Structarrow_array(a = arrow_array(1:2), b = arrow_array(c("a", "b")))
+ str_array <- StructArray$create(a = arrow_array(1:2), b = arrow_array(c("a", "b")))
expect_equal(str_array[[1]], arrow_array(1:2))
expect_equal(str_array[[2]], arrow_array(c("a", "b")))
expect_r6_class(str_array, "StructArray")
@@ -915,7 +915,7 @@ test_that("is.Array", {
expect_false(is.Array(a, "utf8"))
expect_true(is.Array(a$View(float32())), "float32")
expect_false(is.Array(1))
- expect_true(is.Array(Chunkedarrow_array(1, 2)))
+ expect_true(is.Array(ChunkedArray$create(1, 2)))
})
test_that("Array$Take()", {
@@ -944,7 +944,7 @@ test_that("[ accepts Arrays and otherwise handles bad input", {
)
expect_as_vector(a[arrow_array(ind - 1, type = int8())], vec[ind])
expect_as_vector(a[arrow_array(ind - 1, type = uint8())], vec[ind])
- expect_as_vector(a[Chunkedarrow_array(8, 2, 4, type = uint8())], vec[ind])
+ expect_as_vector(a[ChunkedArray$create(8, 2, 4, type = uint8())], vec[ind])
filt <- seq_along(vec) %in% ind
expect_as_vector(a[arrow_array(filt)], vec[filt])
@@ -957,7 +957,7 @@ test_that("[ accepts Arrays and otherwise handles bad input", {
test_that("%in% works on dictionary arrays", {
a1 <- arrow_array(as.factor(c("A", "B", "C")))
- a2 <- Dictionaryarrow_array(c(0L, 1L, 2L), c(4.5, 3.2, 1.1))
+ a2 <- DictionaryArray$create(c(0L, 1L, 2L), c(4.5, 3.2, 1.1))
c1 <- arrow_array(c(FALSE, TRUE, FALSE))
c2 <- arrow_array(c(FALSE, FALSE, FALSE))
b1 <- arrow_array("B")
@@ -990,12 +990,12 @@ test_that("Array head/tail", {
})
test_that("Dictionary array: create from arrays, not factor", {
- a <- Dictionaryarrow_array(c(2L, 1L, 1L, 2L, 0L), c(4.5, 3.2, 1.1))
+ a <- DictionaryArray$create(c(2L, 1L, 1L, 2L, 0L), c(4.5, 3.2, 1.1))
expect_equal(a$type, dictionary(int32(), float64()))
})
test_that("Dictionary array: translate to R when dict isn't string", {
- a <- Dictionaryarrow_array(c(2L, 1L, 1L, 2L, 0L), c(4.5, 3.2, 1.1))
+ a <- DictionaryArray$create(c(2L, 1L, 1L, 2L, 0L), c(4.5, 3.2, 1.1))
expect_warning(
expect_identical(
as.vector(a),