ganeshashree commented on code in PR #57311:
URL: https://github.com/apache/spark/pull/57311#discussion_r3604579567


##########
sql/core/src/main/scala/org/apache/spark/sql/catalyst/analysis/ResolveSessionCatalog.scala:
##########
@@ -81,6 +81,25 @@ class ResolveSessionCatalog(val catalogManager: 
CatalogManager)
     case ReplaceColumns(ResolvedV1TableIdentifier(ident), _) =>
       throw QueryCompilationErrors.unsupportedTableOperationError(ident, 
"REPLACE COLUMNS")
 
+    // Comment-only changes that touch multiple columns or a nested field (e.g.
+    // `COMMENT ON TABLE t COLUMN (a IS 'x', b IS 'y')` or `... (point.x IS 
'x')`) cannot be
+    // expressed by the single-column, top-level-only 
`AlterTableChangeColumnCommand`. Handle them
+    // with a dedicated V1 command that applies all specs at once via 
`applySchemaChanges`.
+    case a @ AlterColumns(rt @ ResolvedTable(catalog, _, table: V1Table, _), 
specs)
+        if supportsV1Command(catalog) && a.resolved && 
isMultiOrNestedCommentOnly(specs) =>

Review Comment:
   Gated the routing on the command origin so this stays scoped to `COMMENT 
ON`. Added a `fromCommentOn` flag on `AlterColumns` (set only at the two 
`COMMENT ON ... COLUMN` parser sites); the V1 comment-routing case now requires 
it, so bulk/nested `ALTER TABLE ... ALTER COLUMN ... COMMENT` on the session 
catalog keeps its existing `UNSUPPORTED_FEATURE.TABLE_OPERATION` error and the 
ALTER TABLE surface is unchanged. Added a `DataSourceV2SQLSuite` test asserting 
the guard (bulk/nested ALTER TABLE comment still throws on V1, single-column 
still works). Kept the PR scoped to `COMMENT ON` rather than expanding ALTER 
TABLE behavior here.



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