Skip to content

feate(table): Add time travel functionality - #548

Merged
zeroshade merged 3 commits into
apache:mainfrom
dttung2905:feat-time-travel
Sep 1, 2025
Merged

zeroshade merged 3 commits into
apache:mainfrom
dttung2905:feat-time-travel

Conversation

@dttung2905

@dttung2905 dttung2905 commented Aug 24, 2025 •

Copy link
Copy Markdown
Contributor

Hi team,
This PR aim to create a time travel functionality for go sdk. I took reference from iceberg-go implementation

Example for WithSnapshotAsOf()

// Scan data as it existed 1 day ago
oneDayAgo := time.Now().Add(-24 * time.Hour).UnixMilli()

// Basic time travel scan
scan, err := table.WithSnapshotAsOf(oneDayAgo)
if err != nil {
    log.Fatal("Time travel scan failed:", err)
}

// Time travel scan with filters and options
scanWithOptions, err := table.WithSnapshotAsOf(oneDayAgo,
    table.WithSelectedFields("id", "name", "amount"),  // Select specific fields
    table.WithRowFilter("amount > 10"), 
    table.WithLimit(10),
)

// Execute the scan
batches, err := scan.ToArrowBatches(context.Background())
if err != nil {
    log.Fatal("Failed to execute scan:", err)
}

Example for SnapshotAsOf()

twoHoursAgo := time.Now().Add(10 * time.Hour).UnixMilli()
snapshot := table.SnapshotAsOf(twoHoursAgo, true)
fmt.Println(snapshot.SnapshotID)

Comment thread table/table.go Resolved
Comment thread table/table.go Resolved
Comment thread table/table.go Resolved
@zeroshade
zeroshade merged commit a4b7ad4 into apache:main Sep 1, 2025
@laskoviymishka laskoviymishka mentioned this pull request Apr 3, 2026
96 tasks done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants