table

package
v0.0.0-...-920a96b Latest Latest
Warning

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

Go to latest
Published: Aug 21, 2023 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const (
	InitialSortOrderID  = 1
	UnsortedSortOrderID = 0
)
View Source
const MainBranch = "main"

Variables

View Source
var (
	ErrInvalidMetadataFormatVersion = errors.New("invalid or missing format-version in table metadata")
	ErrInvalidMetadata              = errors.New("invalid metadata")
)
View Source
var (
	ErrInvalidOperation = errors.New("invalid operation value")
	ErrMissingOperation = errors.New("missing operation key")
)
View Source
var (
	ErrInvalidSortDirection = errors.New("invalid sort direction, must be 'asc' or 'desc'")
	ErrInvalidNullOrder     = errors.New("invalid null order, must be 'nulls-first' or 'nulls-last'")
)
View Source
var (
	ErrInvalidRefType = errors.New("invalid snapshot ref type, should be 'branch' or 'tag'")
)
View Source
var UnsortedSortOrder = SortOrder{OrderID: UnsortedSortOrderID, Fields: []SortField{}}

Functions

This section is empty.

Types

type Catalog

type Catalog interface {
	LoadTable(...string) (*Table, error)
	DropTable(...string) error
	RenameTable(from, to Identifier) (*Table, error)
	CreateNamespace(props icegopher.Properties, namespace ...string) error
	DropNamespace(...string) error
	ListTables(namespace ...string) ([]Identifier, error)
	ListNamespaces(...string) ([]Identifier, error)
	LoadNamespaceProperties(...string) (icegopher.Properties, error)
	UpdateNamespaceProperties(namespace Identifier, removals []string, updates icegopher.Properties) (PropertiesUpdateSummary, error)
}

type Identifier

type Identifier = []string

type Metadata

type Metadata interface {
	Version() int
	TableUUID() uuid.UUID
	Loc() string
	LastUpdated() int
	LastColumn() int
	Schemas() []*icegopher.Schema
	CurrentSchema() *icegopher.Schema
	PartitionSpecs() []icegopher.PartitionSpec
	PartitionSpec() icegopher.PartitionSpec
	DefaultPartitionSpec() int
	LastPartitionSpecID() *int
	Snapshots() []Snapshot
	SnapshotByID(int64) *Snapshot
	SnapshotByName(name string) *Snapshot
	CurrentSnapshot() *Snapshot
	SortOrder() SortOrder
	SortOrders() []SortOrder
	Properties() icegopher.Properties
}

func ParseMetadata

func ParseMetadata(r io.Reader) (Metadata, error)

func ParseMetadataBytes

func ParseMetadataBytes(b []byte) (Metadata, error)

func ParseMetadataString

func ParseMetadataString(s string) (Metadata, error)

type MetadataLogEntry

type MetadataLogEntry struct {
	MetadataFile string `json:"metadata-file"`
	TimestampMs  int    `json:"timestamp-ms"`
}

type MetadataV1

type MetadataV1 struct {
	Schema    icegopher.Schema           `json:"schema"`
	Partition []icegopher.PartitionField `json:"partition-spec"`
	// contains filtered or unexported fields
}

func (*MetadataV1) CurrentSchema

func (c *MetadataV1) CurrentSchema() *icegopher.Schema

func (*MetadataV1) CurrentSnapshot

func (c *MetadataV1) CurrentSnapshot() *Snapshot

func (*MetadataV1) DefaultPartitionSpec

func (c *MetadataV1) DefaultPartitionSpec() int

func (*MetadataV1) LastColumn

func (c *MetadataV1) LastColumn() int

func (*MetadataV1) LastPartitionSpecID

func (c *MetadataV1) LastPartitionSpecID() *int

func (*MetadataV1) LastUpdated

func (c *MetadataV1) LastUpdated() int

func (*MetadataV1) Loc

func (c *MetadataV1) Loc() string

func (*MetadataV1) PartitionSpec

func (c *MetadataV1) PartitionSpec() icegopher.PartitionSpec

func (*MetadataV1) PartitionSpecs

func (c *MetadataV1) PartitionSpecs() []icegopher.PartitionSpec

func (*MetadataV1) Properties

