Skip to content

Add support for hour(timestamp_ntz)#1974

Open
Mariamalmesfer wants to merge 1 commit into
ts_ntz_ibmfrom
ts-ntz-hour-support
Open

Add support for hour(timestamp_ntz)#1974
Mariamalmesfer wants to merge 1 commit into
ts_ntz_ibmfrom
ts-ntz-hour-support

Conversation

@Mariamalmesfer
Copy link
Copy Markdown
Collaborator

No description provided.


FOLLY_ALWAYS_INLINE void call(
int32_t& result,
const arg_type<TimestampNTZ>& timestamp) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry for the confusion, we need to use TimestampUtcType. TimestampNTZ is being removed (see facebookincubator#16886). You might could refer to struct TimestampPlusOneFunction for how to register a function for both Timestamp and TimestampUtc types.

Copy link
Copy Markdown
Collaborator Author

@Mariamalmesfer Mariamalmesfer May 3, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No worries, switched to TimestampUtcType following the TimestampPlusOneFunction pattern

@Mariamalmesfer Mariamalmesfer force-pushed the ts-ntz-hour-support branch from 484eb10 to 5b830a8 Compare May 3, 2026 14:57
@rui-mo
Copy link
Copy Markdown

rui-mo commented May 7, 2026

@Mariamalmesfer Thanks for the update. Could you please update the relevant documentation? Also consider opening a corresponding Gluten PR to enable this function.

@Mariamalmesfer Mariamalmesfer force-pushed the ts-ntz-hour-support branch 6 times, most recently from bedb5e9 to ac505e1 Compare May 7, 2026 10:12
@Mariamalmesfer
Copy link
Copy Markdown
Collaborator Author

@Mariamalmesfer Thanks for the update. Could you please update the relevant documentation? Also consider opening a corresponding Gluten PR to enable this function.

Thanks! @rui-mo Updated the docs and opened the Gluten PR here: apache/gluten#12064

Copy link
Copy Markdown

@rui-mo rui-mo left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks. The corresponding type has already been merged into Meta/Velox, so we can move this PR there now.

Comment thread velox/docs/functions/spark/datetime.rst Outdated
.. spark:function:: hour(timestamp_ntz) -> integer

Returns the hour of ``timestamp_ntz``. The result is not affected by the
session timezone since ``timestamp_ntz`` represents wall-clock time with no
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

timestamp_ntz represents wall-clock time with no timezone attached.

This seems inaccurate because both timestamp and timestamp_ntz don't carry timezone information. Consider revising it to: timestamp_ntz represents a local time that is independent of time zone.

@@ -177,6 +177,14 @@ These functions support TIMESTAMP and DATE input types.

SELECT hour('2009-07-30 12:58:59'); -- 12
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Consider adding a timezone aware example for hour(timestamp) to illustrate the difference.

@Mariamalmesfer
Copy link
Copy Markdown
Collaborator Author

Thanks. The corresponding type has already been merged into Meta/Velox, so we can move this PR there now.

Thanks! Great news. I'll move this PR to facebookincubator/velox Should I also move the casting PR #1992 there as well?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants