Commits


Romain Francois authored and Wes McKinney committed fba4f320013
ARROW-3760: [R] Support Arrow CSV reader The main entry point is the `csv_read()` function, all it does is create a `csv::TableReader` with the `csv_table_reader()` generic and then `$Read()` from it. as in the #2947 for feather format, `csv_table_reader` is generic with the methods: - arrow::io::InputStream: calls the TableReader actor with the other options - character and fs_path: depending on the `mmap` option (TRUE by default) it opens the file with `mmap_open()` of `file_open()` and then calls the other method. ``` r library(arrow) tf <- tempfile() readr::write_csv(iris, tf) tab1 <- csv_read(tf) tab1 #> arrow::Table as_tibble(tab1) #> # A tibble: 150 x 5 #> Sepal.Length Sepal.Width Petal.Length Petal.Width Species #> <dbl> <dbl> <dbl> <dbl> <chr> #> 1 5.1 3.5 1.4 0.2 setosa #> 2 4.9 3 1.4 0.2 setosa #> 3 4.7 3.2 1.3 0.2 setosa #> 4 4.6 3.1 1.5 0.2 setosa #> 5 5 3.6 1.4 0.2 setosa #> 6 5.4 3.9 1.7 0.4 setosa #> 7 4.6 3.4 1.4 0.3 setosa #> 8 5 3.4 1.5 0.2 setosa #> 9 4.4 2.9 1.4 0.2 setosa #> 10 4.9 3.1 1.5 0.1 setosa #> # … with 140 more rows ``` <sup>Created on 2018-11-13 by the [reprex package](https://reprex.tidyverse.org) (v0.2.1.9000)</sup> Author: Romain Francois <romain@purrple.cat> Closes #2949 from romainfrancois/ARROW-3760/csv_reader and squashes the following commits: 951e9f58b <Romain Francois> s/csv_read/read_csv_arrow/ 7770ec54c <Romain Francois> not using readr:: at this point bb13a76e0 <Romain Francois> rebase 83b51621a <Romain Francois> s/file_open/ReadableFile/ 959020c91 <Romain Francois> No need to special use mmap for file path method 6e740037d <Romain Francois> going through CharacterVector makes sure this is a character vector 258550143 <Romain Francois> line breaks for readability 0ab839783 <Romain Francois> linting 09187e63b <Romain Francois> Expose arrow::csv::TableReader, functions csv_table_reader() + csv_read()