inspect

package
v0.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 23, 2026 License: Apache-2.0 Imports: 21 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package inspect exposes a table's metadata (snapshots, history, manifests, files, and so on) as queryable Arrow tables. It mirrors the metadata tables offered by the Java, PyIceberg, and Rust clients.

Each metadata table is a free function that takes the table as its second argument, for example:

rr, err := inspect.Snapshots(ctx, tbl, inspect.WithAllocator(mem))

The returned array.RecordReader must be released by the caller.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllDataFiles

func AllDataFiles(ctx context.Context, tbl *table.Table, opts ...Option) (array.RecordReader, error)

AllDataFiles returns the live data files reachable from every snapshot currently tracked by the table.

func AllDataFilesSchema

func AllDataFilesSchema(partitionType *iceberg.StructType) *iceberg.Schema

AllDataFilesSchema returns the schema of the all_data_files metadata table.

func AllDeleteFiles

func AllDeleteFiles(ctx context.Context, tbl *table.Table, opts ...Option) (array.RecordReader, error)

AllDeleteFiles returns the live delete files reachable from every snapshot currently tracked by the table.

func AllDeleteFilesSchema

func AllDeleteFilesSchema(partitionType *iceberg.StructType) *iceberg.Schema

AllDeleteFilesSchema returns the schema of the all_delete_files metadata table.

func AllEntries

func AllEntries(ctx context.Context, tbl *table.Table, opts ...Option) (array.RecordReader, error)

AllEntries returns every entry from each manifest reachable from any snapshot currently tracked by the table. Shared manifests are scanned once, and deleted entries remain visible.

func AllEntriesSchema

func AllEntriesSchema(partitionType *iceberg.StructType) *iceberg.Schema

AllEntriesSchema returns the schema of the all_entries metadata table.

func AllFiles

func AllFiles(ctx context.Context, tbl *table.Table, opts ...Option) (array.RecordReader, error)

AllFiles returns the live data and delete files reachable from every snapshot currently tracked by the table. Shared manifests are scanned once, while duplicate file rows from different manifests are preserved.

func AllFilesSchema

func AllFilesSchema(partitionType *iceberg.StructType) *iceberg.Schema

AllFilesSchema returns the schema of the all_files metadata table.

func AllManifests

func AllManifests(ctx context.Context, tbl *table.Table, opts ...Option) (array.RecordReader, error)

AllManifests returns every manifest referenced by every snapshot currently tracked by the table. A manifest referenced by multiple snapshots produces one row per reference, identified by reference_snapshot_id. Results are streamed in bounded record batches while each snapshot's manifest list is traversed.

func AllManifestsSchema

func AllManifestsSchema() *iceberg.Schema

AllManifestsSchema returns the schema of the all_manifests metadata table.

func DataFiles

func DataFiles(ctx context.Context, tbl *table.Table, opts ...Option) (array.RecordReader, error)

DataFiles returns the live data files in the current snapshot. Deleted manifest entries are omitted, matching the data_files metadata table.

func DataFilesSchema

func DataFilesSchema(partitionType *iceberg.StructType) *iceberg.Schema

DataFilesSchema returns the common content-file schema used by the files metadata tables. The partition field is omitted for an unpartitioned table, as required by the Iceberg metadata-table spec.

func DeleteFiles

func DeleteFiles(ctx context.Context, tbl *table.Table, opts ...Option) (array.RecordReader, error)

DeleteFiles returns the live equality-delete, position-delete, and deletion-vector files in the current snapshot. It reports file metadata and does not open or scan the delete-file contents.

func DeleteFilesSchema

func DeleteFilesSchema(partitionType *iceberg.StructType) *iceberg.Schema

DeleteFilesSchema returns the content-file schema used by the delete_files metadata table. It is shared with DataFilesSchema so both tables expose the same partition-evolution and nested metric semantics.

func Entries

func Entries(ctx context.Context, tbl *table.Table, opts ...Option) (array.RecordReader, error)

Entries returns every manifest entry in the current snapshot, including entries marked deleted. This exposes commit history that data_files and delete_files intentionally hide.

func EntriesSchema

func EntriesSchema(partitionType *iceberg.StructType) *iceberg.Schema

EntriesSchema returns the schema of the entries metadata table.

func Files

func Files(ctx context.Context, tbl *table.Table, opts ...Option) (array.RecordReader, error)

Files returns all live data and delete files in the current snapshot. Deleted manifest entries are omitted.

func FilesSchema

func FilesSchema(partitionType *iceberg.StructType) *iceberg.Schema

FilesSchema returns the schema shared by the files metadata tables.

func History

func History(ctx context.Context, tbl *table.Table, opts ...Option) (array.RecordReader, error)

History returns the chronological log of every snapshot that was ever the table's current snapshot, one row per snapshot-log entry. Rolled-back snapshots remain visible but are flagged via is_current_ancestor.

Columns:

  • made_current_at (timestamptz, required): when the snapshot became current
  • snapshot_id (long, required): the snapshot that became current
  • parent_id (long, optional): the snapshot's parent, null when the snapshot has no parent or has since been expired
  • is_current_ancestor (boolean, required): whether the snapshot is an ancestor of the current snapshot; false for rolled-back snapshots

is_current_ancestor is derived by walking the current snapshot's parent chain. If an intermediate ancestor has been expired (removed from the snapshot list), that walk is truncated and snapshots below the gap are reported as non-ancestors. Well-formed tables never hit this: ExpireSnapshots keeps the current snapshot and its full ancestry intact. This matches the silent-truncation behavior of the Java, PyIceberg, and Rust clients.

