Skip to content

[SPARK-58212][SQL] Replace _LEGACY_ERROR_TEMP_1052 with UNSUPPORTED_FEATURE.TABLE_OPERATION#57364

Open
Ma77Ball wants to merge 2 commits into
apache:masterfrom
Ma77Ball:assign-name-legacy-error-1052
Open

[SPARK-58212][SQL] Replace _LEGACY_ERROR_TEMP_1052 with UNSUPPORTED_FEATURE.TABLE_OPERATION#57364
Ma77Ball wants to merge 2 commits into
apache:masterfrom
Ma77Ball:assign-name-legacy-error-1052

Conversation

@Ma77Ball

@Ma77Ball Ma77Ball commented Jul 20, 2026

Copy link
Copy Markdown
Contributor

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

No

@Ma77Ball Ma77Ball changed the title [SPARK-58212][SQL] Assign a name to the error condition _LEGACY_ERROR_TEMP_1052 [SPARK-58212][SQL] Replace _LEGACY_ERROR_TEMP_1052 with UNSUPPORTED_FEATURE.TABLE_OPERATION Jul 20, 2026

@uros-b uros-b left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thank you @Ma77Ball!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants