Documentation
¶
Overview ¶
Package paimon provides a Go binding for Apache Paimon Rust.
This binding uses purego and libffi to call into the paimon-c shared library. The pre-built shared library is embedded in the package and automatically loaded at runtime — no manual build step needed.
This package requires CGO because it imports the arrow-go cdata package for Arrow C Data Interface support.
Basic usage:
// Create a catalog with options
catalog, err := paimon.NewCatalog(map[string]string{
"warehouse": "/path/to/warehouse",
})
if err != nil { log.Fatal(err) }
defer catalog.Close()
table, err := catalog.GetTable(paimon.NewIdentifier("default", "my_table"))
if err != nil { log.Fatal(err) }
defer table.Close()
For S3 or OSS warehouses, pass the appropriate credentials:
// S3
catalog, _ := paimon.NewCatalog(map[string]string{
"warehouse": "s3://bucket/warehouse",
"s3.access-key-id": "...",
"s3.secret-access-key": "...",
"s3.region": "us-east-1",
})
// OSS
catalog, _ := paimon.NewCatalog(map[string]string{
"warehouse": "oss://bucket/warehouse",
"fs.oss.accessKeyId": "...",
"fs.oss.accessKeySecret": "...",
"fs.oss.endpoint": "oss-cn-hangzhou.aliyuncs.com",
})
Index ¶
- Variables
- func StringBlobMapDescriptors(column arrow.Array, row int) (map[string][]byte, error)
- type BlobReader
- type BlobStream
- type Bytes
- type Catalog
- func (c *Catalog) Close()
- func (c *Catalog) CreateTag(id Identifier, tagName string, snapshotID *int64, ignoreIfExists bool) error
- func (c *Catalog) DeleteTag(id Identifier, tagName string) error
- func (c *Catalog) GetTable(id Identifier) (*Table, error)
- func (c *Catalog) GetTag(id Identifier, tagName string) (GetTagResponse, error)
- type CommitKind
- type CommitMessages
- type DataSplit
- type Date
- type Datum
- type Decimal
- type Error
- type ErrorCode
- type FFI
- type GetTagResponse
- type Identifier
- type LocalZonedTimestamp
- type Plan
- type PostponeFixedBucketCommitMessages
- type PostponeFixedBucketTableCommit
- func (tc *PostponeFixedBucketTableCommit) Abort(messages *PostponeFixedBucketCommitMessages) error
- func (tc *PostponeFixedBucketTableCommit) Close()
- func (tc *PostponeFixedBucketTableCommit) Commit(messages *PostponeFixedBucketCommitMessages) error
- func (tc *PostponeFixedBucketTableCommit) CommitWithIdentifier(messages *PostponeFixedBucketCommitMessages, commitIdentifier int64) error
- func (tc *PostponeFixedBucketTableCommit) FilterAndCommitWithIdentifier(messages *PostponeFixedBucketCommitMessages, commitIdentifier int64) error
- func (tc *PostponeFixedBucketTableCommit) TruncateTable() error
- func (tc *PostponeFixedBucketTableCommit) TruncateTableWithIdentifier(commitIdentifier int64) error
- type PostponeFixedBucketTableWrite
- type PostponeFixedBucketWriteBuilder
- func (wb *PostponeFixedBucketWriteBuilder) Close()
- func (wb *PostponeFixedBucketWriteBuilder) NewCommit() (*PostponeFixedBucketTableCommit, error)
- func (wb *PostponeFixedBucketWriteBuilder) NewWrite() (*PostponeFixedBucketTableWrite, error)
- func (wb *PostponeFixedBucketWriteBuilder) WithBucketPlan(plan arrow.Record) error
- func (wb *PostponeFixedBucketWriteBuilder) WithOverwrite() error
- type Predicate
- type PredicateBuilder
- func (pb *PredicateBuilder) Eq(column string, value any) (*Predicate, error)
- func (pb *PredicateBuilder) Ge(column string, value any) (*Predicate, error)
- func (pb *PredicateBuilder) Gt(column string, value any) (*Predicate, error)
- func (pb *PredicateBuilder) In(column string, values ...any) (*Predicate, error)
- func (pb *PredicateBuilder) IsNotNull(column string) (*Predicate, error)
- func (pb *PredicateBuilder) IsNull(column string) (*Predicate, error)
- func (pb *PredicateBuilder) Le(column string, value any) (*Predicate, error)
- func (pb *PredicateBuilder) Lt(column string, value any) (*Predicate, error)
- func (pb *PredicateBuilder) NotEq(column string, value any) (*Predicate, error)
- func (pb *PredicateBuilder) NotIn(column string, values ...any) (*Predicate, error)
- func (pb *PredicateBuilder) WithCaseSensitive(caseSensitive bool) *PredicateBuilder
- type ReadBuilder
- func (rb *ReadBuilder) Close()
- func (rb *ReadBuilder) NewRead() (*TableRead, error)
- func (rb *ReadBuilder) NewScan() (*TableScan, error)
- func (rb *ReadBuilder) WithCaseSensitive(caseSensitive bool) error
- func (rb *ReadBuilder) WithFilter(p *Predicate) error
- func (rb *ReadBuilder) WithProjection(columns []string) error
- type RecordBatchReader
- type Snapshot
- type Table
- func (t *Table) Close()
- func (t *Table) LatestSnapshot() (*Snapshot, error)
- func (t *Table) NewBlobReader() (*BlobReader, error)
- func (t *Table) NewPostponeFixedBucketWriteBuilder() (*PostponeFixedBucketWriteBuilder, error)
- func (t *Table) NewPostponeFixedBucketWriteBuilderWithCommitUser(commitUser string) (*PostponeFixedBucketWriteBuilder, error)
- func (t *Table) NewReadBuilder() (*ReadBuilder, error)
- func (t *Table) NewReadBuilderWithOptions(options map[string]string) (*ReadBuilder, error)
- func (t *Table) NewWriteBuilder() (*WriteBuilder, error)
- func (t *Table) NewWriteBuilderWithCommitUser(commitUser string) (*WriteBuilder, error)
- func (t *Table) PredicateBuilder() *PredicateBuilder
- type TableCommit
- func (tc *TableCommit) Abort(messages *CommitMessages) error
- func (tc *TableCommit) Close()
- func (tc *TableCommit) Commit(messages *CommitMessages) error
- func (tc *TableCommit) CommitWithIdentifier(messages *CommitMessages, commitIdentifier int64) error
- func (tc *TableCommit) FilterAndCommitWithIdentifier(messages *CommitMessages, commitIdentifier int64) error
- func (tc *TableCommit) TruncateTable() error
- func (tc *TableCommit) TruncateTableWithIdentifier(commitIdentifier int64) error
- type TableRead
- type TableScan
- type TableWrite
- type Time
- type Timestamp
- type WriteBuilder
Constants ¶
This section is empty.
Variables ¶
var ErrClosed = errors.New("paimon: use of closed resource")
ErrClosed is returned when an operation is attempted on a closed resource.
Functions ¶
Types ¶
type BlobReader ¶ added in v0.4.0
type BlobReader struct {
// contains filtered or unexported fields
}
BlobReader resolves serialized BlobDescriptors.
func NewBlobReader ¶ added in v0.4.0
func NewBlobReader(storageOptions map[string]string) (*BlobReader, error)
NewBlobReader creates a descriptor reader with FileIO options.
func (*BlobReader) Close ¶ added in v0.4.0
func (r *BlobReader) Close()
Close releases the reader and is idempotent.
func (*BlobReader) OpenBlob ¶ added in v0.4.0
func (r *BlobReader) OpenBlob(descriptor []byte) (*BlobStream, error)
OpenBlob opens one descriptor without reading its contents.
type BlobStream ¶ added in v0.4.0
type BlobStream struct {
// contains filtered or unexported fields
}
BlobStream incrementally reads one BlobDescriptor.
func (*BlobStream) Close ¶ added in v0.4.0
func (s *BlobStream) Close() error
Close releases the stream and is idempotent.
type Bytes ¶
type Bytes []byte
Bytes represents a binary value. Usage: pb.Eq("data", paimon.Bytes(someSlice))
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
Catalog wraps a paimon Catalog.
func NewCatalog ¶
NewCatalog creates a new Catalog using the CatalogFactory with the given options. The catalog type is determined by the "metastore" option (default: "filesystem").
Common options:
- "warehouse": The warehouse path (required)
- "metastore": Catalog type - "filesystem" (default) or "rest"
- "uri": REST catalog server URI (required for REST catalog)
- "s3.access-key-id", "s3.secret-access-key", "s3.region": S3 credentials
- "fs.oss.accessKeyId", "fs.oss.accessKeySecret", "fs.oss.endpoint": OSS credentials
func (*Catalog) Close ¶
func (c *Catalog) Close()
Close releases the catalog resources. Safe to call multiple times.
func (*Catalog) CreateTag ¶ added in v0.4.0
func (c *Catalog) CreateTag( id Identifier, tagName string, snapshotID *int64, ignoreIfExists bool, ) error
CreateTag creates a tag for snapshotID, or the latest snapshot when snapshotID is nil.
func (*Catalog) DeleteTag ¶ added in v0.4.0
func (c *Catalog) DeleteTag(id Identifier, tagName string) error
DeleteTag deletes a tag.
func (*Catalog) GetTable ¶
func (c *Catalog) GetTable(id Identifier) (*Table, error)
GetTable retrieves a table from the catalog using the given identifier.
func (*Catalog) GetTag ¶ added in v0.4.0
func (c *Catalog) GetTag(id Identifier, tagName string) (GetTagResponse, error)
GetTag returns a tag and its snapshot metadata.
type CommitKind ¶ added in v0.4.0
type CommitKind string
CommitKind identifies the change represented by a snapshot.
const ( CommitKindAppend CommitKind = "APPEND" CommitKindCompact CommitKind = "COMPACT" CommitKindOverwrite CommitKind = "OVERWRITE" CommitKindAnalyze CommitKind = "ANALYZE" )
type CommitMessages ¶ added in v0.4.0
type CommitMessages struct {
// contains filtered or unexported fields
}
CommitMessages contains the files produced by one or more writers. It is a process-local native handle and cannot be transferred between processes.
func (*CommitMessages) Close ¶ added in v0.4.0
func (m *CommitMessages) Close()
Close releases the commit messages. Safe to call multiple times.
func (*CommitMessages) Merge ¶ added in v0.4.0
func (m *CommitMessages) Merge(source *CommitMessages) error
Merge appends a copy of source's messages; both handles stay valid and must share a table and commit user. It does not establish fixed-bucket ownership.
type DataSplit ¶
type DataSplit struct {
// contains filtered or unexported fields
}
DataSplit identifies a single data split within a plan. DataSplits keep the underlying plan data alive via GC-attached reference counting, so they are safe to use independently.
type Date ¶
type Date int32
Date represents a date value as epoch days since 1970-01-01. Usage: pb.Eq("dt", paimon.Date(19000))
type Datum ¶
type Datum struct {
// contains filtered or unexported fields
}
Datum is a typed literal value for predicate comparison. The internal representation is hidden to allow future changes (e.g. switching to opaque handles) without breaking callers.
type Decimal ¶
type Decimal struct {
Lo int64 // low 64 bits of unscaled i128 (unsigned interpretation)
Hi int64 // high 64 bits of unscaled i128 (sign extension)
Precision uint32
Scale uint32
}
Decimal represents a fixed-precision decimal value up to DECIMAL(38, s).
The unscaled value is stored as a little-endian i128 split into two int64 halves: Lo (low 64 bits, unsigned interpretation) and Hi (high 64 bits, sign-extended). For values that fit in int64, use NewDecimal.
Usage:
paimon.NewDecimal(12345, 10, 2) // 123.45 as DECIMAL(10,2)
paimon.Decimal{Lo: lo, Hi: hi, ...} // full i128
func NewDecimal ¶
NewDecimal creates a Decimal from an int64 unscaled value. For unscaled values that exceed int64 range, construct Decimal directly with Lo/Hi fields.
type Error ¶
type Error struct {
// contains filtered or unexported fields
}
Error represents a paimon error with code and message.
type FFI ¶
type FFI[T any] struct { // contains filtered or unexported fields }
FFI is a generic type-safe wrapper for a foreign function.
type GetTagResponse ¶ added in v0.4.0
type GetTagResponse struct {
TagName string `json:"tagName"`
Snapshot Snapshot `json:"snapshot"`
TagCreateTime *int64 `json:"tagCreateTime,omitempty"`
TagTimeRetained *string `json:"tagTimeRetained,omitempty"`
}
GetTagResponse contains a tag and its snapshot metadata.
type Identifier ¶
type Identifier struct {
// contains filtered or unexported fields
}
Identifier identifies a table by database and object name.
func NewIdentifier ¶
func NewIdentifier(database, object string) Identifier
NewIdentifier creates a new Identifier with the given database and object name.
type LocalZonedTimestamp ¶
LocalZonedTimestamp represents a timestamp with local timezone semantics. Usage: pb.Eq("lzts", paimon.LocalZonedTimestamp{Millis: 1700000000000, Nanos: 0})
type Plan ¶
type Plan struct {
// contains filtered or unexported fields
}
Plan holds the result of a table scan, containing data splits to read.
func (*Plan) Close ¶
func (p *Plan) Close()
Close releases the plan resources. Safe to call multiple times. DataSplits obtained from Splits() remain valid after Close.
type PostponeFixedBucketCommitMessages ¶ added in v0.4.0
type PostponeFixedBucketCommitMessages struct {
// contains filtered or unexported fields
}
PostponeFixedBucketCommitMessages contains files produced by fixed-bucket writers. It is a process-local native handle and cannot be transferred between processes or passed to a standard TableCommit.
func (*PostponeFixedBucketCommitMessages) Close ¶ added in v0.4.0
func (m *PostponeFixedBucketCommitMessages) Close()
Close releases the messages. Safe to call multiple times.
func (*PostponeFixedBucketCommitMessages) Merge ¶ added in v0.4.0
func (m *PostponeFixedBucketCommitMessages) Merge( source *PostponeFixedBucketCommitMessages, ) error
Merge appends a copy of source's messages. Both handles must belong to the same process, and both builders must use the same table, commit user, and overwrite mode.
type PostponeFixedBucketTableCommit ¶ added in v0.4.0
type PostponeFixedBucketTableCommit struct {
// contains filtered or unexported fields
}
PostponeFixedBucketTableCommit commits fixed-bucket messages using the mode selected on its builder.
func (*PostponeFixedBucketTableCommit) Abort ¶ added in v0.4.0
func (tc *PostponeFixedBucketTableCommit) Abort( messages *PostponeFixedBucketCommitMessages, ) error
Abort performs best-effort cleanup of files in prepared messages.
func (*PostponeFixedBucketTableCommit) Close ¶ added in v0.4.0
func (tc *PostponeFixedBucketTableCommit) Close()
Close releases the committer resources. Safe to call multiple times.
func (*PostponeFixedBucketTableCommit) Commit ¶ added in v0.4.0
func (tc *PostponeFixedBucketTableCommit) Commit( messages *PostponeFixedBucketCommitMessages, ) error
Commit persists fixed-bucket messages using the builder's append or overwrite mode.
func (*PostponeFixedBucketTableCommit) CommitWithIdentifier ¶ added in v0.4.0
func (tc *PostponeFixedBucketTableCommit) CommitWithIdentifier( messages *PostponeFixedBucketCommitMessages, commitIdentifier int64, ) error
CommitWithIdentifier commits with a stable identifier.
func (*PostponeFixedBucketTableCommit) FilterAndCommitWithIdentifier ¶ added in v0.4.0
func (tc *PostponeFixedBucketTableCommit) FilterAndCommitWithIdentifier( messages *PostponeFixedBucketCommitMessages, commitIdentifier int64, ) error
FilterAndCommitWithIdentifier makes a retry idempotent.
func (*PostponeFixedBucketTableCommit) TruncateTable ¶ added in v0.4.0
func (tc *PostponeFixedBucketTableCommit) TruncateTable() error
TruncateTable removes all table data.
func (*PostponeFixedBucketTableCommit) TruncateTableWithIdentifier ¶ added in v0.4.0
func (tc *PostponeFixedBucketTableCommit) TruncateTableWithIdentifier( commitIdentifier int64, ) error
TruncateTableWithIdentifier removes all table data with a stable identifier.
type PostponeFixedBucketTableWrite ¶ added in v0.4.0
type PostponeFixedBucketTableWrite struct {
// contains filtered or unexported fields
}
PostponeFixedBucketTableWrite writes rows according to a resolved bucket plan.
func (*PostponeFixedBucketTableWrite) Close ¶ added in v0.4.0
func (tw *PostponeFixedBucketTableWrite) Close()
Close releases the writer resources. Safe to call multiple times.
func (*PostponeFixedBucketTableWrite) PrepareCommit ¶ added in v0.4.0
func (tw *PostponeFixedBucketTableWrite) PrepareCommit() (*PostponeFixedBucketCommitMessages, error)
PrepareCommit finalizes pending writes and returns fixed-bucket messages. It consumes the writer; subsequent operations return ErrClosed.
func (*PostponeFixedBucketTableWrite) WriteArrowBatch ¶ added in v0.4.0
func (tw *PostponeFixedBucketTableWrite) WriteArrowBatch(record arrow.Record) error
WriteArrowBatch writes one Arrow record batch. The caller retains ownership.
type PostponeFixedBucketWriteBuilder ¶ added in v0.4.0
type PostponeFixedBucketWriteBuilder struct {
// contains filtered or unexported fields
}
PostponeFixedBucketWriteBuilder creates fixed-bucket writers for bucket=-2 tables. A resolved bucket plan must be supplied before NewWrite.
func (*PostponeFixedBucketWriteBuilder) Close ¶ added in v0.4.0
func (wb *PostponeFixedBucketWriteBuilder) Close()
Close releases the builder resources. Safe to call multiple times.
func (*PostponeFixedBucketWriteBuilder) NewCommit ¶ added in v0.4.0
func (wb *PostponeFixedBucketWriteBuilder) NewCommit() (*PostponeFixedBucketTableCommit, error)
NewCommit creates a committer using this builder's commit identity and mode.
func (*PostponeFixedBucketWriteBuilder) NewWrite ¶ added in v0.4.0
func (wb *PostponeFixedBucketWriteBuilder) NewWrite() (*PostponeFixedBucketTableWrite, error)
NewWrite creates a fixed-bucket writer. WithBucketPlan must be called first.
func (*PostponeFixedBucketWriteBuilder) WithBucketPlan ¶ added in v0.4.0
func (wb *PostponeFixedBucketWriteBuilder) WithBucketPlan(plan arrow.Record) error
WithBucketPlan sets a resolved partition-to-bucket-count plan. The plan must contain the table partition columns followed by a non-null Int32 total_buckets column. The caller retains ownership of plan.
func (*PostponeFixedBucketWriteBuilder) WithOverwrite ¶ added in v0.4.0
func (wb *PostponeFixedBucketWriteBuilder) WithOverwrite() error
WithOverwrite enables overwrite mode for both writers and committers created by this builder.
type Predicate ¶
type Predicate struct {
// contains filtered or unexported fields
}
Predicate is an opaque filter predicate for scan planning.
func (*Predicate) And ¶
And combines this predicate with another using AND. Consumes both predicates (callers must NOT close either after this call).
func (*Predicate) Close ¶
func (p *Predicate) Close()
Close releases the predicate resources. Safe to call multiple times. Note: predicates passed to WithFilter or combinators (And/Or/Not) are consumed and should NOT be closed by the caller.
type PredicateBuilder ¶
type PredicateBuilder struct {
// contains filtered or unexported fields
}
PredicateBuilder creates filter predicates for a table. It holds a Go-level reference to the Table and does not own any C resources, so there is no Close() method.
func (*PredicateBuilder) Eq ¶
func (pb *PredicateBuilder) Eq(column string, value any) (*Predicate, error)
Eq creates an equality predicate: column = value.
func (*PredicateBuilder) Ge ¶
func (pb *PredicateBuilder) Ge(column string, value any) (*Predicate, error)
Ge creates a greater-or-equal predicate: column >= value.
func (*PredicateBuilder) Gt ¶
func (pb *PredicateBuilder) Gt(column string, value any) (*Predicate, error)
Gt creates a greater-than predicate: column > value.
func (*PredicateBuilder) In ¶
func (pb *PredicateBuilder) In(column string, values ...any) (*Predicate, error)
In creates an IN predicate: column IN (values...).
func (*PredicateBuilder) IsNotNull ¶
func (pb *PredicateBuilder) IsNotNull(column string) (*Predicate, error)
IsNotNull creates an IS NOT NULL predicate.
func (*PredicateBuilder) IsNull ¶
func (pb *PredicateBuilder) IsNull(column string) (*Predicate, error)
IsNull creates an IS NULL predicate.
func (*PredicateBuilder) Le ¶
func (pb *PredicateBuilder) Le(column string, value any) (*Predicate, error)
Le creates a less-or-equal predicate: column <= value.
func (*PredicateBuilder) Lt ¶
func (pb *PredicateBuilder) Lt(column string, value any) (*Predicate, error)
Lt creates a less-than predicate: column < value.
func (*PredicateBuilder) NotEq ¶
func (pb *PredicateBuilder) NotEq(column string, value any) (*Predicate, error)
NotEq creates a not-equal predicate: column != value.
func (*PredicateBuilder) NotIn ¶
func (pb *PredicateBuilder) NotIn(column string, values ...any) (*Predicate, error)
NotIn creates a NOT IN predicate: column NOT IN (values...).
func (*PredicateBuilder) WithCaseSensitive ¶ added in v0.4.0
func (pb *PredicateBuilder) WithCaseSensitive(caseSensitive bool) *PredicateBuilder
WithCaseSensitive returns a builder that matches column names by ASCII case folding when caseSensitive is false, rejecting a name that folds onto two schema columns as ambiguous. The default is true (exact match); the receiver is left unchanged.
The choice is fixed when each predicate is built, because that is when the core resolves the column. ReadBuilder.WithCaseSensitive is the same switch for projection and has no bearing on a predicate built here.
type ReadBuilder ¶
type ReadBuilder struct {
// contains filtered or unexported fields
}
ReadBuilder creates TableScan and TableRead instances.
func (*ReadBuilder) Close ¶
func (rb *ReadBuilder) Close()
Close releases the read builder resources. Safe to call multiple times.
func (*ReadBuilder) NewRead ¶
func (rb *ReadBuilder) NewRead() (*TableRead, error)
NewRead creates a TableRead for reading data from splits.
func (*ReadBuilder) NewScan ¶
func (rb *ReadBuilder) NewScan() (*TableScan, error)
NewScan creates a TableScan for planning which data files to read.
func (*ReadBuilder) WithCaseSensitive ¶ added in v0.4.0
func (rb *ReadBuilder) WithCaseSensitive(caseSensitive bool) error
WithCaseSensitive sets whether the names given to WithProjection must match the schema exactly. The default is true. With false, names are matched by ASCII case folding, and a name that folds onto two different schema columns is rejected as ambiguous. Either way the returned records carry the schema's own spelling, not the requested one.
This does not affect predicates. A predicate resolves its column when it is built, so its case sensitivity comes from the builder that produced it — see PredicateBuilder.WithCaseSensitive — and is unaffected by this setting. Call order relative to WithProjection does not matter: projection names are resolved in NewRead.
func (*ReadBuilder) WithFilter ¶
func (rb *ReadBuilder) WithFilter(p *Predicate) error
WithFilter sets a filter predicate for scan planning and read-side pruning.
The predicate is used in two phases:
- Scan planning: prunes partitions, buckets, and data files based on file-level statistics (min/max). This is conservative — files whose statistics are inconclusive are kept.
- Read-side: applies row-level filtering via Parquet native row filters for supported leaf predicates (Eq, NotEq, Lt, Le, Gt, Ge, IsNull, IsNotNull, In, NotIn).
Row-level filtering is exact for most common types (Bool, Int, Long, Float, Double, String, Date, Decimal, Binary). However, the following cases are NOT filtered at the row level and may return non-matching rows:
- Compound predicates (And/Or/Not) — not yet implemented for row-level filtering.
- Time, Timestamp, and LocalZonedTimestamp columns (not yet implemented).
- Schema-evolution: the predicate column does not exist in older data files.
- Data-evolution mode (data-evolution.enabled = true).
In these cases callers should apply residual filtering on the returned records.
The predicate is consumed (ownership transferred to the read builder); the caller must NOT close it after this call. Passing nil is a no-op.
func (*ReadBuilder) WithProjection ¶
func (rb *ReadBuilder) WithProjection(columns []string) error
WithProjection sets column projection by name. Output order follows the caller-specified order. A name that matches no schema column under any case sensitivity is rejected immediately; case-dependent errors and duplicate names cause NewRead() to fail. An empty list is a valid zero-column projection.
type RecordBatchReader ¶
type RecordBatchReader struct {
// contains filtered or unexported fields
}
RecordBatchReader iterates over Arrow record batches one at a time via the Arrow C Data Interface (zero-copy). Call NextRecord to advance and Close when done.
func (*RecordBatchReader) Close ¶
func (r *RecordBatchReader) Close()
Close releases the underlying C record batch readers. Safe to call multiple times and concurrently with NextRecord.
func (*RecordBatchReader) NextRecord ¶
func (r *RecordBatchReader) NextRecord() (arrow.Record, error)
NextRecord returns the next Arrow record, or io.EOF when iteration is complete. The underlying C batch is imported via the Arrow C Data Interface and released automatically — the caller only needs to call Release on the returned arrow.Record when done. Calls on one reader are serialized; use separate readers for parallel reads.
type Snapshot ¶ added in v0.4.0
type Snapshot struct {
ID int64 `json:"id"`
CommitKind CommitKind `json:"commitKind"`
TimeMillis int64 `json:"timeMillis"`
TotalRecordCount *int64 `json:"totalRecordCount,omitempty"`
DeltaRecordCount *int64 `json:"deltaRecordCount,omitempty"`
}
Snapshot describes a Paimon table snapshot.
type Table ¶
type Table struct {
// contains filtered or unexported fields
}
Table represents a paimon table.
func (*Table) Close ¶
func (t *Table) Close()
Close releases the table resources. Safe to call multiple times.
func (*Table) LatestSnapshot ¶ added in v0.4.0
LatestSnapshot returns the latest snapshot, or nil when the table is empty.
func (*Table) NewBlobReader ¶ added in v0.4.0
func (t *Table) NewBlobReader() (*BlobReader, error)
NewBlobReader creates a descriptor reader using this table's FileIO.
func (*Table) NewPostponeFixedBucketWriteBuilder ¶ added in v0.4.0
func (t *Table) NewPostponeFixedBucketWriteBuilder() (*PostponeFixedBucketWriteBuilder, error)
NewPostponeFixedBucketWriteBuilder creates an explicitly selected fixed-bucket builder for a postpone table.
func (*Table) NewPostponeFixedBucketWriteBuilderWithCommitUser ¶ added in v0.4.0
func (t *Table) NewPostponeFixedBucketWriteBuilderWithCommitUser( commitUser string, ) (*PostponeFixedBucketWriteBuilder, error)
NewPostponeFixedBucketWriteBuilderWithCommitUser creates a fixed-bucket builder with a stable commit identity.
func (*Table) NewReadBuilder ¶
func (t *Table) NewReadBuilder() (*ReadBuilder, error)
NewReadBuilder creates a ReadBuilder for this table.
func (*Table) NewReadBuilderWithOptions ¶ added in v0.4.0
func (t *Table) NewReadBuilderWithOptions(options map[string]string) (*ReadBuilder, error)
NewReadBuilderWithOptions creates a ReadBuilder with per-read options.
func (*Table) NewWriteBuilder ¶ added in v0.4.0
func (t *Table) NewWriteBuilder() (*WriteBuilder, error)
NewWriteBuilder creates a write builder with a generated commit identity.
func (*Table) NewWriteBuilderWithCommitUser ¶ added in v0.4.0
func (t *Table) NewWriteBuilderWithCommitUser(commitUser string) (*WriteBuilder, error)
NewWriteBuilderWithCommitUser creates a write builder with a stable commit identity for merging messages across writers and for identifier retries.
func (*Table) PredicateBuilder ¶
func (t *Table) PredicateBuilder() *PredicateBuilder
PredicateBuilder returns a builder for creating filter predicates on this table.
type TableCommit ¶ added in v0.4.0
type TableCommit struct {
// contains filtered or unexported fields
}
TableCommit persists or aborts prepared commit messages.
func (*TableCommit) Abort ¶ added in v0.4.0
func (tc *TableCommit) Abort(messages *CommitMessages) error
Abort performs best-effort cleanup of files created for a prepared commit.
func (*TableCommit) Close ¶ added in v0.4.0
func (tc *TableCommit) Close()
Close releases the committer resources. Safe to call multiple times.
func (*TableCommit) Commit ¶ added in v0.4.0
func (tc *TableCommit) Commit(messages *CommitMessages) error
Commit persists messages using the builder's append or overwrite mode.
func (*TableCommit) CommitWithIdentifier ¶ added in v0.4.0
func (tc *TableCommit) CommitWithIdentifier(messages *CommitMessages, commitIdentifier int64) error
CommitWithIdentifier commits with a monotonically increasing identifier.
func (*TableCommit) FilterAndCommitWithIdentifier ¶ added in v0.4.0
func (tc *TableCommit) FilterAndCommitWithIdentifier( messages *CommitMessages, commitIdentifier int64, ) error
FilterAndCommitWithIdentifier skips messages already committed under commitIdentifier, making retries idempotent. Identifier commits always filter in overwrite mode.
func (*TableCommit) TruncateTable ¶ added in v0.4.0
func (tc *TableCommit) TruncateTable() error
TruncateTable removes all table data.
func (*TableCommit) TruncateTableWithIdentifier ¶ added in v0.4.0
func (tc *TableCommit) TruncateTableWithIdentifier(commitIdentifier int64) error
TruncateTableWithIdentifier truncates with a stable commit identifier.
type TableRead ¶
type TableRead struct {
// contains filtered or unexported fields
}
TableRead reads data from splits produced by a TableScan.
func (*TableRead) Close ¶
func (tr *TableRead) Close()
Close releases the table read resources. Safe to call multiple times.
func (*TableRead) NewRecordBatchReader ¶
func (tr *TableRead) NewRecordBatchReader(splits []DataSplit) (*RecordBatchReader, error)
NewRecordBatchReader creates a RecordBatchReader that iterates over Arrow record batches for the given data splits. The splits can be non-contiguous and in any order. All splits must originate from the same Plan.
type TableScan ¶
type TableScan struct {
// contains filtered or unexported fields
}
TableScan scans a table and produces a Plan containing data splits.
type TableWrite ¶ added in v0.4.0
type TableWrite struct {
// contains filtered or unexported fields
}
TableWrite accumulates Arrow record batches until PrepareCommit is called.
func (*TableWrite) Close ¶ added in v0.4.0
func (tw *TableWrite) Close()
Close releases the writer resources. Unprepared data is discarded. Safe to call multiple times.
func (*TableWrite) PrepareCommit ¶ added in v0.4.0
func (tw *TableWrite) PrepareCommit() (*CommitMessages, error)
PrepareCommit returns pending writes as commit messages; the writer can be reused.
func (*TableWrite) WriteArrowBatch ¶ added in v0.4.0
func (tw *TableWrite) WriteArrowBatch(record arrow.Record) error
WriteArrowBatch writes one record batch whose schema must match the table schema. The record remains owned by the caller.
type Time ¶
type Time int32
Time represents a time-of-day value as milliseconds since midnight. Usage: pb.Eq("t", paimon.Time(3600000))
type Timestamp ¶
Timestamp represents a timestamp without timezone (millis + sub-millis nanos). Usage: pb.Eq("ts", paimon.Timestamp{Millis: 1700000000000, Nanos: 0})
type WriteBuilder ¶ added in v0.4.0
type WriteBuilder struct {
// contains filtered or unexported fields
}
WriteBuilder creates writers and committers that share one commit identity.
func (*WriteBuilder) Close ¶ added in v0.4.0
func (wb *WriteBuilder) Close()
Close releases the write builder resources. Safe to call multiple times.
func (*WriteBuilder) NewCommit ¶ added in v0.4.0
func (wb *WriteBuilder) NewCommit() (*TableCommit, error)
NewCommit creates a committer that shares this builder's identity and mode.
func (*WriteBuilder) NewWrite ¶ added in v0.4.0
func (wb *WriteBuilder) NewWrite() (*TableWrite, error)
NewWrite creates a writer that accumulates Arrow record batches.
func (*WriteBuilder) WithOverwrite ¶ added in v0.4.0
func (wb *WriteBuilder) WithOverwrite() error
WithOverwrite enables overwrite mode for this builder's writers and committers.