Uh oh!
There was an error while loading. Please reload this page.
ARROW-13033: [C++] Kernel to localize naive timestamps to a timezone (preserving clock-time) - #10610
ARROW-13033: [C++] Kernel to localize naive timestamps to a timezone (preserving clock-time)#10610rok wants to merge 1 commit into
Conversation
There was a problem hiding this comment.
Given all the discussion on the JIRA issue, can you a bit more clearly state what exactly you implemented and what part it covers?
For example, the current kernel returns int64 and not timestamp with timezone?
It also seems that the implementation is converting system time (UTC epoch) to local (naive) time, and not the other way around as the docstring says.
(also, given all the confusion also on the JIRA, we should probably try to come up with a more explicit/descriptive name ...)
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.
3b14063 to
7fa50a6Comparerok
commented
Jul 2, 2021
Thanks for the review @jorisvandenbossche :).
I think there is no consensus on this yet. |
jorisvandenbossche
commented
Jul 2, 2021
@rok can you explain the rationale of adding a |
rok
commented
Jul 2, 2021
In case we start with "naive" a timestamp we don't know the source and target timezone so both need to be specified. Or am I missing something here? |
jorisvandenbossche
commented
Jul 2, 2021
What's the difference between both timezones? In my mind this is the same time zone? If you want to convert your localized timezone-aware timestamp to another timezone after localizing, you can use another kernel to do that? (a kernel we don't have yet, but one we should also add, although this is a trivial, metadata-only change) |
rok
commented
Jul 2, 2021
I was thinking only of the metadata change not "materialization" of a target timezone. Having another kernel to only change metadata seems redundant. |
jorisvandenbossche
commented
Jul 2, 2021
I don't think that's redundant, as a user will regularly want to change the timezone of a timestamp column that is already localized (already has a timezone). I am of course coming from the point of view of pandas, where those two operations are defined as two distinct methods: tz_localize to convert from "timestamp without timezone" to "timestamp with timezone" (i.e. from naive clock time to tz-aware time) and tz_convert to convert between "timestamp with timezone" with different timezones (a metadata-only change). |
jorisvandenbossche
commented
Jul 2, 2021
(if we keep both source and destination timezone in the "localize" kernel, I think at least the destination timezone, if not specified, should default to be the same as the source timezone, and not "UTC", so that a user doesn't have to specify the timezone they want twice, like |
jorisvandenbossche
commented
Jul 2, 2021
I opened https://issues.apache.org/jira/browse/ARROW-13247 for the discussion whether we want a separate "change timezone" kernel |
I suppose these are two different operations indeed. I've changed this to only do "localization" now. I like
|
adamhooper
commented
Jul 2, 2021
Since the Arrow spec is going to refer to "LocalDateTime", "Instant" and "ZonedDateTime", how about reusing terms from the spec? Something along the lines of |
rok
commented
Jul 2, 2021
It's nice that it's idiomatic if a bit verbose :) Let's add it to the list. If we don't get to consensus here we can always call a vote on the ML.
|
westonpace
commented
Jul 2, 2021
I like all except |
jorisvandenbossche
commented
Jul 6, 2021
@rok I was checking out this PR, and in the process wrote python bindings for the option class to be able to test it in Python, so thought to directly push that here as well. (and at the same time also fixed (I think) the initialization of the timezone, which was causing the C++ tests to fail here as well) And from testing, you will still need to handle the errors raised by |
rok
commented
Jul 6, 2021
Thanks @jorisvandenbossche! The new option initialization was indeed problematic. |
7c1ebb5 to
c5a62a9Comparepitrou
commented
Aug 25, 2021
I'm going to suggest |
rok
commented
Aug 25, 2021
What would be a good way to reach consensus here? A doodle poll to ML to see what people find most intuitive? |
pitrou
commented
Aug 26, 2021
Well, I don't think anything is intuitive here, because the semantics of timestamps in Arrow are slightly weird and surprising :-) You may still ask for opinions on the ML, but I would personally go with |
rok
commented
Aug 26, 2021
You mean timestamps and timezones in general are weird (because the underlying problem is counter intuitive)? If not we should really make this as simple as the underlying complexity is. |
551cb2c to
76ad88fComparerok
commented
Sep 2, 2021
@pitrou I've changed this to Would still be good to hear @jorisvandenbossche@adamhooper@westonpace |
adamhooper
commented
Sep 2, 2021
@rok Thanks for asking! I prefer |
There was a problem hiding this comment.
I don't think this should be here. Is it deliberate or just a leftover?
There was a problem hiding this comment.
I don't really understand what this is for. Presumably this should be unreachable?
There was a problem hiding this comment.
I think it was just to satisfy the compiler.
There was a problem hiding this comment.
Removed the status but kept the return 0 to keep he compiler happy. Please check.
008bf23 to
87ddd31Comparerok
commented
Sep 6, 2021
CI fail seems unrelated. |
Uh oh!
There was an error while loading. Please reload this page.
pitrou
commented
Sep 9, 2021
Ok, I've pushed some minor changes and will merge once CI is green. Thanks a lot for this @rok ! |
rok
commented
Sep 9, 2021
Let me rebase that. |
pitrou
commented
Sep 9, 2021
@rok I'm on it already. |
Work. Removing destination_timezone. fix initialization of timezone + add python bindings Renaming localize to tz_localize. Adding ambiguous and nonexistent handling. Removing R wrapper. Reintroducing R wrapper. Issue with date.h building on rtools4.0. Review feedback. tz_localize -> assume_timezone Review feedback. Changes to nonexistent handling. More changes to nonexistent handling. * Documentation changes * Simplify kernel generation
rok
commented
Sep 9, 2021
…(preserving clock-time) This is to resolve [ARROW-13033](https://issues.apache.org/jira/browse/ARROW-13033). Closesapache#10610 from rok/ARROW-13033 Authored-by: Rok <rok@mihevc.org> Signed-off-by: Antoine Pitrou <antoine@python.org>
This is to resolve ARROW-13033.