thisisnic commented on a change in pull request #11346:
URL: https://github.com/apache/arrow/pull/11346#discussion_r726016794
##########
File path: r/R/dataset.R
##########
@@ -157,7 +158,27 @@ open_dataset <- function(sources,
return(dataset___UnionDataset__create(sources, schema))
}
- factory <- DatasetFactory$create(sources, partitioning = partitioning,
format = format, ...)
+ is_csv_format <- function(format) {
+ length(format) == 1 && "CsvFileFormat" %in% class(format) ||
is_string(format, string = "csv")
+ }
+
+ if (is_csv_format(format) && !is.null(schema)) {
+ factory <- DatasetFactory$create(
+ sources,
+ partitioning = partitioning,
+ format = format,
+ ...,
+ read_options = CsvReadOptions$create(column_names = names(schema))
+ )
+ } else {
+ factory <- DatasetFactory$create(
+ sources,
+ partitioning = partitioning,
+ format = format,
+ ...
+ )
+ }
+
Review comment:
Having a go at that, but a bit stuck as it's causing problems later
where `NULL` is passed into `csv_file_format_parse_options()` later. Will try
to map out what's happening
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]