[ https://issues.apache.org/jira/browse/ARROW-16421 ]
Antoine Pitrou deleted comment on ARROW-16421:
----------------------------------------
was (Author: pitrou):
For compatibility with GC-based runtimes, I think C++ should follow these rules:
* internal APIs can rely on destructors to free any non-trivial resources such
as file descriptors
* public APIs should strive to explicit close any non-trivial resources as soon
as possible; if not always doable, an explicit close method should be provided
For example, a dataset Scanner's methods should close any file descriptors that
may have been opened by the operation; or, if a file descriptor is long-lived
accross Scanner method calls, there should be a Scanner API to explicit close
all dependent file descriptors.
> [R] Permission error on Windows when deleting file previously accessed with
> open_dataset
> ----------------------------------------------------------------------------------------
>
> Key: ARROW-16421
> URL: https://issues.apache.org/jira/browse/ARROW-16421
> Project: Apache Arrow
> Issue Type: Improvement
> Components: R
> Affects Versions: 7.0.0
> Reporter: Will Jones
> Assignee: Will Jones
> Priority: Major
>
> On Windows this fails:
> {code:R}
> library(arrow)
> write_dataset(iris, "test_dataset")
> # Original example was with DuckDB, but that's not necessarily the issue
> # con <- open_dataset("test_dataset") |> to_duckdb()
> con <- open_dataset("test_dataset")$NewScan()$Finish()$ToRecordBatchReader()
> file.remove("test_dataset/part-0.parquet")
> #> Warning in file.remove("test_dataset/part-0.parquet"): cannot remove file
> #> 'test_dataset/part-0.parquet', reason 'Permission denied'
> #> [1] FALSE
> {code}
> But on MacOS it does not:
> {code:r}
> library(arrow)
> write_dataset(iris, "test_dataset")
> # Original example was with DuckDB, but that's not necessarily the issue
> # con <- open_dataset("test_dataset") |> to_duckdb()
> con <- open_dataset("test_dataset")$NewScan()$Finish()$ToRecordBatchReader()
> file.remove("test_dataset/part-0.parquet")
> #> [1] TRUE
> {code}
--
This message was sent by Atlassian Jira
(v8.20.10#820010)