[ 
https://issues.apache.org/jira/browse/ARROW-14644?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Andy Teucher updated ARROW-14644:
---------------------------------
    Description: 
When a CSV file starts with byte order mark, {{arrow::open_dataset()}} reads 
the file but populates the first column with {{NA}} values. It appears a 
similar issue was raised and fixed here: 
https://issues.apache.org/jira/browse/ARROW-5413. {{read_csv_arrow()}} deals 
with the BOM correctly.

Reproducible Example:
{code:java}
library(arrow)
library(dplyr)

writeLines('\xef\xbb\xbfa,b\n1,2\n', con = "testfile.csv")

read_csv_arrow("testfile.csv") # works
#> # A tibble: 1 × 2
#> a b
#> <int> <int>
#> 1 1 2

open_dataset("testfile.csv", format = "csv") |> 
  collect()
#> # A tibble: 1 × 2
#> a b
#> <int> <int>
#> 1 NA 2 {code}

  was:
When a CSV file starts with byte order mark, {{arrow::open_dataset()}} reads 
the file but populates the first column with {{NA}} values. It appears a 
similar issue was raised and fixed here. {{read_csv_arrow()}} deals with the 
BOM correctly.

Reproducible Example:
{code:java}
library(arrow)
library(dplyr)

writeLines('\xef\xbb\xbfa,b\n1,2\n', con = "testfile.csv")

read_csv_arrow("testfile.csv") # works
#> # A tibble: 1 × 2
#> a b
#> <int> <int>
#> 1 1 2

open_dataset("testfile.csv", format = "csv") |> 
  collect()
#> # A tibble: 1 × 2
#> a b
#> <int> <int>
#> 1 NA 2 {code}


> [R] open_dataset doesn't ignore BOM in csv file
> -----------------------------------------------
>
>                 Key: ARROW-14644
>                 URL: https://issues.apache.org/jira/browse/ARROW-14644
>             Project: Apache Arrow
>          Issue Type: Bug
>          Components: R
>    Affects Versions: 6.0.0
>         Environment: macOS Mojave, R 4.1.1
>            Reporter: Andy Teucher
>            Priority: Major
>
> When a CSV file starts with byte order mark, {{arrow::open_dataset()}} reads 
> the file but populates the first column with {{NA}} values. It appears a 
> similar issue was raised and fixed here: 
> https://issues.apache.org/jira/browse/ARROW-5413. {{read_csv_arrow()}} deals 
> with the BOM correctly.
> Reproducible Example:
> {code:java}
> library(arrow)
> library(dplyr)
> writeLines('\xef\xbb\xbfa,b\n1,2\n', con = "testfile.csv")
> read_csv_arrow("testfile.csv") # works
> #> # A tibble: 1 × 2
> #> a b
> #> <int> <int>
> #> 1 1 2
> open_dataset("testfile.csv", format = "csv") |> 
>   collect()
> #> # A tibble: 1 × 2
> #> a b
> #> <int> <int>
> #> 1 NA 2 {code}



--
This message was sent by Atlassian Jira
(v8.20.1#820001)

Reply via email to