Skip to content

feat: Add $schemas system table#245

Open
plusplusjiajia wants to merge 2 commits intoapache:mainfrom
plusplusjiajia:fusion-schema
Open

feat: Add $schemas system table#245
plusplusjiajia wants to merge 2 commits intoapache:mainfrom
plusplusjiajia:fusion-schema

Conversation

@plusplusjiajia
Copy link
Copy Markdown
Member

Purpose

Mirrors Java SchemasTable: exposes <table>$schemas as a DataFusion table provider listing all historical schema versions of a Paimon table, with 7 columns matching Java SchemasTable.TABLE_TYPE.

/// schema directory is missing or empty.
///
/// Mirrors Java [SchemaManager.listAllIds()](https://github.com/apache/paimon/blob/release-1.3/paimon-core/src/main/java/org/apache/paimon/schema/SchemaManager.java).
pub async fn list_all_ids(&self) -> crate::Result<Vec<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.

Consider refactor load_latest_table_schema to reuse codes.

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.

@JingsongLi Good catch, thanks! Done.

let ids = self.list_all_ids().await?;
let mut schemas = Vec::with_capacity(ids.len());
for id in ids {
schemas.push(self.schema(id).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.

For tables with many schema versions, parallel loading via futures::future::try_join_all would be faster.

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.

@JingsongLi Good point, thanks! 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