You are viewing a plain text version of this content. The canonical link for it is here.
Posted to reviews@spark.apache.org by "ottomata (via GitHub)" <gi...@apache.org> on 2025/03/13 19:01:01 UTC

Re: [PR] [SPARK-23890][SQL] Support DDL for adding nested columns to struct types [spark]

ottomata commented on PR #21012:
URL: https://github.com/apache/spark/pull/21012#issuecomment-2722408376

   > Would one need to use CHANGE|ALTER COLUMN syntax for this?
   
   [TIL](https://phabricator.wikimedia.org/T209453#10632894) that Iceberg supports this with .value column name referencing!
   
   https://iceberg.apache.org/docs/nightly/spark-ddl/#alter-table-add-column
   
   ```sql
   -- create a map column of struct key and struct value
   ALTER TABLE prod.db.sample
   ADD COLUMN points map<struct<x: int>, struct<a: int>>;
   
   -- add a field to the value struct in a map. Using keyword 'value' to access the map's value column.
   ALTER TABLE prod.db.sample
   ADD COLUMN points.value.b int;
   ```
   
   And, that works via Spark!  
   
   I guess there is a bug though:
   https://github.com/apache/iceberg/issues/2962


-- 
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: reviews-unsubscribe@spark.apache.org

For queries about this service, please contact Infrastructure at:
users@infra.apache.org


---------------------------------------------------------------------
To unsubscribe, e-mail: reviews-unsubscribe@spark.apache.org
For additional commands, e-mail: reviews-help@spark.apache.org