Skip to content

feat(inspect): add refs metadata table - #1007

Open
manuzhang wants to merge 2 commits into
apache:mainfrom
manuzhang:codex/add-refs-metadata-table
Open

manuzhang wants to merge 2 commits into
apache:mainfrom
manuzhang:codex/add-refs-metadata-table

Conversation

@manuzhang

@manuzhang manuzhang commented Oct 13, 2026 •

Copy link
Copy Markdown
Member

Add the refs metadata table so callers can inspect a table's branches and tags through Table::Inspect(MetadataTableKind::kRefs). Rows are sorted by reference name and expose six columns: name, type (BRANCH or TAG), snapshot_id, max_reference_age_in_ms, min_snapshots_to_keep, and max_snapshot_age_in_ms. Unset retention values are null.

RefsTable and RefsScan use the current metadata scan builder, static tasks, and shared batch helper. They support column selection and projection, configurable batch sizes, and tasks and streams that retain their inputs. Time-travel options return kNotSupported. Null source tables return kInvalidArgument; null snapshot references return kInvalid when opening a task, with errors preserved through repeated Arrow C stream reads.

Move the existing metadata tests and shared fixture into src/iceberg/test/inspect. Refs coverage includes format versions 1, 2, and 3, branch and tag values, null retention fields, empty tables, batch boundaries, projection and selection, task and stream lifetimes, and invalid inputs.

Validation: all 55 tests in metadata_table_test passed, including 25 refs tests, using a Debug build with system Arrow 23.0.1. pre-commit and git diff --check passed.

Copilot AI balanced review requested due to automatic review settings October 13, 2026 13:53

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Warning

Copilot couldn't run its full agentic review because it didn't start before the timeout. Make sure your repository has a runner available, or add a copilot-code-review.yml file specifying one with the runs-on attribute. See the docs for more details.

Copilot review overview

4 open findings
What changed in this PR

This PR adds an inspect metadata table (RefsTable) that exposes Iceberg branch/tag snapshot references as an Arrow stream, along with a shared internal helper for emitting bounded Arrow record batches.

Changes:

  • Introduces RefsTable (schema + scan implementation) and wires it into the metadata table kind enum / build system.
  • Adds a shared internal Arrow row-stream helper to generate bounded Arrow batches from row iterators.
  • Adds RefsTable unit tests (format v2/v3) and integrates them into the test target.
File Description
src/​iceberg/​type_fwd.h Adds forward declaration for RefsTable.
src/​iceberg/​inspect/​metadata_table.h Adds kRefs metadata table kind.
src/​iceberg/​inspect/​refs_table.h Declares the new RefsTable metadata table API.
src/​iceberg/​inspect/​refs_table.cc Implements RefsTable schema + scanning over snapshot refs; sorts results.
src/​iceberg/​inspect/​metadata_table_stream_internal.h Adds internal Arrow stream implementation for iterating rows in bounded batches.
src/​iceberg/​test/​inspect/​refs_table_test.cc Adds tests validating schema, sorting, and retention-field projection.
src/​iceberg/​test/​CMakeLists.txt Registers the new refs table tests in the test target.
src/​iceberg/​cpp20_compatibility_internal.h Includes the new header for compatibility aggregation.
src/​iceberg/​CMakeLists.txt Adds inspect/refs_table.cc to library sources.

🧠 Review effort: Lite


💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread src/iceberg/inspect/refs_table.cc Resolved
Comment thread src/iceberg/inspect/refs_table.cc Resolved
Comment thread src/iceberg/inspect/refs_table.cc Resolved
@manuzhang
manuzhang marked this pull request as draft October 13, 2026 15:06
manuzhang added a commit to manuzhang/iceberg-cpp that referenced this pull request Oct 13, 2026
Move the common metadata test fixture into inspect and update history and snapshots includes to match PR apache#1007.

Co-authored-by: Codex <codex@openai.com>
Copilot AI balanced review requested due to automatic review settings October 13, 2026 15:37

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Comment thread src/iceberg/test/CMakeLists.txt Resolved
Comment thread src/iceberg/inspect/refs_table.cc Resolved
manuzhang and others added 2 commits November 6, 2026 12:09
Co-authored-by: Codex <codex@openai.com>
Reject null snapshot references and cover format versions, batching, projection, task lifetime, repeated Arrow errors, and time-travel rejection. Organize metadata tests under test/inspect and use the existing metadata batch helper.

Co-authored-by: Codex <codex@openai.com>
@manuzhang
manuzhang force-pushed the codex/add-refs-metadata-table branch from bd8e6c8 to e603e6d Compare November 6, 2026 03:28
Copilot AI balanced review requested due to automatic review settings November 6, 2026 03:28

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@manuzhang
manuzhang marked this pull request as ready for review November 6, 2026 03:35

This branch has not been deployed

No deployments
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