Skip to content
Closed
Show file tree
Hide file tree
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
2 changes: 2 additions & 0 deletions r/NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@
## Minor improvements and fixes

- Added bindings for atan, sinh, cosh, tanh, asinh, acosh, and tanh, and expm1 (#44953)
- Expose an option `check_directory_existence_before_creation` in `S3FileSystem`
to reduce I/O calls on cloud storage (@HaochengLIU, #41998)

# arrow 20.0.0

Expand Down
4 changes: 2 additions & 2 deletions r/R/arrowExports.R

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion r/R/filesystem.R
Original file line number Diff line number Diff line change
Expand Up @@ -156,6 +156,10 @@ FileSelector$create <- function(base_dir, allow_not_found = FALSE, recursive = F
#' buckets if `$CreateDir()` is called on the bucket level (default `FALSE`).
#' - `allow_bucket_deletion`: logical, if TRUE, the filesystem will delete
#' buckets if`$DeleteDir()` is called on the bucket level (default `FALSE`).
#' - `check_directory_existence_before_creation`: logical, check if directory
#' already exists or not before creation. Helpful for cloud storage operations
#' where object mutation operations are rate limited or existing directories
#' are read-only. (default `FALSE`).
#' - `request_timeout`: Socket read time on Windows and macOS in seconds. If
#' negative, the AWS SDK default (typically 3 seconds).
#' - `connect_timeout`: Socket connection timeout in seconds. If negative, AWS
Expand Down Expand Up @@ -411,7 +415,8 @@ S3FileSystem$create <- function(anonymous = FALSE, ...) {
invalid_args <- intersect(
c(
"access_key", "secret_key", "session_token", "role_arn", "session_name",
"external_id", "load_frequency", "allow_bucket_creation", "allow_bucket_deletion"
"external_id", "load_frequency", "allow_bucket_creation", "allow_bucket_deletion",
"check_directory_existence_before_creation"
),
names(args)
)
Expand Down Expand Up @@ -459,6 +464,7 @@ default_s3_options <- list(
background_writes = TRUE,
allow_bucket_creation = FALSE,
allow_bucket_deletion = FALSE,
check_directory_existence_before_creation = FALSE,
connect_timeout = -1,
request_timeout = -1
)
Expand Down
4 changes: 4 additions & 0 deletions r/man/FileSystem.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 5 additions & 4 deletions r/src/arrowExports.cpp

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 4 additions & 1 deletion r/src/filesystem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -289,7 +289,8 @@ std::shared_ptr<fs::S3FileSystem> fs___S3FileSystem__create(
std::string region = "", std::string endpoint_override = "", std::string scheme = "",
std::string proxy_options = "", bool background_writes = true,
bool allow_bucket_creation = false, bool allow_bucket_deletion = false,
double connect_timeout = -1, double request_timeout = -1) {
bool check_directory_existence_before_creation = false, double connect_timeout = -1,
double request_timeout = -1) {
// We need to ensure that S3 is initialized before we start messing with the
// options
StopIfNotOk(fs::EnsureS3Initialized());
Expand Down Expand Up @@ -330,6 +331,8 @@ std::shared_ptr<fs::S3FileSystem> fs___S3FileSystem__create(

s3_opts.allow_bucket_creation = allow_bucket_creation;
s3_opts.allow_bucket_deletion = allow_bucket_deletion;
s3_opts.check_directory_existence_before_creation =
check_directory_existence_before_creation;

s3_opts.request_timeout = request_timeout;
s3_opts.connect_timeout = connect_timeout;
Expand Down
6 changes: 4 additions & 2 deletions r/tests/testthat/test-s3-minio.R
Original file line number Diff line number Diff line change
Expand Up @@ -46,15 +46,17 @@ fs <- S3FileSystem$create(
scheme = "http",
endpoint_override = paste0("localhost:", minio_port),
allow_bucket_creation = TRUE,
allow_bucket_deletion = TRUE
allow_bucket_deletion = TRUE,
check_directory_existence_before_creation = TRUE,
)
limited_fs <- S3FileSystem$create(
access_key = minio_key,
secret_key = minio_secret,
scheme = "http",
endpoint_override = paste0("localhost:", minio_port),
allow_bucket_creation = FALSE,
allow_bucket_deletion = FALSE
allow_bucket_deletion = FALSE,
check_directory_existence_before_creation = FALSE,
)
now <- as.character(as.numeric(Sys.time()))
fs$CreateDir(now)
Expand Down
2 changes: 1 addition & 1 deletion r/vignettes/fs.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ Also note that parameters in the URI need to be

For S3, only the following options can be included in the URI as query parameters
are `region`, `scheme`, `endpoint_override`, `access_key`, `secret_key`, `allow_bucket_creation`,
and `allow_bucket_deletion`. For GCS, the supported parameters are `scheme`, `endpoint_override`,
`allow_bucket_deletion` and `check_directory_existence_before_creation`. For GCS, the supported parameters are `scheme`, `endpoint_override`,
and `retry_limit_seconds`.

In GCS, a useful option is `retry_limit_seconds`, which sets the number of seconds
Expand Down
Loading