zhongyujiang commented on issue #14426:
URL: https://github.com/apache/iceberg/issues/14426#issuecomment-3514978905

   @Fokko Thanks for looking at this!
   
   > Just reverting the current-schema-id to the previous value should restore 
the data. 
   
   Actually, my idea is to add the deleted column back and create a new schema 
(with a new schema ID), because sometimes users may perform a series of schema 
changes (adding and deleting columns), but only need to undelete a specific 
column.
   
   Moreover, if the deleted column was required, I think it can only be 
restored as optional, right? This would require creating a new schema.
   
   > The main question is, how would you do this in a SQL based engine that 
mostly used with Iceberg.
   
   I think we could first add this API and its implementation to 
`UpdateSchema`, and then support this API in both the SQL and REST catalogs.
   
   ```java
   UpdateSchema undeleteColumn(String name);
   ```
   
   As for SQL, I think we can add `undelete` support to the `ALTER TABLE` 
syntax. However, this would likely require engines like Spark to support this 
syntax first—I believe Spark doesn't currently support it.
   ```sql 
   ALTER TABLE my_table UNDELETE COLUMN id;
   ```
   
   
   
   
   


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