From 2c87fdc9b0884ad7247a6ae5052cc5f99a5d3fce Mon Sep 17 00:00:00 2001 From: Will Jones Date: Thu, 5 Jan 2023 09:02:19 -0800 Subject: [PATCH] GH-15001: [R] Fix Parquet datatype test failure (#15197) * Closes: #15001 Lead-authored-by: Will Jones Co-authored-by: Jonathan Keane Signed-off-by: Jonathan Keane --- r/tests/testthat/test-parquet.R | 21 ++++++++++++++++++--- 1 file changed, 18 insertions(+), 3 deletions(-) diff --git a/r/tests/testthat/test-parquet.R b/r/tests/testthat/test-parquet.R index 591805d4ff5ec..be71d813bd405 100644 --- a/r/tests/testthat/test-parquet.R +++ b/r/tests/testthat/test-parquet.R @@ -453,12 +453,27 @@ test_that("deprecated int96 timestamp unit can be specified when reading Parquet }) test_that("Can read parquet with nested lists and maps", { - parquet_test_data <- test_path("../../../cpp/submodules/parquet-testing/data") + # Construct the path to the parquet-testing submodule. This will search: + # * $ARROW_SOURCE_HOME/cpp/submodules/parquet-testing/data + # * ../cpp/submodules/parquet-testing/data + # ARROW_SOURCE_HOME is set in many of our CI setups, so that will find the files + # the .. version should catch some (thought not all) ways of running tests locally + parquet_test_data <- file.path( + Sys.getenv("ARROW_SOURCE_HOME", test_path("..")), + "cpp", + "submodules", + "parquet-testing", + "data" + ) skip_if_not(dir.exists(parquet_test_data), "Parquet test data missing") pq <- read_parquet(paste0(parquet_test_data, "/nested_lists.snappy.parquet"), as_data_frame = FALSE) - expect_equal(pq$a$type, list_of(list_of(list_of(utf8())))) + expect_equal(pq$a$type, list_of(list_of(list_of(utf8()))), ignore_attr = TRUE) pq <- read_parquet(paste0(parquet_test_data, "/nested_maps.snappy.parquet"), as_data_frame = FALSE) - expect_equal(pq$a$type, map_of(utf8(), map_of(int32(), field("val", boolean(), nullable = FALSE)))) + expect_equal( + pq$a$type, + map_of(utf8(), map_of(int32(), field("val", boolean(), nullable = FALSE))), + ignore_attr = TRUE + ) })