Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-15001: [R] Fix Parquet datatype test failure #15197

Merged
merged 4 commits into from
Jan 5, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
)
})