[ 
https://issues.apache.org/jira/browse/ARROW-6003?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16931757#comment-16931757
 ] 

Neal Richardson commented on ARROW-6003:
----------------------------------------

This is still the behavior in R. Slightly lower-level repro:

{code:r}
library(arrow)
tf <- tempfile()
# `iris` is a built-in dataset
write.table(iris, tf, sep = ",", row.names = FALSE, col.names = FALSE)
reader <- CsvTableReader$create(tf, 
read_options=CsvReadOptions$create(column_names="just one name"))
reader$Read()
## Error in csv___TableReader__Read(self) : Invalid: Empty CSV file
{code}

That function is defined as

{code:cpp}
std::shared_ptr<arrow::Table> csv___TableReader__Read(
    const std::shared_ptr<arrow::csv::TableReader>& table_reader) {
  std::shared_ptr<arrow::Table> table;
  STOP_IF_NOT_OK(table_reader->Read(&table));
  return table;
}
{code}

And {{STOP_IF_NOT_OK}} is

{code:cpp}
#define STOP_IF_NOT(TEST, MSG)    \
  do {                            \
    if (!(TEST)) Rcpp::stop(MSG); \
  } while (0)

#define STOP_IF_NOT_OK(s) STOP_IF_NOT(s.ok(), s.ToString())
{code}

so assuming that your python code is doing essentially the same thing, maybe 
the difference in R is that macro, i.e. the {{s.ToString()}} maybe is not 
including the specific error message?

> [C++] Better input validation and error messaging in CSV reader
> ---------------------------------------------------------------
>
>                 Key: ARROW-6003
>                 URL: https://issues.apache.org/jira/browse/ARROW-6003
>             Project: Apache Arrow
>          Issue Type: Improvement
>          Components: C++
>            Reporter: Neal Richardson
>            Assignee: Neal Richardson
>            Priority: Major
>              Labels: csv
>
> Followup to https://issues.apache.org/jira/browse/ARROW-5747. The error 
> message(s) are not great when you give bad input. For example, if I give too 
> many or too few {{column_names}}, the error I get is {{Invalid: Empty CSV 
> file}}. In fact, that's about the only error message I've seen from the CSV 
> reader, no matter what I've thrown at it.
> It would be better if error messages were more specific so that I as a user 
> might know how to fix my bad input.



--
This message was sent by Atlassian Jira
(v8.3.2#803003)

Reply via email to