[SPARK-54541][SQL] Rename _LEGACY_ERROR_TEMP_1007 and add sqlState #53251
+28
−21
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
What changes were proposed in this pull request?
I renamed _LEGACY_ERROR_TEMP_1007 to TEMP_VIEW_WRITE_NOT_ALLOWED and added sqlState 42809.
The changes include:
Why are the changes needed?
Users frequently encounter this error when attempting to write to temporary views using the DataFrameWriter V2 API. The legacy error name is non-descriptive and lacks an sqlState, which makes it difficult to handle programatically and reduces compatibility with JDBC/ODBC clients.
Does this PR introduce any user-facing change?
No. The error message text stays the same. User will only see the same error message, but the underlying error class is now properly named and includes a sqlState for better tooling support.
How was this patch tested?
I tested this change in multiple ways:
Manual Testing in Spark-Shell
Before (legacy error):
After (new error with class and sqlState):
Note: The error now displays the error class
[TEMP_VIEW_WRITE_NOT_ALLOWED]and includes sqlState42623(accessible viagetSqlState()).Ran the full DataFrameWriterV2Suite test suite: all tests pass successfully
Was this patch authored or co-authored using generative AI tooling?
No