func (c *MetadataV1) Properties() icegopher.Properties

func (*MetadataV1) Schemas

func (c *MetadataV1) Schemas() []*icegopher.Schema

func (*MetadataV1) SnapshotByID

func (c *MetadataV1) SnapshotByID(id int64) *Snapshot

func (*MetadataV1) SnapshotByName

func (c *MetadataV1) SnapshotByName(name string) *Snapshot

func (*MetadataV1) Snapshots

func (c *MetadataV1) Snapshots() []Snapshot

func (*MetadataV1) SortOrder

func (c *MetadataV1) SortOrder() SortOrder

func (*MetadataV1) SortOrders

func (c *MetadataV1) SortOrders() []SortOrder

func (*MetadataV1) TableUUID

func (c *MetadataV1) TableUUID() uuid.UUID

func (*MetadataV1) ToV2

func (m *MetadataV1) ToV2() MetadataV2

func (*MetadataV1) UnmarshalJSON

func (m *MetadataV1) UnmarshalJSON(b []byte) error

func (*MetadataV1) Version

func (c *MetadataV1) Version() int

type MetadataV2

type MetadataV2 struct {
	LastSequenceNumber int `json:"last-sequence-number"`
	// contains filtered or unexported fields
}

func (*MetadataV2) CurrentSchema

func (c *MetadataV2) CurrentSchema() *icegopher.Schema

func (*MetadataV2) CurrentSnapshot

func (c *MetadataV2) CurrentSnapshot() *Snapshot

func (*MetadataV2) DefaultPartitionSpec

func (c *MetadataV2) DefaultPartitionSpec() int

func (*MetadataV2) LastColumn

func (c *MetadataV2) LastColumn() int

func (*MetadataV2) LastPartitionSpecID

func (c *MetadataV2) LastPartitionSpecID() *int

func (*MetadataV2) LastUpdated

func (c *MetadataV2) LastUpdated() int

func (*MetadataV2) Loc

func (c *MetadataV2) Loc() string

func (*MetadataV2) PartitionSpec

func (c *MetadataV2) PartitionSpec() icegopher.PartitionSpec

func (*MetadataV2) PartitionSpecs

func (c *MetadataV2) PartitionSpecs() []icegopher.PartitionSpec

func (*MetadataV2) Properties

func (c *MetadataV2) Properties() icegopher.Properties

func (*MetadataV2) Schemas

func (c *MetadataV2) Schemas() []*icegopher.Schema

func (*MetadataV2) SnapshotByID

func (c *MetadataV2) SnapshotByID(id int64) *Snapshot

func (*MetadataV2) SnapshotByName

func (c *MetadataV2) SnapshotByName(name string) *Snapshot

func (*MetadataV2) Snapshots

func (c *MetadataV2) Snapshots() []Snapshot

func (*MetadataV2) SortOrder

func (c *MetadataV2) SortOrder() SortOrder

func (*MetadataV2) SortOrders

func (c *MetadataV2) SortOrders() []SortOrder

func (*MetadataV2) TableUUID

func (c *MetadataV2) TableUUID() uuid.UUID

func (*MetadataV2) UnmarshalJSON

func (m *MetadataV2) UnmarshalJSON(b []byte) error

func (*MetadataV2) Version

func (c *MetadataV2) Version() int

type NullOrder

type NullOrder string
const (
	NullsFirst NullOrder = "nulls-first"
	NullsLast  NullOrder = "nulls-last"
)

type Operation

type Operation string
const (
	OpAppend    Operation = "append"
	OpReplace   Operation = "replace"
	OpOverwrite Operation = "overwrite"
	OpDelete    Operation = "delete"
)

func ValidOperation

func ValidOperation(s string) (Operation, error)

type PropertiesUpdateSummary

type PropertiesUpdateSummary struct {
	Removed []string `json:"removed"`
	Updated []string `json:"updated"`
	Missing []string `json:"missing"`
}

type RefType

type RefType string
const (
	BranchRef RefType = "branch"
	TagRef    RefType = "tag"
)

type Snapshot

