thisisnic commented on a change in pull request #11432:
URL: https://github.com/apache/arrow/pull/11432#discussion_r732818699
##########
File path: r/tests/testthat/test-csv.R
##########
@@ -266,6 +266,27 @@ test_that("Mix of guessing and declaring types", {
expect_identical(df, tbl[, c("dbl", "false", "chr")])
})
+test_that("more informative error when reading a CSV with headers and schema",
{
+ tf <- tempfile()
+ on.exit(unlink(tf))
+
+ write.csv(example_data, tf, row.names = FALSE)
+
+ share_schema <- schema(
+ int = int32(),
+ dbl = float64(),
+ dbl2 = float64(),
+ lgl = boolean(),
+ false = boolean(),
+ chr = utf8(),
+ fct = utf8()
+ )
+
+ expect_error(
+ read_csv_arrow(tf, schema = share_schema),
+ "header row"
Review comment:
```suggestion
"If you have supplied a schema and your data contains a header row, you
should supply the argument `skip = 1` to prevent the header being read in as
data."
```
--
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]