Skip to content

Commit

Permalink
Test out adding in filenames
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisnic committed Jul 4, 2022
1 parent 897a4c0 commit 9911ea6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
7 changes: 7 additions & 0 deletions r/R/dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -438,3 +438,10 @@ stop_if_no_datasets <- function() {
stop("This build of the arrow package does not support Datasets", call. = FALSE)
}
}

#' Add filename to the dataset
#'
#' @export
add_filenames <- function(){
Expression$field_ref("__filename")
}
10 changes: 9 additions & 1 deletion r/tests/testthat/test-dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -1015,7 +1015,6 @@ test_that("dataset to C-interface to arrow_dplyr_query with proj/filter", {
delete_arrow_array_stream(stream_ptr)
})


test_that("Filter parquet dataset with is.na ARROW-15312", {
ds_path <- make_temp_dir()

Expand Down Expand Up @@ -1233,3 +1232,12 @@ test_that("FileSystemFactoryOptions input validation", {
fixed = TRUE
)
})

test_that("can add in augmented fields", {
ds <- open_dataset(hive_dir)

ds <- ds %>%
mutate(file_name = add_filenames()) %>%
collect()

})

0 comments on commit 9911ea6

Please sign in to comment.