-
Notifications
You must be signed in to change notification settings - Fork 4k
GH-33143: [C++] Kernel to convert timestamp with timezone to wall time #34208
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
cdcb8c6 to
4a3bded
Compare
4a3bded to
a5185a2
Compare
westonpace
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, as always, for your diligence here.
docs/source/cpp/compute.rst
Outdated
| +--------------------+------------+-------------------+---------------+----------------------------+-------+ | ||
| | is_leap_year | Unary | Timestamp, Date | Boolean | | | | ||
| +--------------------+------------+-------------------+---------------+----------------------------+-------+ | ||
| | local_time | Unary | Timestamp | Timestamp | | | |
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.
Can we add a note? I don't think it will be obvious what this function does.
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.
Good point. Added some text and moved under the Timezone handling chapter. I'll trigger a docs preview to make sure I've got the markup right.
| /// \return the resulting datum | ||
| /// | ||
| /// \since 12.0.0 | ||
| /// \note API not yet finalized |
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 was going to suggest removing this but now I see this is everywhere. Hmm.... :( I'm not sure how true this is these days.
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.
Well, you could see it as an opportunity to sync the API with substrait :D
|
@github-actions crossbow submit preview-docs |
|
Revision: 115347e Submitted crossbow builds: ursacomputing/crossbow @ actions-ffd22963ef
|
westonpace
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, the description is clear to me. Two small grammar nits.
Co-authored-by: Weston Pace <weston.pace@gmail.com>
|
@github-actions crossbow submit preview-docs |
|
Thanks @westonpace, merged the grammar changes. |
|
Revision: cf2eb81 Submitted crossbow builds: ursacomputing/crossbow @ actions-760f71e893
|
|
The test failures seem unrelated (I've opened a new issue for one which appears to be an intermittent segfault). |
|
Benchmark runs are scheduled for baseline = ae1f98f and contender = daa5e26. daa5e26 is a master commit associated with this PR. Results will be available as each benchmark for each run completes. |
|
Nice to see this functionality! One comment on the name of the function: given that "local_time" could also be interpreted as returning just the time (a For reference, in Joda they call this |
jorisvandenbossche
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.
And a few doc comments/questions
| "cannot be found in the timezone database."), | ||
| "If timezone is not given then timezone naive timestamp in UTC are\n" | ||
| "returned. An error is returned if the values have a defined timezone\n" | ||
| "but it cannot be found in the timezone database."), |
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.
Was this change intentional? Or was it meant to be in local_time_doc?
(and if intentional, why only for round and not ceil/floor?)
|
|
||
| const FunctionDoc local_time_doc{ | ||
| "Convert timestamp to a timezone-naive local time timestamp", | ||
| ("LocalTime converts a timestamp to a local time of timestamps timezone\n" |
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.
Something is missing in this sentence?
| "and removes timezone metadata. If input is in UTC or doesn't have\n" | ||
| "timezone metadata, it is returned as is.\n" |
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.
Returned "as is" is not entirely correct for UTC, as I assume the "UTC" timezone is still removed?
|
Thanks for the review @jorisvandenbossche. I've opened a PR to address it: #34263. |
…rnel (#34263) ### Rationale for this change A better naming for local_time kernel was proposed in post merge review of #34208. ### What changes are included in this PR? Change `local_time` to `local_timestamp` and related docs/test changes. ### Are these changes tested? Yes. ### Are there any user-facing changes? Changing `local_time` to `local_timestamp` is a user facing change. But since it was not yet released we can probably treat it as non-breaking. * Closes: #33143 Authored-by: Rok Mihevc <rok@mihevc.org> Signed-off-by: Rok Mihevc <rok@mihevc.org>
Rationale for this change
We have
assume_timezoneto go from wall time timestamp to timestamp with a timezone. We might want a reverse operation to go from timestamp with a timezone to wall time.This is not needed for computation within Arrow, but would be needed if an application outsides of Arrow consumes wall time. E.g.: https://stackoverflow.com/questions/73275465/how-to-keep-original-datatime-in-pyarrow-table/73276431
What changes are included in this PR?
This adds a
local_timeC++ kernel.Are these changes tested?
Yes.
Are there any user-facing changes?
Yes,
local_timeC++ kernel is added.