Skip to content

Commit a900852

Browse files
committed
Merge branch 'staging' into website
2 parents b735c0e + a2b6a73 commit a900852

File tree

3 files changed

+14
-8
lines changed

3 files changed

+14
-8
lines changed

R/file_read.R

+6-3
Original file line numberDiff line numberDiff line change
@@ -82,6 +82,8 @@ dir_manifest <- function(
8282
#' @param sep grep term to match as column delimiters within the file
8383
#' @param values_to_match values in \code{col} to match given as a vector
8484
#' @param drop Vector of column names or numbers to drop, keep the rest.
85+
#' @param schema_detect_nrow numeric. how many rows to sample to guess the
86+
#' arrow schema to use.
8587
#' @param verbose be verbose
8688
#' @param ... additional parameters to pass to [arrow::open_delim_dataset()]
8789
#' @keywords internal
@@ -103,6 +105,7 @@ read_colmatch <- function(file,
103105
sep = NULL,
104106
values_to_match,
105107
drop = NULL,
108+
schema_detect_nrow = 1000,
106109
verbose = FALSE,
107110
...) {
108111
# check dependencies
@@ -123,8 +126,8 @@ read_colmatch <- function(file,
123126
}
124127
}
125128

126-
a <- arrow::open_delim_dataset(file,
127-
schema = .arrow_infer_schema(file),
129+
a <- arrow::read_delim_arrow(file,
130+
schema = .arrow_infer_schema(file, n_rows = schema_detect_nrow),
128131
skip = 1L,
129132
delim = sep,
130133
...
@@ -231,7 +234,7 @@ fread_colmatch <- function(...) {
231234
}
232235

233236
# Use data.table to get a sample and infer schema
234-
.arrow_infer_schema <- function(file, n_rows = 10) {
237+
.arrow_infer_schema <- function(file, n_rows = 1000) {
235238
lines <- readLines(file, n = n_rows)
236239
# Parse with fread as string input
237240
sample_dt <- data.table::fread(paste(lines, collapse = "\n"))

man/py_active_env.Rd

+4-5
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/read_colmatch.Rd

+4
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)