-
Notifications
You must be signed in to change notification settings - Fork 4k
ARROW-14821: [C++] Add ceil_is_strictly_greater and calendar_based_origin temporal round options (to mimic lubridate's date rounding) #12657
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
|
|
|
@djnavarro this is almost ready for review. |
b25de93 to
f65728c
Compare
ba00ddb to
92ad204
Compare
|
@djnavarro do you think this will cover requirements on R side? @pitrou @jorisvandenbossche could you please review the changes here? The R style rounding demanded some more logic and maybe something I'm missing something that can be simplified. |
|
ping :) |
pitrou
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.
Congrats for working on this @rok. Here are some comments.
cpp/src/arrow/compute/api_scalar.h
Outdated
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.
Since this is only for ceil, perhaps rename it strict_ceil or something similar? @jorisvandenbossche what do you think?
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.
Switched to strict_ceil. Would still be interesting to hear from @jorisvandenbossche
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.
@jorisvandenbossche ping :)
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.
Do we know if "strict ceil" is a typical term for this behaviour?
(it could also be "ceil_on_boundary" to make it more explicit about "ceil")
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.
Switched to ceil_on_boundary. @pitrou do you think that'll work?
657b3d7 to
3ae71e7
Compare
|
@pitrou Could you please do another pass here? |
pitrou
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.
I don't have much to add, see below.
6a919a8 to
d5bc076
Compare
|
@pitrou Added suggested comments. |
pitrou
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.
Thanks! I'll let @jorisvandenbossche do the final review.
d5bc076 to
18a0fdc
Compare
|
CI issues seem unrelated. |
|
@jorisvandenbossche this would unblock #12154 which would be great to have for the release :). |
Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Co-authored-by: Antoine Pitrou <pitrou@free.fr>
Co-authored-by: Antoine Pitrou <pitrou@free.fr>
Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
I think we're ok with
Lubridate actually limits to time multiples smaller or equal than the greater time unit - e.g. "61min" is not a valid rounding, but "60min" is. Your proposal makes things safer but we might want to "deregulate" it later. Leaving things as is gives more options but we might need to limit them later. Dunno, I don't have an opinion on this. |
8c2d6ad to
422b022
Compare
|
@jorisvandenbossche added an example to doc to present the issue with |
|
@pitrou do you think this is ready to merge? |
Co-authored-by: Antoine Pitrou <pitrou@free.fr>
|
TBH, I'm starting to think that calendar-based rounding is sufficiently different that we might define separate functions for it (e.g. "ceil_calendar" as opposed to "ceil_temporal"). We might also not bother refactoring this again :-) |
|
Thanks for the review, added the changes.
I had that thought yesterday too. Now that tests are worked out it wouldn't be too much work I feel. Perhaps after #12528 is in :). |
|
@pitrou or are you saying we should refactor now? :) |
|
@rok As you prefer. We can merge this as is if you want. |
|
@pitrou i would prefer merging this and then discuss/do the refactor separately. |
|
Ok, let's do it. |
|
Thank you for the reviews and feedback @pitrou & @jorisvandenbossche ! |
This implements
RoundTemporalOptions.ceil_is_strictly_greaterandRoundTemporalOptions.calendar_based_originparameters in C++ to enable temporal rounding in R (ARROW-14821).