itholic opened a new pull request, #48242:
URL: https://github.com/apache/spark/pull/48242
### What changes were proposed in this pull request?
This PR proposes to provide proper error conditions for
`_LEGACY_ERROR_TEMP_2000` and improve the error message
### Why are the changes needed?
To provide better user-facing error message
### Does this PR introduce _any_ user-facing change?
No API changes, but the user-facing error message will be improved:
**Before**
```sql
>>> spark.sql("SELECT make_date(2024, 13, 1);").show()
Invalid value for MonthOfYear (valid values 1 - 12): 13. If necessary set
"spark.sql.ansi.enabled" to false to bypass this error.
```
**After**
```sql
>>> spark.sql("SELECT make_date(2024, 13, 1);").show()
[ANSI_DATE_TIME_FIELD_OUT_OF_BOUNDS] ANSI mode error: Invalid value for
MonthOfYear (valid values 1 - 12): 13. If necessary set
"spark.sql.ansi.enabled" to false to bypass this error. SQLSTATE: 22008
```
### How was this patch tested?
The existing SQL tests should pass
### Was this patch authored or co-authored using generative AI tooling?
No
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]