Skip to content

[GLUTEN-11622][VL] Support cast between TIMESTAMP and TIMESTAMP_NTZ - #12654

Merged
rui-mo merged 1 commit into
apache:mainfrom
Mariamalmesfer:ts-ntz-cast-timestamp-utc-support
Aug 14, 2026
Merged

[GLUTEN-11622][VL] Support cast between TIMESTAMP and TIMESTAMP_NTZ#12654
rui-mo merged 1 commit into
apache:mainfrom
Mariamalmesfer:ts-ntz-cast-timestamp-utc-support

Conversation

@Mariamalmesfer

@Mariamalmesfer Mariamalmesfer commented Jul 29, 2026

Copy link
Copy Markdown
Contributor

Enable CAST(timestamp AS timestamp_ntz) and CAST(timestamp_ntz AS timestamp)
to run natively in the Velox backend instead of falling back to Spark.

Velox PR: facebookincubator/velox#17920

Related issue: #11622

@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@github-actions github-actions Bot added CORE works for Gluten Core VELOX labels Jul 29, 2026
@Mariamalmesfer
Mariamalmesfer force-pushed the ts-ntz-cast-timestamp-utc-support branch from 787883d to fcd4b69 Compare July 29, 2026 21:54
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@Mariamalmesfer
Mariamalmesfer force-pushed the ts-ntz-cast-timestamp-utc-support branch from fcd4b69 to 2501240 Compare August 3, 2026 10:54
@github-actions

github-actions Bot commented Aug 3, 2026

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@Mariamalmesfer

Copy link
Copy Markdown
Contributor Author

Hi @rui-mo, could you take a look when you get the chance? Thanks!

case Minute(child, _) => containsNTZ(child.dataType)
case Second(child, _) => containsNTZ(child.dataType)
case TimestampAdd(_, _, child, _) => containsNTZ(child.dataType)
case c: Cast if !containsNTZ(c.dataType) => containsNTZ(c.child.dataType)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This would allow all non-timestamp_ntz types to be cast to timestamp_ntz. While I assume the supported cases are still limited. Could you please confirm?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Yes, that's correct fixed required both guards to check TimestampType

@Mariamalmesfer
Mariamalmesfer force-pushed the ts-ntz-cast-timestamp-utc-support branch from 2501240 to cce03eb Compare August 5, 2026 09:54
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@Mariamalmesfer
Mariamalmesfer force-pushed the ts-ntz-cast-timestamp-utc-support branch from cce03eb to 554debc Compare August 5, 2026 11:38
@github-actions

github-actions Bot commented Aug 5, 2026

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@Mariamalmesfer

Copy link
Copy Markdown
Contributor Author

@rui-mo could you take another look? Thank you!

@rui-mo rui-mo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks.

case Minute(child, _) => containsNTZ(child.dataType)
case Second(child, _) => containsNTZ(child.dataType)
case TimestampAdd(_, _, child, _) => containsNTZ(child.dataType)
case c: Cast if c.dataType == TimestampType => containsNTZ(c.child.dataType)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The containsNTZ would also allow complex types which contain TimestampNTZ type, but those cases haven't been verified.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Added a non-recursive isNTZ helper for the check, used in both Cast guards

case Second(child, _) => containsNTZ(child.dataType)
case TimestampAdd(_, _, child, _) => containsNTZ(child.dataType)
case c: Cast if c.dataType == TimestampType => containsNTZ(c.child.dataType)
case c: Cast if containsNTZ(c.dataType) => c.child.dataType == TimestampType

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

ditto

@Mariamalmesfer
Mariamalmesfer force-pushed the ts-ntz-cast-timestamp-utc-support branch from 554debc to 660d7a0 Compare August 12, 2026 20:31
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@rui-mo rui-mo changed the title [VL] Support Cast between TIMESTAMP and TIMESTAMP_NTZ [GLUTEN-11622][VL] Support cast between TIMESTAMP and TIMESTAMP_NTZ Aug 13, 2026

@rui-mo rui-mo left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Thanks.

@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@Mariamalmesfer
Mariamalmesfer force-pushed the ts-ntz-cast-timestamp-utc-support branch from be77bda to a3c34aa Compare August 13, 2026 19:00
@github-actions

Copy link
Copy Markdown

Run Gluten Clickhouse CI on x86

@rui-mo
rui-mo merged commit 3ae572b into apache:main Aug 14, 2026
72 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CORE works for Gluten Core VELOX

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants