cloud-fan commented on code in PR #57311:
URL: https://github.com/apache/spark/pull/57311#discussion_r3600823495


##########
docs/sql-ref-syntax-ddl-comment.md:
##########
@@ -0,0 +1,95 @@
+---
+layout: global
+title: COMMENT ON
+displayTitle: COMMENT ON
+license: |
+  Licensed to the Apache Software Foundation (ASF) under one or more
+  contributor license agreements.  See the NOTICE file distributed with
+  this work for additional information regarding copyright ownership.
+  The ASF licenses this file to You under the Apache License, Version 2.0
+  (the "License"); you may not use this file except in compliance with
+  the License.  You may obtain a copy of the License at
+ 
+     http://www.apache.org/licenses/LICENSE-2.0
+ 
+  Unless required by applicable law or agreed to in writing, software
+  distributed under the License is distributed on an "AS IS" BASIS,
+  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+  See the License for the specific language governing permissions and
+  limitations under the License.
+---
+
+### Description
+
+The `COMMENT ON` statement sets or updates the comment on a database, a table, 
or
+one or more table columns. Setting the comment to `NULL` removes it.
+
+### Syntax
+
+```sql
+COMMENT ON { DATABASE | SCHEMA | NAMESPACE } database_name IS comment
+
+COMMENT ON TABLE table_name IS comment
+
+COMMENT ON COLUMN table_name.column_name IS comment
+
+COMMENT ON TABLE table_name COLUMN ( column_name IS comment [ , ... ] )

Review Comment:
   This form (and the nested-field `col.field` variant) doesn't actually work 
on the default session catalog. `ResolveSessionCatalog` converts `AlterColumns` 
on a V1 table into `AlterTableChangeColumnCommand`, and that path rejects both 
cases (`ResolveSessionCatalog.scala:86-94`):
   
   - `COMMENT ON TABLE t COLUMN (a IS 'x', b IS 'y')` → 
`UNSUPPORTED_FEATURE.TABLE_OPERATION`, `operation = "ALTER COLUMN in bulk"`
   - `COMMENT ON TABLE t COLUMN (point.x IS 'x')` → `operation = "ALTER COLUMN 
with qualified column"`
   
   Since `spark.sql.catalog.spark_catalog` defaults to `builtin`, this is what 
a user hits on an ordinary managed table — yet this page presents both forms 
with no caveat, and the example below even uses a session-style 
`some_db.some_table` with multiple columns and `address.city`. Two things to 
fix:
   
   1. The error names "ALTER COLUMN" for a command the user wrote as `COMMENT 
ON` — confusing. Raise a `COMMENT ON`-specific message (or extend the V1 path 
to loop over comment-only specs / qualified names, if that's in scope).
   2. Either make it work on V1, or document the V2-only limitation here.
   
   The multi-column/nested tests all run against `testcat.*` (V2) only, so 
there's no V1 coverage catching this — a session-catalog test asserting the 
chosen behavior should go with the fix. (This predates the last review round; 
it's my own late catch, not something you introduced.)



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