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

Hossein Falaki commented on SPARK-17902:
----------------------------------------

A simple unit test we could add would be:

{code}
> df <- createDataFrame(iris)
> sapply(iris, typeof) == sapply(collect(df, stringsAsFactors = T), typeof)
Sepal.Length  Sepal.Width Petal.Length  Petal.Width      Species
        TRUE         TRUE         TRUE         TRUE        FALSE
{code}

As for the solution, I suggest performing the conversion inside [this 
loop|https://github.com/apache/spark/blob/master/R/pkg/R/DataFrame.R#L1168].

> collect() ignores stringsAsFactors
> ----------------------------------
>
>                 Key: SPARK-17902
>                 URL: https://issues.apache.org/jira/browse/SPARK-17902
>             Project: Spark
>          Issue Type: Bug
>          Components: SparkR
>    Affects Versions: 2.0.1
>            Reporter: Hossein Falaki
>
> `collect()` function signature includes an optional flag named 
> `stringsAsFactors`. It seems it is completely ignored.
> {code}
> str(collect(createDataFrame(iris), stringsAsFactors = TRUE)))
> {code}



--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscr...@spark.apache.org
For additional commands, e-mail: issues-h...@spark.apache.org

Reply via email to