Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add number option to preserve in Iceberg expire_snapshots procedure #25265

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

ebyhr
Copy link
Member

@ebyhr ebyhr commented Mar 10, 2025

Description

Add retain_last option to expire_snapshots procedure in Iceberg connector.
Spark supports this option. https://iceberg.apache.org/docs/latest/spark-procedures/#expire_snapshots

Request in Trino Slack: https://trinodb.slack.com/archives/C0305TQ05KL/p1741348205204709

Piyush Kumar
Hi Team, how can we keep only last 7 snapshot of table in desc order, currently i m keeping the last 7days snapshot using - ALTER TABLE {{ this }} EXECUTE expire_snapshots(retention_threshold => '7d')

Release notes

## Iceberg
* Fix some things. ({issue}`issuenumber`)

@cla-bot cla-bot bot added the cla-signed label Mar 10, 2025
@github-actions github-actions bot added the iceberg Iceberg connector label Mar 10, 2025
@@ -36,6 +39,16 @@ public TableProcedureMetadata get()
"retention_threshold",
"Only snapshots older than threshold should be removed",
Duration.valueOf("7d"),
false),
integerProperty(
"retain_last",
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used the parameter name which is the same as Spark here, but min_snapshots or something might be better. Other suggestions are welcome.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

retain_last sounds consistent with retention_threshold - I'd vote for that option

@ebyhr ebyhr force-pushed the ebi/iceberg-expire-snaphosts-retain-last branch 2 times, most recently from bf45246 to 0dd6346 Compare March 10, 2025 06:01
@ebyhr ebyhr force-pushed the ebi/iceberg-expire-snaphosts-retain-last branch from 0dd6346 to 415e2fd Compare March 10, 2025 09:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cla-signed iceberg Iceberg connector
Development

Successfully merging this pull request may close these issues.

2 participants