Skip to content

Commit

Permalink
Remove read_csv_arrow parameters which are not implemented for datase…
Browse files Browse the repository at this point in the history
…ts, and add docs
  • Loading branch information
thisisnic committed Jan 11, 2023
1 parent ca6eff1 commit fc4cc30
Show file tree
Hide file tree
Showing 3 changed files with 148 additions and 26 deletions.
1 change: 1 addition & 0 deletions r/NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -348,6 +348,7 @@ export(new_extension_type)
export(null)
export(num_range)
export(one_of)
export(open_csv_dataset)
export(open_dataset)
export(read_csv_arrow)
export(read_delim_arrow)
Expand Down
34 changes: 8 additions & 26 deletions r/R/dataset.R
Original file line number Diff line number Diff line change
Expand Up @@ -228,6 +228,14 @@ open_dataset <- function(sources,
)
}

#' Open a multi-file dataset of CSVs
#'
#' A wrapper around [open_dataset] which explicitly includes parameters specific to reading CSV files
#'
#' @inheritParams open_dataset
#' @inheritParams read_csv_arrow
#'
#' @export
open_csv_dataset <- function(sources,
schema = NULL,
partitioning = hive_partition(),
Expand All @@ -240,33 +248,11 @@ open_csv_dataset <- function(sources,
escape_backslash = FALSE,
col_names = TRUE,
col_types = NULL,
col_select = NULL,
na = NULL,
quoted_na = NULL,
skip_empty_rows = TRUE,
skip = 0L,
parse_options = NULL,
convert_options = NULL,
read_options = NULL,
as_data_frame = TRUE,
timestamp_parsers = NULL) {
browser()
if (!is.null(col_select)) {
abort('The following options are supported in "read_delim_arrow" functions but not yet supported here: "col_select"')
}

if (!is.null(na)) {
abort('The following options are supported in "read_delim_arrow" functions but not yet supported here: "na"')
}

if (!is.null(quoted_na)) {
abort('The following options are supported in "read_delim_arrow" functions but not yet supported here: "quoted_na"')
}

if (!is.null(parse_options)) {
abort('The following options are supported in "read_delim_arrow" functions but not yet supported here: "parse_options"')
}

ds <- open_dataset(
sources = source, schema = schema, partitioning = partitioning, hive_style = hive_style,
unify_schemas = unify_schemas, format = "csv", quote = quote, escape_double = escape_double,
Expand All @@ -275,10 +261,6 @@ browser()
read_options = read_options, timestamp_parsers = timestamp_parsers
)

if (as_data_frame) {
return(as.data.frame(ds))
}

ds
}

Expand Down
139 changes: 139 additions & 0 deletions r/man/open_csv_dataset.Rd

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

0 comments on commit fc4cc30

Please sign in to comment.