table

package
v0.1.1 Latest Latest
Warning

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

Go to latest
Published: May 26, 2026 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package table provides the FileStoreTable and its path factory.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type FileStoreTable

type FileStoreTable struct {

	// Schema is the table's current schema, loaded at construction time.
	// For schema evolution, use SchemaForID to load a historical schema.
	Schema *schema.TableSchema
	// Paths constructs paths within the table directory (schema/, snapshot/, manifest/, data/).
	Paths *PathFactory
	// IO is the underlying FileIO used to read objects from storage.
	IO fileio.FileIO
	// contains filtered or unexported fields
}

FileStoreTable is the central handle for a Paimon table.

Obtain one via [catalog.Catalog.GetTable] or NewFileStoreTable.

The three exported fields give direct access to the table's metadata:

  • Schema — the latest TableSchema, loaded eagerly at construction time.
  • Paths — constructs well-formed paths within the table directory.
  • IO — the FileIO implementation used to read from storage.

FileStoreTable is not safe for concurrent mutation, but concurrent reads are fine because all exported methods are read-only after construction.

func NewFileStoreTable

func NewFileStoreTable(ctx context.Context, tableRoot string, fio fileio.FileIO) (*FileStoreTable, error)

NewFileStoreTable opens a Paimon table at the given root path.

ctx is used only during construction to fetch the latest schema file; it is not retained afterwards. Pass a context with an appropriate deadline if the storage backend is remote.

Returns an error if the latest schema cannot be read (e.g. the path does not exist or the caller lacks permissions).

func (*FileStoreTable) DataFilePath

func (t *FileStoreTable) DataFilePath(partition *binaryrow.BinaryRow, partFields []schema.DataField, bucket int, fileName string) string

DataFilePath builds an absolute data file path (satisfies read.tableReader interface).

func (*FileStoreTable) GetIO

func (t *FileStoreTable) GetIO() fileio.FileIO

GetIO returns the FileIO (satisfies read.tableReader interface).

func (*FileStoreTable) GetSchema

func (t *FileStoreTable) GetSchema() *schema.TableSchema

GetSchema returns the current table schema (satisfies read.tableReader interface).

func (*FileStoreTable) LatestSnapshot

func (t *FileStoreTable) LatestSnapshot(ctx context.Context) (*snapshot.Snapshot, error)

LatestSnapshot returns the most recent snapshot.

func (*FileStoreTable) ListSnapshotIDs

func (t *FileStoreTable) ListSnapshotIDs(ctx context.Context) ([]int64, error)

ListSnapshotIDs returns all available snapshot IDs in ascending order (satisfies read.tableReader interface).

func (*FileStoreTable) ManifestDir

func (t *FileStoreTable) ManifestDir() string

ManifestDir returns the manifest directory path (satisfies read.tableReader interface).

func (*FileStoreTable) SchemaForID

func (t *FileStoreTable) SchemaForID(ctx context.Context, id int64) (*schema.TableSchema, error)

SchemaForID returns the table schema for a specific schema ID. If id matches the current schema it is returned from the in-memory cache without any I/O. Use this for schema-evolution scenarios where a data file was written under a different schema than the current one.

func (*FileStoreTable) SnapshotByID

func (t *FileStoreTable) SnapshotByID(ctx context.Context, id int64) (*snapshot.Snapshot, error)

SnapshotByID returns the snapshot for a specific ID (satisfies read.tableReader interface).

type PathFactory

type PathFactory struct {
	// contains filtered or unexported fields
}

PathFactory constructs paths within a Paimon table directory.

func NewPathFactory

func NewPathFactory(root string) *PathFactory

NewPathFactory creates a PathFactory for the given table root path.

func (*PathFactory) DataFilePath

func (p *PathFactory) DataFilePath(
	partition *binaryrow.BinaryRow,
	partFields []schema.DataField,
	bucket int,
	fileName string,
) string

DataFilePath builds the absolute path for a data file.

Layout: <root>/[partKey=val/.../]bucket-<N>/<fileName>

The manifest stores only the bare filename; the full path must be reconstructed from the partition BinaryRow, partition field definitions, bucket number, and filename.

func (*PathFactory) ManifestDir

func (p *PathFactory) ManifestDir() string

ManifestDir returns the path to the manifest/ directory.

func (*PathFactory) Root

func (p *PathFactory) Root() string

Root returns the table root path.

func (*PathFactory) SchemaDir

func (p *PathFactory) SchemaDir() string

SchemaDir returns the path to the schema/ directory.

func (*PathFactory) SnapshotDir

func (p *PathFactory) SnapshotDir() string

SnapshotDir returns the path to the snapshot/ directory.

Jump to

Keyboard shortcuts

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