nastra commented on code in PR #8216: URL: https://github.com/apache/iceberg/pull/8216#discussion_r1282723705
########## docs/spark-ddl.md: ########## @@ -477,27 +477,50 @@ Note that although the identifier is removed, the column will still exist in the #### `ALTER TABLE ... CREATE BRANCH` -Branches can be created via the `CREATE BRANCH` statement, which includes -the snapshot to create the branch at and an optional retention clause. +Branches can be created via the `CREATE BRANCH` statement with following options +* Do not fail if the branch already exists with `IF NOT EXISTS` +* Update the branch if it already exists with `CREATE OR REPLACE` +* Create at a snapshot +* Create with retention ```sql +-- CREATE audit-branch at current snapshot with default retention. +ALTER TABLE prod.db.sample CREATE BRANCH `audit-branch` + +-- CREATE audit-branch at current snapshot with default retention if it doesn't exist. +ALTER TABLE prod.db.sample CREATE BRANCH IF NOT EXISTS `audit-branch` + +-- CREATE or REPLACE audit-branch at current snapshot with default retention or REPLACE it if already exists. +ALTER TABLE prod.db.sample CREATE OR REPLACE BRANCH `audit-branch` + -- CREATE audit-branch at snapshot 1234 with default retention. ALTER TABLE prod.db.sample CREATE BRANCH `audit-branch` AS OF VERSION 1234 --- CREATE audit-branch at snapshot 1234, retain audit-branch for 31 days, and retain the latest 31 days. The latest 3 snapshot snapshots, and 2 days worth of snapshots +-- CREATE audit-branch at snapshot 1234, retain audit-branch for 31 days, and retain the latest 31 days. The latest 3 snapshot snapshots, and 2 days worth of snapshots. ALTER TABLE prod.db.sample CREATE BRANCH `audit-branch` AS OF VERSION 1234 RETAIN 30 DAYS WITH RETENTION 3 SNAPSHOTS 2 DAYS ``` - #### `ALTER TABLE ... CREATE TAG` -Tags can be created via the `CREATE TAG` statement, which includes -the snapshot to create the branch at and an optional retention clause. +Tags can be created via the `CREATE TAG` statement with following options Review Comment: ```suggestion Tags can be created via the `CREATE TAG` statement with the following options: ``` -- 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]
