Uh oh!
There was an error while loading. Please reload this page.
ARROW-15701 [R] month() should allow integer inputs - #12482
Conversation
2965c21 to
c6daf89CompareThere was a problem hiding this comment.
This is a cheeky implementation, but it works. 😄
There was a problem hiding this comment.
We could actually short-circuit here and return the expression with simply if_else when label = FALSE, since that will return an integer itself, yeah?
I agree that this is a little bit unorthodox, but I think it works. An alternative would be to put this value into a date string with a call to the paste binding and then doing strptime on that. Both aren't super ideal — but I suspect that this integer multiplication is going to be more performant (though if we are basing a decision on that, we probably should measure it!).
There was a problem hiding this comment.
I haven't done any benchmarking yet.
3273d94 to
ce79b61Compare
jonkeane
left a comment
There was a problem hiding this comment.
This is looking good — a few comments about the structure of the function body.
Also, there's at least one call to Expression$create() that probably could be build_expr(), what do you think?
There was a problem hiding this comment.
We could actually short-circuit here and return the expression with simply if_else when label = FALSE, since that will return an integer itself, yeah?
I agree that this is a little bit unorthodox, but I think it works. An alternative would be to put this value into a date string with a call to the paste binding and then doing strptime on that. Both aren't super ideal — but I suspect that this integer multiplication is going to be more performant (though if we are basing a decision on that, we probably should measure it!).
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
jonkeane
left a comment
There was a problem hiding this comment.
Two very minor, more stylistic nit-picky comments that you can take or leave
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
…er is outside the 1:12 range
71e9f4e to
75e8b0aCompareUh oh!
There was an error while loading. Please reload this page.
Benchmark runs are scheduled for baseline = a76794c and contender = 1b77e6d. 1b77e6d is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
Once this PR is merge the {arrow} binding for
month()will be able to accept integer inputs. This also impact thesemester()which now will be able to extract semesters from integer inputs.Created on 2022-03-02 by the reprex package (v2.0.1)