Skip to content

Commit

Permalink
Merge branch '234-write-arrow' of https://github.com/jmbarbone/mark i…
Browse files Browse the repository at this point in the history
…nto 234-write-arrow
  • Loading branch information
jmbarbone committed Jun 15, 2024
2 parents 3c12df2 + 524a8c8 commit 2fae5ba
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
* text eol=lf

7 changes: 7 additions & 0 deletions R/write.R
Original file line number Diff line number Diff line change
Expand Up @@ -394,10 +394,12 @@ mark_write_arrow <- function(
feather = {
read <- arrow::read_feather
write <- arrow::write_feather
clean <- function() NULL
},
parquet = {
read <- arrow::read_parquet
write <- arrow::write_parquet
clean <- base::gc
}
)

Expand All @@ -406,9 +408,14 @@ mark_write_arrow <- function(
con <- file(temp, open = "wb", encoding = "UTF-8")
on.exit({
co <- utils::capture.output(read(temp, as_data_frame = FALSE))
# Something weird was happening after reading the parquet object on
# windows; fs::file_delete() was throwing an EPERM error but file.remove()
# wasn't. Adding an explicit gc() seems to do the trick...
clean()
co <- grep("See $metadata", co, value = TRUE, invert = TRUE, fixed = TRUE)
co <- co[nzchar(co)]
writeLines(co)
safe_close(con)
safe_fs_delete(temp)
})
}
Expand Down

0 comments on commit 2fae5ba

Please sign in to comment.