You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@iceberg.apache.org by GitBox <gi...@apache.org> on 2020/10/13 03:11:57 UTC

[GitHub] [iceberg] liukun4515 edited a comment on issue #1597: Spark SQL Extensions: Expire snapshots

liukun4515 edited a comment on issue #1597:
URL: https://github.com/apache/iceberg/issues/1597#issuecomment-707455716


   @aokolnychyi 
   ```
   CALL catalog.schema.expire_snapshots(
     namespace => 'namespace_name',
     table => 'table_name',
     retain_last => 100
   )
   ```
   In the `expire snapshot` API, if we only give the `retain last num` for a table, the commit action is invalid.
   
   the apply code is:
   ```
     private TableMetadata internalApply() {
       this.base = ops.refresh();
   
       TableMetadata updateMeta = base.removeSnapshotsIf(snapshot ->
           idsToRemove.contains(snapshot.snapshotId()) ||
           (expireOlderThan != null && snapshot.timestampMillis() < expireOlderThan &&
               !idsToRetain.contains(snapshot.snapshotId())));
       List<Snapshot> updateSnapshots = updateMeta.snapshots();
       List<Snapshot> baseSnapshots = base.snapshots();
       return updateSnapshots.size() != baseSnapshots.size() ? updateMeta : base;
     }
   ```
   if the `expireOlderThan` is not set(`expireOlderThan` is null), the `retain last num` or `idsToRetain` is invalid.


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

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



---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@iceberg.apache.org
For additional commands, e-mail: issues-help@iceberg.apache.org