You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@spark.apache.org by "Miao Wang (JIRA)" <ji...@apache.org> on 2016/10/07 19:10:20 UTC

[jira] [Comment Edited] (SPARK-17811) SparkR cannot parallelize data.frame with NA or NULL in Date columns

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

Miao Wang edited comment on SPARK-17811 at 10/7/16 7:10 PM:
------------------------------------------------------------

> df <- data.frame(Date = as.POSIXlt(as.Date(c(rep("2016-01-10", 10), "NA", "NA"))), id = 1:12)
> re <- createDataFrame(df)
> collect(select(re, "Date"))
                  Date
1  2016-01-09 16:00:00
2  2016-01-09 16:00:00
3  2016-01-09 16:00:00
4  2016-01-09 16:00:00
5  2016-01-09 16:00:00
6  2016-01-09 16:00:00
7  2016-01-09 16:00:00
8  2016-01-09 16:00:00
9  2016-01-09 16:00:00
10 2016-01-09 16:00:00
11 1969-12-31 16:00:00<====== NA in the data.frame
12 1969-12-31 16:00:00<====== NA in the data.frame

It seems that when creating dataframe, it adds default value for POSIXlt type but not Date type if fields are "NA". I trying to find a proper fix.


was (Author: wm624):
> df <- data.frame(Date = as.POSIXlt(as.Date(c(rep("2016-01-10", 10), "NA", "NA"))), id = 1:12)
> re <- createDataFrame(df)
> collect(select(re, "Date"))
                  Date
1  2016-01-09 16:00:00
2  2016-01-09 16:00:00
3  2016-01-09 16:00:00
4  2016-01-09 16:00:00
5  2016-01-09 16:00:00
6  2016-01-09 16:00:00
7  2016-01-09 16:00:00
8  2016-01-09 16:00:00
9  2016-01-09 16:00:00
10 2016-01-09 16:00:00
11 1969-12-31 16:00:00
12 1969-12-31 16:00:00

It seems that when creating dataframe, it adds default value for POSIXlt type but not Date type if fields are "NA". I trying to find a proper fix.

> SparkR cannot parallelize data.frame with NA or NULL in Date columns
> --------------------------------------------------------------------
>
>                 Key: SPARK-17811
>                 URL: https://issues.apache.org/jira/browse/SPARK-17811
>             Project: Spark
>          Issue Type: Bug
>          Components: SparkR
>    Affects Versions: 2.0.1
>            Reporter: Hossein Falaki
>
> To reproduce: 
> {code}
> df <- data.frame(Date = as.Date(c(rep("2016-01-10", 10), "NA", "NA")), id = 1:12)
> dim(createDataFrame(df))
> {code}
> We don't seem to have this problem with POSIXlt 
> {code}
> df <- data.frame(Date = as.POSIXlt(as.Date(c(rep("2016-01-10", 10), "NA", "NA"))), id = 1:12)
> dim(createDataFrame(df))
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

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