danielcweeks commented on code in PR #15750:
URL: https://github.com/apache/iceberg/pull/15750#discussion_r3626058904


##########
open-api/rest-catalog-open-api.yaml:
##########
@@ -3734,6 +3734,50 @@ components:
           type: array
           items:
             $ref: '#/components/schemas/StorageCredential'
+        labels:
+          $ref: '#/components/schemas/Labels'
+
+    Labels:
+      type: object
+      description: |
+        Catalog-provided metadata enrichment (for example ownership,
+        classification, or cost attribution) returned with a table or view.
+        Labels are ephemeral: catalog-owned, generated per request, and never
+        persisted to table metadata or versioned with table history. Optional;
+        clients may ignore them. Labels are catalog-specific; different 
catalogs
+        may return different or no labels for the same object. `table` carries
+        entity-level labels; `columns` is an array of per-column entries, each
+        identifying its column by field-id.
+      properties:
+        table:
+          type: object
+          description: Top-level entity labels (attached to the catalog object 
as a whole).
+          additionalProperties:
+            type: string
+        columns:
+          type: array
+          description: >-
+            Column-level labels. Each entry identifies its column by field-id.
+          items:
+            $ref: '#/components/schemas/ColumnLabels'

Review Comment:
   I could see changing `ColumnLabels -> FieldLables` especially since columns 
are typically top-level and we actually allow attaching labels to nested 
field-ids (so that would be more accurate).
   
   I think the bigger naming issue is `Labels` component.  If we use `object` 
and `fields` as the internal references, that would apply equally for tables, 
and views, but fields may not make sense in the context of other objects like 
namespaces or functions.
   
   We could construct this with inheritance as:
   ```
   CatalogObjectLabels:
     type: object
     properties:
       object:
       type: object
       description: Catalog-object-level labels.
       additionalProperties:
         type: string
   
   FieldLabels:
     type: object
         required:
           - field-id
           - labels
         properties:
           field-id:
             type: integer
             description: Field ID from the current schema of the table or view
           labels:
             type: object
             description: Flat key-value labels for this column
             additionalProperties:
               type: string
   
   TableLabels:
     anyOf:
       - $ref: '#/components/schemas/CatalogObjectLabels'
       - $ref: '#/components/schemas/FieldLabels'
   ```
   
   Then each of the core components is reusable and explicit (i.e. we don't end 
up reusing the wrong named component for something like view or function in the 
future).



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