liukun4515 commented 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, 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:
[email protected]



---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to