Documentation
¶
Overview ¶
Package table provides the FileStoreTable and its path factory.
Index ¶
- type FileStoreTable
- func (t *FileStoreTable) DataFilePath(partition *binaryrow.BinaryRow, partFields []schema.DataField, bucket int, ...) string
- func (t *FileStoreTable) GetIO() fileio.FileIO
- func (t *FileStoreTable) GetSchema() *schema.TableSchema
- func (t *FileStoreTable) LatestSnapshot(ctx context.Context) (*snapshot.Snapshot, error)
- func (t *FileStoreTable) ListSnapshotIDs(ctx context.Context) ([]int64, error)
- func (t *FileStoreTable) ManifestDir() string
- func (t *FileStoreTable) SchemaForID(ctx context.Context, id int64) (*schema.TableSchema, error)
- func (t *FileStoreTable) SnapshotByID(ctx context.Context, id int64) (*snapshot.Snapshot, error)
- type PathFactory
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 ¶
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 ¶
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) 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.