-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-19342][SPARKR] bug fixed in collect method for collecting timestamp column #16689
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 7 commits
a51c2eb
5829ddd
6a0eb3f
09d4dfb
43e334a
7903bb3
8379c38
407c625
d6d454e
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -1138,6 +1138,11 @@ setMethod("collect", | |
| if (!is.null(PRIMITIVE_TYPES[[colType]]) && colType != "binary") { | ||
| vec <- do.call(c, col) | ||
| stopifnot(class(vec) != "list") | ||
| class(vec) <- | ||
| if (colType == "timestamp") | ||
| c("POSIXct", "POSIXt") | ||
| else | ||
| PRIMITIVE_TYPES[[colType]] | ||
|
||
| df[[colIndex]] <- vec | ||
| } else { | ||
| df[[colIndex]] <- col | ||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why should the class be
c("POSIXct", "POSIXt")in this case?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Because
PRIMITIVE_TYPES[["timestamp"]]is POSIXct, it usually comes with POSIXt together. POSIXt is virtual class used to allow operations such as subtraction to mix the two classes POSIXct and POSIXlt.The previous convertion will also convert timestamp to c("POSIXct", "POSIXt").
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should
PRIMITIVE_TYPES[["timestamp"]]be changed thenhttps://github.com/apache/spark/blob/master/R/pkg/R/types.R#L32
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It looks better if it won't affect other methods. I will try it. Thanks for the advice.