Skip to content
Open
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
4 changes: 2 additions & 2 deletions r/R/dataset-factory.R
Original file line number Diff line number Diff line change
Expand Up @@ -165,8 +165,8 @@ handle_partitioning <- function(partitioning, path_and_fs, hive_style) {
#' @param format A [FileFormat] object, or a string identifier of the format of
#' the files in `x`. Currently supported values:
#' * "parquet"
#' * "ipc"/"arrow"/"feather", all aliases for each other; for Feather, note that
#' only version 2 files are supported
#' * "ipc"/"arrow" for the Arrow IPC format (also supported as "feather" but
#' this is deprecated)
#' * "csv"/"text", aliases for the same thing (because comma is the default
#' delimiter for text files
#' * "tsv", equivalent to passing `format = "text", delimiter = "\t"`
Expand Down
14 changes: 8 additions & 6 deletions r/R/dataset-format.R
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@
#' `FileFormat$create()` takes the following arguments:
#' * `format`: A string identifier of the file format. Currently supported values:
#' * "parquet"
#' * "ipc"/"arrow"/"feather", all aliases for each other; for Feather, note that
#' only version 2 files are supported
#' * "ipc"/"arrow" for the Arrow IPC format (also supported as "feather" but
#' this is deprecated)
#' * "csv"/"text", aliases for the same thing (because comma is the default
#' delimiter for text files
#' * "tsv", equivalent to passing `format = "text", delimiter = "\t"`
Expand Down Expand Up @@ -86,7 +86,11 @@ FileFormat$create <- function(format, schema = NULL, partitioning = NULL, ...) {
} else if (format == "parquet") {
ParquetFileFormat$create(...)
} else if (format %in% c("ipc", "arrow", "feather")) {
# These are aliases for the same thing
if (format == "feather") {
.Deprecated(
msg = '`format = "feather"` is deprecated; use `format = "ipc"` instead.'
)
}
dataset___IpcFileFormat__Make()
} else if (format == "json") {
JsonFileFormat$create(...)
Expand All @@ -97,9 +101,7 @@ FileFormat$create <- function(format, schema = NULL, partitioning = NULL, ...) {

#' @export
as.character.FileFormat <- function(x, ...) {
out <- x$type
# Slight hack: special case IPC -> feather, otherwise is just the type_name
ifelse(out == "ipc", "feather", out)
x$type
}
Comment thread
thisisnic marked this conversation as resolved.

#' @usage NULL
Expand Down
7 changes: 6 additions & 1 deletion r/R/dataset-write.R
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@
#' hierarchical filesystem. Default is TRUE.
#' @param preserve_order Preserve the order of the rows.
#' @param ... additional format-specific arguments. For available Parquet
#' options, see [write_parquet()]. The available Feather options are:
#' options, see [write_parquet()]. The available IPC options are:
#' - `use_legacy_format` logical: write data formatted so that Arrow libraries
#' versions 0.14 and lower can read it. Default is `FALSE`. You can also
#' enable this by setting the environment variable `ARROW_PRE_0_15_IPC_FORMAT=1`.
Expand Down Expand Up @@ -143,6 +143,11 @@ write_dataset <- function(
...
) {
format <- match.arg(format)
if (format == "feather") {
.Deprecated(
msg = '`format = "feather"` is deprecated; use `format = "ipc"` instead.'
)
}
if (format %in% c("feather", "ipc")) {
format <- "arrow"
}
Expand Down
8 changes: 4 additions & 4 deletions r/R/dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -107,8 +107,8 @@
#' the files in `x`. This argument is ignored when `sources` is a list of `Dataset` objects.
#' Currently supported values:
#' * "parquet"
#' * "ipc"/"arrow"/"feather", all aliases for each other; for Feather, note that
#' only version 2 files are supported
#' * "ipc"/"arrow" for the Arrow IPC format (also supported as "feather" but
#' this is deprecated)
#' * "csv"/"text", aliases for the same thing (because comma is the default
#' delimiter for text files
#' * "tsv", equivalent to passing `format = "text", delimiter = "\t"`
Expand All @@ -119,7 +119,7 @@
#' @param ... additional arguments passed to `dataset_factory()` when `sources`
#' is a directory path/URI or vector of file paths/URIs, otherwise ignored.
#' These may include `format` to indicate the file format, or other
#' format-specific options (see [read_csv_arrow()], [read_parquet()] and [read_feather()] on how to specify these).
#' format-specific options (see [read_csv_arrow()], [read_parquet()] and [read_ipc_file()] on how to specify these).
#' @inheritParams dataset_factory
#' @return A [Dataset] R6 object. Use `dplyr` methods on it to query the data,
#' or call [`$NewScan()`][Scanner] to construct a query directly.
Expand Down Expand Up @@ -481,7 +481,7 @@ FileSystemDataset <- R6Class(
file_type <- self$format$type
pretty_file_type <- list(
parquet = "Parquet",
ipc = "Feather"
ipc = "Arrow IPC"
)[[file_type]]

paste(
Expand Down
8 changes: 4 additions & 4 deletions r/R/extension.R
Original file line number Diff line number Diff line change
Expand Up @@ -485,10 +485,10 @@ VctrsExtensionType <- R6Class(
#' array$type
#' as.vector(array)
#'
#' temp_feather <- tempfile()
#' write_feather(arrow_table(col = array), temp_feather)
#' read_feather(temp_feather)
#' unlink(temp_feather)
#' temp_ipc <- tempfile()
#' write_ipc_file(arrow_table(col = array), temp_ipc)
#' read_ipc_file(temp_ipc)
#' unlink(temp_ipc)
vctrs_extension_array <- function(x, ptype = vctrs::vec_ptype(x), storage_type = NULL) {
if (inherits(x, "ExtensionArray") && inherits(x$type, "VctrsExtensionType")) {
return(x)
Expand Down
Loading
Loading