Skip to content

Commit

Permalink
apacheGH-15001: [R] Fix Parquet datatype test failure (apache#15197)
Browse files Browse the repository at this point in the history
* Closes: apache#15001

Lead-authored-by: Will Jones <[email protected]>
Co-authored-by: Jonathan Keane <[email protected]>
Signed-off-by: Jonathan Keane <[email protected]>
  • Loading branch information
2 people authored and EpsilonPrime committed Jan 5, 2023
1 parent 6f9e787 commit 2c87fdc
Showing 1 changed file with 18 additions and 3 deletions.
21 changes: 18 additions & 3 deletions r/tests/testthat/test-parquet.R
Original file line number Diff line number Diff line change
Expand Up @@ -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
)
})

0 comments on commit 2c87fdc

Please sign in to comment.