Skip to content

Commit 89a424d

Browse files
committed
Fix failing R test
1 parent 4a160c9 commit 89a424d

File tree

2 files changed

+11
-1
lines changed

2 files changed

+11
-1
lines changed

r/tests/testthat/helper-arrow.R

+6
Original file line numberDiff line numberDiff line change
@@ -70,3 +70,9 @@ make_temp_dir <- function() {
7070
dir.create(path)
7171
normalizePath(path, winslash = "/")
7272
}
73+
74+
arrow_cpp_version_at_least <- function(version) {
75+
cpp_version <- arrow::arrow_info()$build_info$cpp_version
76+
cpp_version_parsed <- package_version(sub("-SNAPSHOT$", "", cpp_version))
77+
numeric_version(cpp_version_parsed) >= numeric_version(version)
78+
}

r/tests/testthat/test-dataset.R

+5-1
Original file line numberDiff line numberDiff line change
@@ -906,6 +906,10 @@ test_that("Dataset [ (take by index)", {
906906

907907
test_that("Dataset and query print methods", {
908908
ds <- open_dataset(hive_dir)
909+
910+
# See https://github.com/apache/arrow/pull/45685#discussion_r1991143334
911+
dict_index_type <- ifelse(arrow_cpp_version_at_least("20.0.0"), "int8", "int32")
912+
909913
expect_output(
910914
print(ds),
911915
paste(
@@ -915,7 +919,7 @@ test_that("Dataset and query print methods", {
915919
"dbl: double",
916920
"lgl: bool",
917921
"chr: string",
918-
"fct: dictionary<values=string, indices=int8>",
922+
paste("fct: dictionary<values=string, indices=", dict_index_type, ">", sep = ""),
919923
"ts: timestamp[us, tz=UTC]",
920924
"group: int32",
921925
"other: string",

0 commit comments

Comments
 (0)