szehon-ho commented on code in PR #18049:
URL: https://github.com/apache/iceberg/pull/18049#discussion_r4031480572


##########
spark/v4.1/spark/src/main/java/org/apache/iceberg/spark/source/BaseSparkTable.java:
##########
@@ -157,6 +162,23 @@ public Map<String, String> properties() {
         .filter(entry -> !RESERVED_PROPERTIES.contains(entry.getKey()))
         .forEach(propsBuilder::put);
 
+    // Surface catalog-provided labels (driver-side only; not part of table 
state) so they are
+    // visible in DESCRIBE EXTENDED. The tbl.labels metadata table is the 
queryable counterpart.
+    if (table instanceof SupportsLabels) {
+      Labels labels = ((SupportsLabels) table).labels();
+      labels
+          .objectLabels()
+          .forEach((key, value) -> propsBuilder.put(LABELS_OBJECT_PREFIX + 
key, value));

Review Comment:
   Please handle collisions with stored table properties here. A table can 
already have a property such as `labels.object.owner`; if the catalog also 
supplies the `owner` label, both entries are added to the 
`ImmutableMap.Builder`, and `build()` throws, breaking `DESCRIBE EXTENDED` and 
`SHOW TBLPROPERTIES`. The field-label prefix has the same issue. Could we 
define precedence, filter conflicts, and add coverage for both prefixes?



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