Skip to content

Commit 99d1304

Browse files
committed
Revert "GH-35806: [R] Improve error message for null type inference with sparse CSV data"
This reverts commit c20a04a.
1 parent c20a04a commit 99d1304

File tree

2 files changed

+0
-33
lines changed

2 files changed

+0
-33
lines changed

r/R/util.R

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -196,21 +196,6 @@ repeat_value_as_array <- function(object, n) {
196196
}
197197

198198
handle_csv_read_error <- function(msg, call, schema) {
199-
# Handle null type inference issue with sparse data
200-
if (grepl("conversion error to null", msg)) {
201-
msg <- c(
202-
msg,
203-
i = paste(
204-
"Column type was inferred as null because the first block of data",
205-
"(default 1MB, set via `block_size` in read options) contained only",
206-
"missing values. Try specifying the column types explicitly using the",
207-
"`col_types` or `schema` argument."
208-
)
209-
)
210-
abort(msg, call = call)
211-
}
212-
213-
# Handle schema + header row issue
214199
if (grepl("conversion error", msg) && inherits(schema, "Schema")) {
215200
msg <- c(
216201
msg,

r/tests/testthat/test-dataset-csv.R

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -711,21 +711,3 @@ test_that("open_dataset() with `decimal_point` argument", {
711711
tibble(x = 1.2, y = "c")
712712
)
713713
})
714-
715-
716-
test_that("more informative error when column inferred as null due to sparse data (GH-35806)", {
717-
tf <- tempfile()
718-
on.exit(unlink(tf))
719-
720-
# Create a CSV where the second column has NAs in the first rows
721-
# but a value later - this causes Arrow to infer null type
722-
writeLines(c("x,y", paste0(1:100, ",")), tf)
723-
write("101,foo", tf, append = TRUE)
724-
725-
# Use small block_size to force type inference from only the first rows
726-
expect_error(
727-
open_dataset(tf, format = "csv", read_options = csv_read_options(block_size = 100L)) |>
728-
collect(),
729-
"inferred as null"
730-
)
731-
})

0 commit comments

Comments
 (0)