dragosmg commented on a change in pull request #12429:
URL: https://github.com/apache/arrow/pull/12429#discussion_r811219485
##########
File path: r/R/dplyr-funcs-datetime.R
##########
@@ -115,6 +115,23 @@ register_bindings_datetime <- function() {
return(Expression$create("strftime", x, options = list(format = format,
locale = locale)))
}
+ if (call_binding("is.integer", x)) {
+ if (inherits(x, "Expression")) {
+ call_binding(
+ "if_else",
+ call_binding_agg("all", call_binding("between", x, 1, 12))$data,
+ x,
+ abort("bla: Values are not in 1:12")
+ )
+ } else {
+ if (all(1 <= x & x <= 12)) {
+ return(x)
+ } else {
+ abort("bla2: Values are not in 1:12")
+ }
+ }
+ }
Review comment:
I have just spent half a day looking at the unit tests for `month()` and
trying to figure out how to solve both `semester()` and `month()` in one go. I
think solving all the outstanding issues with `month` (integer inputs, factor
outputs etc.) is maybe a bit too much to accomplish in this PR. Therefore, I
think the best course of action would be to keep the two issues separate -
solve `semester()` in this PR and then, at a later date, iron any outstanding
aspects of `month()` as part of
[ARROW-15701](https://issues.apache.org/jira/browse/ARROW-15701).
--
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]