[
https://issues.apache.org/jira/browse/ARROW-7825?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=17033904#comment-17033904
]
Keith Hughitt commented on ARROW-7825:
--------------------------------------
[~npr] Indeed read_feather and read_parquet both ignore `stringsAsFactors` when
loading character columns, always preserving the proper character type.
I agree that this is the expected and desired behavior. I can close both this
and the related "read_feather()" issue I reported.
Do you think it's worth including a note in the docs for the methods to caution
users who aren't familiar with parquet/feather's handling of column types?
It's true that most users should already have some experience with this with
`readRDS`, however, I still suspect that other users will see the similarity of
`read_feather`, `read_parquet`, `read_tsv`, etc., and not appreciate the
differences between the methods.
Your call though. Either way, I appreciate you taking the time to respond and
clarify the important differences between the methods.
> Have arrow::read_parquet respect options(stringsAsFactors = FALSE)
> ------------------------------------------------------------------
>
> Key: ARROW-7825
> URL: https://issues.apache.org/jira/browse/ARROW-7825
> Project: Apache Arrow
> Issue Type: Improvement
> Components: R
> Affects Versions: 0.16.0
> Environment: Linux 64-bit 5.4.15
> Reporter: Keith Hughitt
> Priority: Major
> Labels: R, parquet
>
> Same issue as reported for feather::read_feather
> (https://issues.apache.org/jira/browse/ARROW-7823);
>
> For the R arrow package, the "read_parquet()" function currently does not
> respect "options(stringsAsFactors = FALSE)", leading to
> unexpected/inconsistent behavior.
>
> *Example:*
>
>
> {code:java}
> library(arrow)
> library(readr)
> options(stringsAsFactors = FALSE)
> write_tsv(head(iris), 'test.tsv')
> write_parquet(head(iris), 'test.parquet')
> head(read.delim('test.tsv', sep='\t')$Species)
> # [1] "setosa" "setosa" "setosa" "setosa" "setosa" "setosa"
> head(read_tsv('test.tsv', col_types = cols())$Species)
> # [1] "setosa" "setosa" "setosa" "setosa" "setosa" "setosa"
> head(read_parquet('test.parquet')$Species)
> # [1] setosa setosa setosa setosa setosa setosa
> # Levels: setosa versicolor virginica
> {code}
>
>
> *Versions:*
> - R 3.6.2
> - arrow_0.15.1.9000
--
This message was sent by Atlassian Jira
(v8.3.4#803005)