From faaa04ad7a8615afb8e31cb7360ff77109cd16ca Mon Sep 17 00:00:00 2001 From: Neal Richardson Date: Tue, 16 Jun 2020 10:24:21 -0700 Subject: [PATCH 1/2] ARROW-9031: [R] Implement conversion from Type::UINT64 to R vector --- r/src/array_to_vector.cpp | 4 ++++ r/tests/testthat/test-Array.R | 8 ++++++++ 2 files changed, 12 insertions(+) diff --git a/r/src/array_to_vector.cpp b/r/src/array_to_vector.cpp index d92eaaea0a2..27fe6d15070 100644 --- a/r/src/array_to_vector.cpp +++ b/r/src/array_to_vector.cpp @@ -721,6 +721,10 @@ std::shared_ptr Converter::Make(const std::shared_ptr& type return std::make_shared>( std::move(arrays)); + case Type::UINT64: + return std::make_shared>( + std::move(arrays)); + case Type::HALF_FLOAT: return std::make_shared< arrow::r::Converter_Promotion>( diff --git a/r/tests/testthat/test-Array.R b/r/tests/testthat/test-Array.R index b105d2b158d..8749cd26426 100644 --- a/r/tests/testthat/test-Array.R +++ b/r/tests/testthat/test-Array.R @@ -385,6 +385,14 @@ test_that("Array$as_vector() converts to integer (ARROW-3794)", { expect_equal(a$as_vector(), 0:255) }) +test_that("Arrays of uint{32,64} convert to numeric", { + u32 <- Array$create(1L)$cast(uint32()) + expect_identical(as.vector(u32), 1) + + u64 <- Array$create(1L)$cast(uint64()) + expect_identical(as.vector(u64), 1) +}) + test_that("Array$create() recognise arrow::Array (ARROW-3815)", { a <- Array$create(1:10) expect_equal(a, Array$create(a)) From 35f683572a931ce9d290c6ad8dd50eb16eab3af2 Mon Sep 17 00:00:00 2001 From: Neal Richardson Date: Tue, 16 Jun 2020 13:39:50 -0700 Subject: [PATCH 2/2] Update type map docs --- r/vignettes/arrow.Rmd | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/r/vignettes/arrow.Rmd b/r/vignettes/arrow.Rmd index c9ae799bcf9..83e6b374034 100644 --- a/r/vignettes/arrow.Rmd +++ b/r/vignettes/arrow.Rmd @@ -129,7 +129,7 @@ In the tables, entries with a `-` are not currently implemented. | uint8 | integer | | uint16 | integer | | uint32 | double | -| uint64 | - | +| uint64 | double | | float16 | - | | float32 | double | | float64 | double |