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-51583] [SQL] Improve error message when to_timestamp function has arguments of wrong type #50347

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

mihailoale-db
Copy link
Contributor

@mihailoale-db mihailoale-db commented Mar 21, 2025

What changes were proposed in this pull request?

I propose that we fix error message when to_timestamp function is called with improper argument types.

Why are the changes needed?

Users are provided with more user facing error instead of an internal one, which is more correct.

Does this PR introduce any user-facing change?

No.

How was this patch tested?

Added test.

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

No.

@github-actions github-actions bot added the SQL label Mar 21, 2025
@@ -422,6 +422,13 @@ trait CheckAnalysis extends LookupCatalog with QueryErrorsBase with PlanToString
e.invalidFormat(checkRes)
}

case parseToTimestamp: ParseToTimestamp if parseToTimestamp.left.dataType != StringType =>
Copy link
Member

Choose a reason for hiding this comment

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

ParseToTimestamp should support numeric, see #35887. cc @HyukjinKwon

And I am not sure that checking parameters of particular expression here in checkAnalysis is right approach. IMHO, ParseToTimestamp should care of them.

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.

2 participants