Uh oh!
There was an error while loading. Please reload this page.
ARROW-13561: [C++] Implement week kernel that accepts WeekOptions - #11026
ARROW-13561: [C++] Implement week kernel that accepts WeekOptions#11026rok wants to merge 11 commits into
Conversation
Shall we also change |
f8d1e4c to
6997246Compare33b27e7 to
4a1b8a7Compare
lidavidm
left a comment
There was a problem hiding this comment.
So essentially, ISOWeek starts from 1, Week starts from 0, and neither use DayOfWeekOptions.week_start? In that case I would just make them two optionless kernels.
rok
commented
Aug 30, 2021
To get parity with MySQL |
lidavidm
commented
Aug 30, 2021
Ah, ok. But unless I'm mistaken, week_start is not actually used by the week kernel. |
rok
commented
Aug 30, 2021
I'm just trying to understand if it does :) |
rok
commented
Aug 30, 2021
This evaluates to true in MySQL on sqlfiddle: SELECT WEEK('2008-1-6', 1) != WEEK('2008-1-6', 4)
|
18a2b49 to
69eed89CompareUh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Given ISOWeek is a special case of Week now, maybe we should just have one kernel (and perhaps some conveniences, e.g. DayOfWeekOptions::IsoWeek())?
There was a problem hiding this comment.
Oh yeah, that's a nice idea.
I'm still trying to exactly match WEEK from MySQL and once I do I'll look into this. Sorry for the WIP.
There was a problem hiding this comment.
Oh, no worries. I can hold off looking at this until you're ready.
There was a problem hiding this comment.
Early feedback is great though! :)
There was a problem hiding this comment.
Ping on this? Since it seems the two kernels are very similar.
@ianmcook This now covers MySQL WEEK modes 1, 3, 4 and 6 (week 1 is the first week with 4 or more days this year). Another thing to note here is that |
rok
commented
Sep 1, 2021
Perhaps |
lidavidm
commented
Sep 1, 2021
If the option doesn't apply to DayOfWeek, maybe it should be a separate WeekOptions in that case. |
rok
commented
Sep 1, 2021
So then we now have: We would need to add three binary parameters to match the 8 modes of MySQL:
|
I tried adding I've also added tests with all the MySQL modes. Docs and the logic need some more work, but first: do we go this way or stick to iso week only? |
ef87424 to
062e5f2Comparerok
commented
Sep 23, 2021
rok
commented
Sep 23, 2021
I suppose we then need ISOWeek and USWeek declared with options in the API. |
lidavidm
commented
Sep 23, 2021
Yeah, we'd need a case here: Line 129 in 075c6c6 |
rok
commented
Sep 23, 2021
lidavidm
left a comment
There was a problem hiding this comment.
Some nits on style/wording.
If you're up to add R tests, I think that would be appreciated, but otherwise we can put that in a follow-up JIRA (since there might be other work to bind the new kernels to dplyr features or whatnot).
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Similarly here, can we put comments for the parameter literals? Or actually, it might be nice to define WeekOptions::IsoDefaults and WeekOptions::UsDefaults which could then be used here and in the R bindings.
There was a problem hiding this comment.
Added WeekOptions::ISODefaults and WeekOptions::USDefaults.
There was a problem hiding this comment.
It appears to be missing its counterpart in api_scalar.cc.
Uh oh!
There was an error while loading. Please reload this page.
1d4a49c to
4f68c1cComparerok
commented
Sep 23, 2021
Thanks for the review @lidavidm ! :) |
Co-authored-by: Ian Cook <ianmcook@gmail.com>
Co-authored-by: Ian Cook <ianmcook@gmail.com>
Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Co-authored-by: David Li <li.davidm96@gmail.com>
rok
commented
Sep 27, 2021
This is to resolve [ARROW-13561](https://issues.apache.org/jira/browse/ARROW-13561`). Closesapache#11026 from rok/ARROW-13561 Lead-authored-by: Rok <rok@mihevc.org> Co-authored-by: Rok Mihevc <rok@mihevc.org> Co-authored-by: Antoine Pitrou <antoine@python.org> Signed-off-by: Antoine Pitrou <antoine@python.org>
This is to resolve ARROW-13561.