type Snapshot struct {
	SnapshotID       int64    `json:"snapshot-id"`
	ParentSnapshotID *int64   `json:"parent-snapshot-id,omitempty"`
	SequenceNumber   int      `json:"sequence-number"`
	TimestampMs      int      `json:"timestamp-ms"`
	ManifestList     string   `json:"manifest-list,omitempty"`
	Summary          *Summary `json:"summary,omitempty"`
	SchemaID         *int     `json:"schema-id,omitempty"`
}

func (Snapshot) Equals

func (s Snapshot) Equals(other Snapshot) bool

func (Snapshot) Manifests

func (s Snapshot) Manifests(fio io.IO) ([]icegopher.ManifestFile, error)

func (Snapshot) String

func (s Snapshot) String() string

type SnapshotLogEntry

type SnapshotLogEntry struct {
	SnapshotID  int64 `json:"snapshot-id"`
	TimestampMs int   `json:"timestamp-ms"`
}

type SnapshotRef

type SnapshotRef struct {
	SnapshotID         int64   `json:"snapshot-id"`
	SnapshotRefType    RefType `json:"type"`
	MinSnapshotsToKeep *int    `json:"min-snapshots-to-keep,omitempty"`
	MaxSnapshotAgeMs   *int    `json:"max-snapshot-age-ms,omitempty"`
	MaxRefAgeMs        *int    `json:"max-ref-age-ms,omitempty"`
}

func (*SnapshotRef) UnmarshalJSON

func (s *SnapshotRef) UnmarshalJSON(b []byte) error

type SortDirection

type SortDirection string
const (
	SortASC  SortDirection = "asc"
	SortDESC SortDirection = "desc"
)

type SortField

type SortField struct {
	SourceID  int                 `json:"source-id"`
	Transform icegopher.Transform `json:"transform"`
	Direction SortDirection       `json:"direction"`
	NullOrder NullOrder           `json:"null-order"`
}

func (*SortField) MarshalJSON

func (s *SortField) MarshalJSON() ([]byte, error)

func (*SortField) String

func (s *SortField) String() string

func (*SortField) UnmarshalJSON

func (s *SortField) UnmarshalJSON(b []byte) error

type SortOrder

type SortOrder struct {
	OrderID int         `json:"order-id"`
	Fields  []SortField `json:"fields"`
}

func (SortOrder) String

func (s SortOrder) String() string

func (*SortOrder) UnmarshalJSON

func (s *SortOrder) UnmarshalJSON(b []byte) error

type Summary

type Summary struct {
	Operation  Operation
	Properties map[string]string
}

func (*Summary) Equals

func (s *Summary) Equals(other *Summary) bool

func (*Summary) MarshalJSON

func (s *Summary) MarshalJSON() ([]byte, error)

func (*Summary) UnmarshalJSON

func (s *Summary) UnmarshalJSON(b []byte) (err error)

type Table

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

func New

func New(ident Identifier, meta Metadata, location string, fs io.IO, catalog Catalog) *Table

func NewFromLocation

func NewFromLocation(ident Identifier, metalocation string, fsys io.IO, catalog Catalog) (*Table, error)

func (Table) Catalog

func (t Table) Catalog() Catalog

func (Table) CurrentSnapshot

func (t Table) CurrentSnapshot() *Snapshot

func (Table) Equals

func (t Table) Equals(other Table) bool

func (Table) FS

func (t Table) FS() io.IO

func (Table) Identifier

func (t Table) Identifier() Identifier

func (Table) Location

func (t Table) Location() string

func (Table) Metadata

func (t Table) Metadata() Metadata

func (Table) MetadataLoc

func (t Table) MetadataLoc() string

func (Table) Properties

func (t Table) Properties() icegopher.Properties

func (*Table) Refresh

func (t *Table) Refresh() (*Table, error)

func (Table) Schema

func (t Table) Schema() *icegopher.Schema

func (Table) Schemas

func (t Table) Schemas() map[int]*icegopher.Schema

func (Table) SnapshotByID

func (t Table) SnapshotByID(id int64) *Snapshot

func (Table) SnapshotByName

func (t Table) SnapshotByName(name string) *Snapshot

func (Table) SortOrder

func (t Table) SortOrder() SortOrder

func (Table) Spec

func (t Table) Spec() icegopher.PartitionSpec

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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