Skip to content

feat(datafusion): Add $snapshots system table#264

Merged
JingsongLi merged 3 commits intoapache:mainfrom
plusplusjiajia:fusion-snapshots
Apr 25, 2026
Merged

feat(datafusion): Add $snapshots system table#264
JingsongLi merged 3 commits intoapache:mainfrom
plusplusjiajia:fusion-snapshots

Conversation

@plusplusjiajia
Copy link
Copy Markdown
Member

Purpose

Mirrors Java SnapshotsTable: exposes <table>$snapshots with 14 columns matching Java SnapshotsTable.TABLE_TYPE.

@plusplusjiajia plusplusjiajia force-pushed the fusion-snapshots branch 2 times, most recently from 773de3c to f98569e Compare April 21, 2026 13:11
}

/// List snapshot files and find the id using the given reducer (min or max).
async fn find_by_list_files(&self, reducer: fn(i64, i64) -> i64) -> crate::Result<Option<i64>> {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Why modify this?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The refactor shares the directory-scan logic between the existing find_by_list_files and the new list_all_ids, I will revert it to keep this PR scoped to $snapshots.

Copy link
Copy Markdown
Contributor

@luoyuxia luoyuxia left a comment

Choose a reason for hiding this comment

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

Thanks for the pr. Left minor comments. PTAL

/// List all snapshot ids sorted ascending.
pub async fn list_all_ids(&self) -> crate::Result<Vec<i64>> {
let snapshot_dir = self.snapshot_dir();
let statuses = self.file_io.list_status(&snapshot_dir).await?;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Seems it will return error when the snapshot dir doesn't exists. Is it expected to return error instead of empty vec?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

@luoyuxia Good catch, thanks! Updated to return an empty vec when the
snapshot directory doesn't exist.

Copy link
Copy Markdown
Contributor

@JingsongLi JingsongLi left a comment

Choose a reason for hiding this comment

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

+1

@JingsongLi JingsongLi merged commit 9ff131f into apache:main Apr 25, 2026
8 checks passed
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.

3 participants