-
Notifications
You must be signed in to change notification settings - Fork 29k
[SPARK-20892][SparkR] Add SQL trunc function to SparkR #18291
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
Conversation
|
@felixcheung @zero323 |
|
Test build #77997 has started for PR 18291 at commit |
|
jenkins, retest this please |
|
Test build #78020 has finished for PR 18291 at commit
|
felixcheung
left a comment
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.
minor comment, LGTM otherwise
| "to_utc_timestamp", | ||
| "translate", | ||
| "trim", | ||
| "trunc", |
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 doesn't mask base::trunc?
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.
and looks like it has a generic already?
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 is part of the internally S4 methods and there is already generics.
This is similar to math functions like abs.
https://stat.ethz.ch/R-manual/R-devel/library/base/html/groupGeneric.html
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.
And yes, it doesn't mask base. You can still do trunc(10.5).
R/pkg/R/functions.R
Outdated
| setMethod("trunc", | ||
| signature(x = "Column"), | ||
| function(x, format) { | ||
| jc <- callJStatic("org.apache.spark.sql.functions", "trunc", x@jc, format) |
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.
I'd as.character(format) here
|
Added your suggested change. Thanks! |
|
Test build #78115 has finished for PR 18291 at commit
|
|
@felixcheung Anything else needed for this PR? |
|
merged to master. |
What changes were proposed in this pull request?
Add SQL trunc function
How was this patch tested?
standard test