You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@arrow.apache.org by ro...@apache.org on 2019/06/10 17:24:46 UTC

[arrow] branch master updated: ARROW-5541 [R]: cast from negative int32 to uint32 and uint64 are now safe

This is an automated email from the ASF dual-hosted git repository.

romainfrancois pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/arrow.git


The following commit(s) were added to refs/heads/master by this push:
     new bed52ed  ARROW-5541 [R]: cast from negative int32 to uint32 and uint64 are now safe
bed52ed is described below

commit bed52ede0b570863b57546b71d2045f7f14e905d
Author: Romain Francois <ro...@rstudio.com>
AuthorDate: Mon Jun 10 19:24:31 2019 +0200

    ARROW-5541 [R]: cast from negative int32 to uint32 and uint64 are now safe
    
    Minor test update:
    
    ``` r
    library(arrow, warn.conflicts = FALSE)
    
    a <- array(-(1:10))
    a$cast(uint32())
    #> Error in Array__cast(self, target_type, options): Invalid: Integer value out of bounds
    a$cast(uint64())
    #> Error in Array__cast(self, target_type, options): Invalid: Integer value out of bounds
    ```
    
    <sup>Created on 2019-06-10 by the [reprex package](https://reprex.tidyverse.org) (v0.3.0.9000)</sup>
    
    Author: Romain Francois <ro...@rstudio.com>
    
    Closes #4509 from romainfrancois/ARROW-5541/update_tests and squashes the following commits:
    
    0657e688 <Romain Francois> test updates now that C++ cast is safe
---
 r/tests/testthat/test-Array.R | 12 +++++-------
 1 file changed, 5 insertions(+), 7 deletions(-)

diff --git a/r/tests/testthat/test-Array.R b/r/tests/testthat/test-Array.R
index 3a9d079..b15b4bd 100644
--- a/r/tests/testthat/test-Array.R
+++ b/r/tests/testthat/test-Array.R
@@ -316,14 +316,12 @@ test_that("integer types casts (ARROW-3741)", {
   expect_true(a_uint64$IsNull(10L))
 })
 
-test_that("integer types cast safety (ARROW-3741)", {
+test_that("integer types cast safety (ARROW-3741, ARROW-5541)", {
   a <- array(-(1:10))
-  expect_error(a$cast(uint8()))
-  expect_error(a$cast(uint16()))
-
-  # this looks like a bug in the C++
-  # expect_error(a$cast(uint32()))
-  # expect_error(a$cast(uint64()))
+  expect_error(a$cast(uint8()), regexp = "Integer value out of bounds")
+  expect_error(a$cast(uint16()), regexp = "Integer value out of bounds")
+  expect_error(a$cast(uint32()), regexp = "Integer value out of bounds")
+  expect_error(a$cast(uint64()), regexp = "Integer value out of bounds")
 
   expect_error(a$cast(uint8(), safe = FALSE), NA)
   expect_error(a$cast(uint16(), safe = FALSE), NA)