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

npr 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 dfc1480  ARROW-11253 [R]: Make sure that large metadata tests are 
reproducible
dfc1480 is described below

commit dfc1480fe8e93f98fc06981bc2f45f7abc31a8f5
Author: Jonathan Keane <[email protected]>
AuthorDate: Thu Jan 14 14:58:55 2021 -0800

    ARROW-11253 [R]: Make sure that large metadata tests are reproducible
    
    Don't assert that the large strings are the same (since they might vary 
acorss R versions if those versions change the way the seed works e.g. 3.6.0)
    
    Closes #9205 from jonkeane/ARROW-11253-metadata-failures
    
    Authored-by: Jonathan Keane <[email protected]>
    Signed-off-by: Neal Richardson <[email protected]>
---
 .../golden-files/data-arrow-extra-meta_3.0.0.parquet | Bin 13263 -> 7862 bytes
 r/tests/testthat/helper-data.R                       |   6 +++++-
 r/tests/testthat/test-metadata.R                     |   2 +-
 3 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/r/tests/testthat/golden-files/data-arrow-extra-meta_3.0.0.parquet 
b/r/tests/testthat/golden-files/data-arrow-extra-meta_3.0.0.parquet
index bf95f23..3394be2 100644
Binary files 
a/r/tests/testthat/golden-files/data-arrow-extra-meta_3.0.0.parquet and 
b/r/tests/testthat/golden-files/data-arrow-extra-meta_3.0.0.parquet differ
diff --git a/r/tests/testthat/helper-data.R b/r/tests/testthat/helper-data.R
index ecce773..15ea0fc 100644
--- a/r/tests/testthat/helper-data.R
+++ b/r/tests/testthat/helper-data.R
@@ -68,9 +68,13 @@ make_big_string <- function() {
   rep(purrr::map_chr(2047:2050, ~paste(sample(letters, ., replace = TRUE), 
collapse = "")), 2^18)
 }
 
-make_string_of_size <- function(size = 1) {
+make_random_string_of_size <- function(size = 1) {
   purrr::map_chr(1000*size, ~paste(sample(letters, ., replace = TRUE), 
collapse = ""))
 }
 
+make_string_of_size <- function(size = 1) {
+  paste(rep(letters, length = 1000*size), collapse = "")
+}
+
 example_with_extra_metadata <- example_with_metadata
 attributes(example_with_extra_metadata$b) <- list(lots = 
rep(make_string_of_size(1), 100))
diff --git a/r/tests/testthat/test-metadata.R b/r/tests/testthat/test-metadata.R
index 17c43bb..5abd3d2 100644
--- a/r/tests/testthat/test-metadata.R
+++ b/r/tests/testthat/test-metadata.R
@@ -105,7 +105,7 @@ test_that("Metadata serialization compression", {
 
   # However strings where compression + serialization is not effective are no
   # worse than only serialization alone
-  large_few_strings <- as.list(rep(make_string_of_size(50), 2))
+  large_few_strings <- as.list(rep(make_random_string_of_size(50), 2))
   large_few <- .serialize_arrow_r_metadata(large_few_strings)
   expect_equal(
     object.size(large_few),

Reply via email to