Ma77Ball opened a new pull request, #57364:
URL: https://github.com/apache/spark/pull/57364

   ### What changes were proposed in this pull request?
   
   This PR assigns a name to the legacy error condition 
`_LEGACY_ERROR_TEMP_1052`, raised when a `NOT NULL` column is added to a v1 
(session-catalog) table via `ALTER TABLE ... ADD COLUMN`. Rather than 
introducing a brand-new condition, it reuses the existing 
`UNSUPPORTED_FEATURE.TABLE_OPERATION`, matching the sibling "ADD COLUMN with 
qualified column" rejection immediately above the same call site in 
`ResolveSessionCatalog`. Concretely: removed `_LEGACY_ERROR_TEMP_1052` from 
`error-conditions.json`; removed the now-unused 
`addColumnWithV1TableCannotSpecifyNotNullError()` helper from 
`QueryCompilationErrors`; and changed the call site to throw 
`unsupportedTableOperationError(ident, "ADD COLUMN with NOT NULL")`.
   
   ### Why are the changes needed?
   
   This is part of the ongoing effort under 
[SPARK-37935](https://issues.apache.org/jira/browse/SPARK-37935) to migrate 
`_LEGACY_ERROR_TEMP_*` conditions onto proper, named error classes. Reusing 
`UNSUPPORTED_FEATURE.TABLE_OPERATION` keeps the two `ADD COLUMN` rejections at 
this call site consistent and yields a clearer, table-qualified message.
   
   ### Does this PR introduce _any_ user-facing change?
   
   Yes. The error condition name and message change; the behavior (the 
conditions under which the error is raised) is unchanged.
   
   Before (condition `_LEGACY_ERROR_TEMP_1052`):
   
   ```
   ADD COLUMN with v1 tables cannot specify NOT NULL.
   ```
   
   After (condition `UNSUPPORTED_FEATURE.TABLE_OPERATION`):
   
   ```
   Table `spark_catalog`.`default`.`t` does not support ADD COLUMN with NOT 
NULL. Please check the current catalog and namespace to make sure the qualified 
table name is expected, and also check the catalog implementation which is 
configured by "spark.sql.catalog".
   ```
   
   ### How was this patch tested?
   
   Added a new `checkError` test in `QueryCompilationErrorsSuite` that runs 
`ALTER TABLE t ADD COLUMN c INT NOT NULL` on a v1 parquet table and asserts the 
`UNSUPPORTED_FEATURE.TABLE_OPERATION` condition and its parameters. No test 
previously covered this path.
   
   ### Was this patch authored or co-authored using generative AI tooling?
   
   


-- 
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]

Reply via email to