Uh oh!
There was an error while loading. Please reload this page.
ARROW-13054: [C++] Add option to specify the first day of the week for the "day_of_week" temporal kernel - #10598
ARROW-13054: [C++] Add option to specify the first day of the week for the "day_of_week" temporal kernel#10598rok wants to merge 15 commits into
Conversation
3647567 to
65c3019Comparerok
commented
Jun 24, 2021
Is this missing an option we will need in the near future? Should we remove something. |
Thanks for this! I've taken a look at the
So, yeah, I'm thinking |
Hey @thisisnic! Thanks for the input :).
Is this just an arbitrary month user sets or is there a standard?
I was wondering about locale as well. Would it be a good idea to be able to set an arbitrary locale in some cases? Pandas appears not to offer this option. It would be useful for strftime but could cause misinterpretations for say day_of_week. Added strftime jira. |
thisisnic
commented
Jun 25, 2021
The default value in
Again, I'd like input from others on this (I am not experienced in this and may be missing something!), but my initial thoughts are that if we do choose to extract the day of week and month as integers only (and not implement the
Thanks! |
rok
commented
Jun 25, 2021
Well my thinking is to enable this |
jorisvandenbossche
commented
Jun 25, 2021
Pandas actually has a different method (the one you link is an attribute that has been there for a long time, so but pandas added an additional method so it could have arguments) that takes a locale arguments: https://pandas.pydata.org/docs/reference/api/pandas.Series.dt.day_name.html Personally, I would (at least for now) leave all locale-specific handling to the bindings / downstream applications (except for About the actual options in this PR: that seems like a good start, but I don't think all those options would be needed in a single Options struct? For example, the ambiguous/non-existent handling, those can be put in a specific options struct for the kernel that needs it? |
rok
commented
Jun 25, 2021
Oh, nice to know!
Yeah, leaving locale out of this does seem like the sane option for now.
I'm ok with single Options struct or multiple. |
Those make sense to me. I think there may be other Options structs we might need; for example, ones for kernels that do maths with dates. However, we don't need to know all of these in advance, right? |
Indeed. Even the ones I listed above should be implemented just-in-time with their respective kernels IMO. So I'll only implement |
e0f2ab7 to
3fb529fComparejorisvandenbossche
commented
Jun 28, 2021
@rok you mention this PR now only has |
rok
commented
Jun 28, 2021
@jorisvandenbossche well the beginning of the week could be e.g.:
Alternatively we can have How about |
I'm not sure if this might be a little confusing combining them. Could we perhaps define ourselves which integer maps to which day, and then just have a single parameter, |
rok
commented
Jun 28, 2021
@thisisnic I like |
thisisnic
commented
Jun 28, 2021
@rok Sounds good to me. Let me know if you want me to take a look at the code that will need to be added to fix the R builds which are now failing because you've implemented those options. |
jorisvandenbossche
commented
Jun 29, 2021
@rok it's still unclear to me what the There are two aspects that could be controlled:
ISO starts counting at 1 on Monday, C++ starts counting at 0 on Sunday (but lubridate's Taking a step back: for the "start index", would users ever want something else as 0 or 1 ? (I don't think that counting from 2 to 8 would ever make sense). In addition, going from 0-indexed to 1-indexed is a simple operation (addition +1). On the other hand, the "start day" is more difficult to change afterwards (since you need to wrap around, not a simple +1, but eg 7 needs to become 0). So if we want to add some option, "start day" seems the more useful one to add? |
e102fb0 to
0e0a5a1Comparerok
commented
Jun 30, 2021
Thanks for the input @thisisnic & @jorisvandenbossche! I've refactored this to use |
a359103 to
73c0abbComparerok
commented
Jul 2, 2021
@pitrou ping :) |
pitrou
left a comment
There was a problem hiding this comment.
This is ok to me as far as C++ changes are concerned. There are a couple nits below.
I'll let @jorisvandenbossche validate the rest and then merge when desirable.
There was a problem hiding this comment.
Nit: can you usually pass options as const&.
There was a problem hiding this comment.
This member doesn't seem used anymore?
rok
commented
Jul 5, 2021
Thanks for the review @pitrou! I've implemented the suggestions. |
jorisvandenbossche
left a comment
There was a problem hiding this comment.
Looks good! Just 3 tiny last comments
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Co-authored-by: Benjamin Kietzman <bengilgit@gmail.com>
Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
Co-authored-by: Joris Van den Bossche <jorisvandenbossche@gmail.com>
rok
commented
Jul 6, 2021
@jorisvandenbossche Thanks for the review! I've pushed the suggested changes. |
jorisvandenbossche
commented
Jul 7, 2021
Thanks! |
This is to resolve ARROW-13054.
This will be needed for casting timezone-naive timestamps ARROW-13033 and defining starting day of the week.