-
Notifications
You must be signed in to change notification settings - Fork 28.5k
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-49773][SQL] Uncaught Java exception from make_timestamp()
with bad timezone
#48260
Conversation
sql/api/src/main/scala/org/apache/spark/sql/errors/ExecutionErrors.scala
Outdated
Show resolved
Hide resolved
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.
Please provide teh bad value and imporve teh error message. I have provided a proposal.
Co-authored-by: Serge Rielau <srielau@users.noreply.github.com>
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.
Fixed the ticks, sorry
Co-authored-by: Serge Rielau <srielau@users.noreply.github.com>
Thanks for the fix! |
sql/api/src/main/scala/org/apache/spark/sql/catalyst/util/SparkDateTimeUtils.scala
Show resolved
Hide resolved
sql/api/src/main/scala/org/apache/spark/sql/catalyst/util/SparkDateTimeUtils.scala
Show resolved
Hide resolved
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.
Could you add a test for the new error condition INVALID_TIMEZONE
, please.
Added test. Thanks! |
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.
Waiting for CI.
make_timestamp()
with bad timezone
…th bad timezone ### What changes were proposed in this pull request? This PR proposes to fix the uncaught Java exception from `make_timestamp()` with bad timezone ### Why are the changes needed? To improve the error message ### Does this PR introduce _any_ user-facing change? No API changes, but the user-facing error message is changed: **Before** ``` spark-sql (default)> select make_timestamp(1, 2, 28, 23, 1, 1, -100); Invalid ID for ZoneOffset, invalid format: -100 ``` **After** ``` spark-sql (default)> select make_timestamp(1, 2, 28, 23, 1, 1, -100); [INVALID_TIMEZONE] The timezone: -100 is invalid. The timezone must be either a region-based zone ID or a zone offset. Region IDs must have the form ‘area/city’, such as ‘America/Los_Angeles’. Zone offsets must be in the format ‘(+|-)HH’, ‘(+|-)HH:mm’ or ‘(+|-)HH:mm:ss’, e.g ‘-08’, ‘+01:00’ or ‘-13:33:33’., and must be in the range from -18:00 to +18:00. 'Z' and 'UTC' are accepted as synonyms for '+00:00'. SQLSTATE: 22009 ``` ### How was this patch tested? CI ### Was this patch authored or co-authored using generative AI tooling? No Closes apache#48260 from itholic/SPARK-49773. Lead-authored-by: Haejoon Lee <haejoon.lee@databricks.com> Co-authored-by: Haejoon Lee <haejoon@apache.org> Signed-off-by: Haejoon Lee <haejoon.lee@databricks.com>
What changes were proposed in this pull request?
This PR proposes to fix the uncaught Java exception from
make_timestamp()
with bad timezoneWhy are the changes needed?
To improve the error message
Does this PR introduce any user-facing change?
No API changes, but the user-facing error message is changed:
Before
After
How was this patch tested?
CI
Was this patch authored or co-authored using generative AI tooling?
No