Uploaded image for project: 'Apache Arrow'
  1. Apache Arrow
  2. ARROW-17429

[R] Error messages are not helpful of read_csv_arrow with col_types option

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Resolved
    • Major
    • Resolution: Fixed
    • None
    • None
    • R

    Description

      The error message displayed when a non-convertible type is specified does not seem to help in the development version.

      tbl <- tibble::tibble(time = c("1970-01-01T12:00:00+12:00"))
      csv_file <- tempfile()
      on.exit(unlink(csv_file))
      write.csv(tbl, csv_file, row.names = FALSE)
      
      arrow::read_csv_arrow(csv_file, col_types = "?", col_names = "x", skip = 1)
      #> # A tibble: 1 × 1
      #>   x
      #>   <dttm>
      #> 1 1970-01-01 00:00:00
      arrow::read_csv_arrow(csv_file, col_types = "c", col_names = "x", skip = 1)
      #> # A tibble: 1 × 1
      #>   x
      #>   <chr>
      #> 1 1970-01-01T12:00:00+12:00
      arrow::read_csv_arrow(csv_file, col_types = "i", col_names = "x", skip = 1)
      #> Error in as.data.frame(tab): object 'tab' not found
      arrow::read_csv_arrow(csv_file, col_types = "T", col_names = "x", skip = 1)
      #> Error in as.data.frame(tab): object 'tab' not found
      

      In arrow 9.0.0

      tbl <- tibble::tibble(time = c("1970-01-01T12:00:00+12:00"))
      csv_file <- tempfile()
      on.exit(unlink(csv_file))
      write.csv(tbl, csv_file, row.names = FALSE)
      
      arrow::read_csv_arrow(csv_file, col_types = "?", col_names = "x", skip = 1)
      #> # A tibble: 1 × 1
      #>   x
      #>   <dttm>
      #> 1 1970-01-01 00:00:00
      arrow::read_csv_arrow(csv_file, col_types = "c", col_names = "x", skip = 1)
      #> # A tibble: 1 × 1
      #>   x
      #>   <chr>
      #> 1 1970-01-01T12:00:00+12:00
      arrow::read_csv_arrow(csv_file, col_types = "i", col_names = "x", skip = 1)
      #> Error:
      #> ! Invalid: In CSV column #0: CSV conversion error to int32: invalid value '1970-01-01T12:00:00+12:00'
      arrow::read_csv_arrow(csv_file, col_types = "T", col_names = "x", skip = 1)
      #> Error:
      #> ! Invalid: In CSV column #0: CSV conversion error to timestamp[ns]: expected no zone offset in '1970-01-01T12:00:00+12:00'
      

      Attachments

        Issue Links

          Activity

            People

              eitsupi SHIMA Tatsuya
              eitsupi SHIMA Tatsuya
              Votes:
              1 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Time Tracking

                  Estimated:
                  Original Estimate - Not Specified
                  Not Specified
                  Remaining:
                  Remaining Estimate - 0h
                  0h
                  Logged:
                  Time Spent - 50m
                  50m