Skip to content

feat(inspect): Add base class for metadata table support#607

Draft
All-less wants to merge 5 commits into
apache:mainfrom
All-less:metadata-table
Draft

feat(inspect): Add base class for metadata table support#607
All-less wants to merge 5 commits into
apache:mainfrom
All-less:metadata-table

Conversation

@All-less
Copy link
Copy Markdown

This PR kicks off the implementation of table inspection support.

  • Add BaseMetadataTable class (without scan support for now).
  • Add MetadataTableFactory as an entry point for creating metadata tables.
  • Add SnapshotsTable and HistoryTable as example impl.

@All-less All-less marked this pull request as draft March 29, 2026 20:52
Copy link
Copy Markdown
Member

@wgtmac wgtmac 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 working on this! I've left some preliminary comments.

Comment thread src/iceberg/inspect/metadata_table.h Outdated
Comment thread src/iceberg/inspect/metadata_table.h Outdated
Comment thread src/iceberg/inspect/metadata_table.h Outdated
Comment thread src/iceberg/inspect/metadata_table.cc Outdated
Comment thread src/iceberg/CMakeLists.txt Outdated
Comment thread src/iceberg/inspect/snapshots_table.h
Comment thread src/iceberg/CMakeLists.txt
Comment thread src/iceberg/inspect/metadata_table_factory.h Outdated
Comment thread src/iceberg/inspect/metadata_table_factory.h Outdated
Comment thread src/iceberg/inspect/metadata_table_factory.h Outdated
Comment thread src/iceberg/type_fwd.h
class UpdateSortOrder;
class UpdateStatistics;

/// \brief Metadata tables.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Please sort them alphabetically

///
/// Once a table scan builder is created, it can be refined to project columns and
/// filter data.
Result<std::unique_ptr<TableScanBuilder>> NewScan() const;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Forget to mark override?


std::shared_ptr<Table> source_table_;
std::string uuid_;
std::shared_ptr<Schema> schema_;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Member variables here and below are not necessary

const std::string& uuid() const { return uuid_; }

/// \brief Returns the schema for this table, return NotFoundError if not found
Result<std::shared_ptr<Schema>> schema() const { return schema_; }
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Let's remove these redefinitions here and below

///
/// \param table The source table
/// \return A SnapshotsTable exposing all snapshots or error status
static Result<std::unique_ptr<SnapshotsTable>> GetSnapshotsTable(
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

It looks cumbersome to use a function per type. Can we use enum metadata type or canonical metadata table name suffix instead to return a std::unique_ptr<Table> instead?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

BTW, do we want to support the case when users directly create a metadata table without having a table object? For example, users may directly create a metadata table from catalog by calling LoadTable and providing full table identifier with metadata table suffix.

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