[SPARK-54831][SQL] Add COMMENT ON COLUMN support to set and remove column comments #53593
+281
−5
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.
This PR adds support for the COMMENT ON COLUMN SQL syntax to set, update, and remove comments on table columns.
The syntax follows the SQL standard:
COMMENT ON COLUMN [catalog.][[database.]table.]column IS { 'comment_text' | NULL }Key features:
Set/Update comment:
COMMENT ON COLUMN table.column IS 'text'- Sets or updates a column commentRemove comment:
COMMENT ON COLUMN table.column IS NULL- Removes the commentFlexible qualification: Supports table.column, database.table.column, and catalog.database.table.column formats
Implementation highlights:
What changes were proposed in this pull request?
Why are the changes needed?
Currently, Spark only supports setting column comments via:
This PR provides a standard SQL syntax (COMMENT ON COLUMN) that:
Does this PR introduce any user-facing change?
Yes. New SQL syntax:
How was this patch tested?
Added comprehensive parser tests in DDLParserSuite.scala covering:
Added integration tests in DataSourceV2SQLSuite.scala covering:
Was this patch authored or co-authored using generative AI tooling?
No