The returned reader holds a single record batch. The caller must Release it.

func HistorySchema

func HistorySchema() *iceberg.Schema

HistorySchema returns the Iceberg schema of the history metadata table. The field IDs are fixed by the Iceberg metadata-tables spec and match the Java, PyIceberg, and Rust clients for cross-client parity. A fresh schema value is returned on each call; callers must not mutate it or rely on pointer identity.

func Manifests

func Manifests(ctx context.Context, tbl *table.Table, opts ...Option) (array.RecordReader, error)

Manifests returns one row for each manifest in the current snapshot. Partition summaries are exposed as the human-readable values used by the other Iceberg clients.

func ManifestsSchema

func ManifestsSchema() *iceberg.Schema

ManifestsSchema returns the Iceberg schema of the manifests metadata table.

func MetadataLogEntries

func MetadataLogEntries(ctx context.Context, tbl *table.Table, opts ...Option) (array.RecordReader, error)

MetadataLogEntries returns one row for every metadata file in the table's metadata log, plus the current metadata file when its location is set. Snapshot information is resolved from the snapshot log at each metadata file's timestamp.

Columns:

  • timestamp (timestamptz, required): when the metadata file was written
  • file (string, required): metadata file location
  • latest_snapshot_id (long, optional): latest snapshot visible then
  • latest_schema_id (int, optional): schema used by that snapshot
  • latest_sequence_number (long, optional): sequence number of that snapshot

The returned reader holds a single record batch. The caller must Release it.

func MetadataLogEntriesSchema

func MetadataLogEntriesSchema() *iceberg.Schema

MetadataLogEntriesSchema returns a fresh Iceberg schema for the metadata-log-entries metadata table. The field IDs and names match Java's implementation; callers should not rely on pointer identity.

func Partitions

func Partitions(ctx context.Context, tbl *table.Table, opts ...Option) (array.RecordReader, error)

Partitions returns one row per live partition, aggregating data and delete files from the current snapshot. Files from evolved specs are coerced into the table-wide partition type before grouping.

func PartitionsSchema

func PartitionsSchema(partitionType *iceberg.StructType) *iceberg.Schema

PartitionsSchema returns the partition metadata-table schema. For an unpartitioned table the partition and spec_id columns are omitted, matching Java's PartitionsTable behavior.

func PositionDeletes

func PositionDeletes(ctx context.Context, tbl *table.Table, opts ...Option) (array.RecordReader, error)

PositionDeletes returns the individual position-delete records referenced by the current snapshot. Parquet position-delete files and V3 deletion vectors are exposed through the same schema.

func PositionDeletesSchema

func PositionDeletesSchema(
	tableSchema *iceberg.Schema,
	partitionType *iceberg.StructType,
	formatVersion int,
) *iceberg.Schema

PositionDeletesSchema returns the schema of the position_deletes metadata table.

func Refs

func Refs(ctx context.Context, tbl *table.Table, opts ...Option) (array.RecordReader, error)

Refs returns one row per snapshot reference known to the table. Reference names are sorted to make the result deterministic even though table metadata stores refs in a map.

Columns:

  • name (string, required): the branch or tag name
  • type (string, required): BRANCH or TAG
  • snapshot_id (long, required): the referenced snapshot
  • max_reference_age_in_ms (long, optional): tag/branch reference retention
  • min_snapshots_to_keep (int, optional): branch snapshot retention
  • max_snapshot_age_in_ms (long, optional): branch snapshot retention

The returned reader holds a single record batch. The caller must Release it.

func RefsSchema

func RefsSchema() *iceberg.Schema

RefsSchema returns a fresh Iceberg schema for the refs metadata table. The field IDs and names match Java's RefsTable for cross-client parity; callers should not rely on pointer identity.

func Snapshots

func Snapshots(ctx context.Context, tbl *table.Table, opts ...Option) (array.RecordReader, error)

Snapshots returns one row per snapshot known to the table, in the order they are stored in metadata.

Columns:

  • committed_at (timestamptz, required): when the snapshot was committed
  • snapshot_id (long, required): the snapshot id
  • parent_id (long, optional): the parent snapshot id, null for a root
  • operation (string, optional): the snapshot summary operation, null when the snapshot carries no summary
  • manifest_list (string, optional): path to the snapshot's manifest list
  • summary (map<string,string>, optional): the stored snapshot summary, including the "operation" key alongside its additional properties; null when the snapshot carries no summary

The returned reader holds a single record batch. The caller must Release it.

func SnapshotsSchema

func SnapshotsSchema() *iceberg.Schema

SnapshotsSchema returns the Iceberg schema of the snapshots metadata table. The field IDs are fixed by the Iceberg metadata-tables spec and match the Java, PyIceberg, and Rust clients for cross-client parity. A fresh schema value is returned on each call; callers must not mutate it or rely on pointer identity.

The summary map's values are optional, matching PyIceberg and Rust. Java declares them required; the choice is not observable in practice because snapshot-summary values are always non-null strings.

Types

type Option

type Option func(*inspector)

Option configures how a metadata table is read.

func WithAllocator

func WithAllocator(alloc memory.Allocator) Option

WithAllocator sets the Arrow memory allocator used to build metadata-table records. Tests can pass a memory.CheckedAllocator to detect leaks; callers with memory accounting can inject their own pool. A nil allocator is ignored.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL