jonkeane commented on a change in pull request #12357:
URL: https://github.com/apache/arrow/pull/12357#discussion_r808332580
##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -147,5 +147,16 @@ register_bindings_datetime <- function() {
register_binding("pm", function(x) {
!call_binding("am", x)
})
+ register_binding("tz", function(x) {
+ if (!call_binding("is.POSIXct", x)) {
+ if (inherits(x, "Expression")) {
+ class <- x$type()$ToString()
+ } else {
+ class <- type(x)
+ }
+ abort(paste0("timezone extraction for objects of class `", class, "` not
supported in Arrow"))
+ }
Review comment:
Oh also I shuffled around the `if` clause so that we error earlier in
the body and then have a standard return if `x` gets through all the
validation. This is functionally the same as what we had before, but I find
matches the style of others a bit more (and IMO if we can avoid an early return
in a function, it's good to)
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]