Skip to content
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

[SPARK-50840][SQL] Fixing the timestamp parsing failure for Hive table metadata reload, when timestamp alias points to NTZ #49521

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

ahshahid
Copy link

What changes were proposed in this pull request?

The conversion of Hive's timestamp to Catalyst TimestampType needs handling, as during hive table metadata reload, the Hive's timestamp gets incorrectly mapped to spark's TimestampNTZType, if the timestamp alias is set to TimestampNTZType via the conf property spark.sql.timestampType.
The fix is written keeping in mind, that in future when spark's timestamp are mapped correctly with Hive's timestamp, then table reload should not result in incorrect TimestampType in spark.
The changes are that while mapping hive timestamp field to spark's StructField, the actual hive's datatype is stored in the metadata of the struct field.
This allows to rectify the table schema by changing the Spark's TimestampNTZType back to TimestampType if the original hive datatype is "timestamp".

Why are the changes needed?

Any table operation which requires reload of table metadata would fail, as Hive does not understand spark's TimeStampNTZType.

Does this PR introduce any user-facing change?

No

How was this patch tested?

Added bug test.

Was this patch authored or co-authored using generative AI tooling?

No

…data reload, when timestamp alias points to NTZ
@github-actions github-actions bot added the SQL label Jan 16, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant