Documentation
¶
Index ¶
- Constants
- Variables
- func DatabaseIdentifier(database string) table.Identifier
- func TableIdentifier(database, tableName string) table.Identifier
- type Catalog
- func (c *Catalog) CatalogType() catalog.Type
- func (c *Catalog) CheckNamespaceExists(ctx context.Context, namespace table.Identifier) (bool, error)
- func (c *Catalog) CheckTableExists(ctx context.Context, identifier table.Identifier) (bool, error)
- func (c *Catalog) CheckViewExists(ctx context.Context, identifier table.Identifier) (bool, error)
- func (c *Catalog) Close() error
- func (c *Catalog) CommitTable(ctx context.Context, identifier table.Identifier, ...) (table.Metadata, string, error)
- func (c *Catalog) CreateNamespace(ctx context.Context, namespace table.Identifier, props iceberg.Properties) error
- func (c *Catalog) CreateTable(ctx context.Context, identifier table.Identifier, schema *iceberg.Schema, ...) (*table.Table, error)
- func (c *Catalog) DropNamespace(ctx context.Context, namespace table.Identifier) error
- func (c *Catalog) DropTable(ctx context.Context, identifier table.Identifier) error
- func (c *Catalog) DropView(ctx context.Context, identifier table.Identifier) error
- func (c *Catalog) ListNamespaces(ctx context.Context, parent table.Identifier) ([]table.Identifier, error)
- func (c *Catalog) ListTables(ctx context.Context, namespace table.Identifier) iter.Seq2[table.Identifier, error]
- func (c *Catalog) ListViews(ctx context.Context, namespace table.Identifier) iter.Seq2[table.Identifier, error]
- func (c *Catalog) LoadNamespaceProperties(ctx context.Context, namespace table.Identifier) (iceberg.Properties, error)
- func (c *Catalog) LoadTable(ctx context.Context, identifier table.Identifier) (*table.Table, error)
- func (c *Catalog) LoadView(ctx context.Context, identifier table.Identifier) (*view.View, error)
- func (c *Catalog) RenameTable(ctx context.Context, from, to table.Identifier) (*table.Table, error)
- func (c *Catalog) UpdateNamespaceProperties(ctx context.Context, namespace table.Identifier, removals []string, ...) (catalog.PropertiesUpdateSummary, error)
- type HiveClient
- type HiveLock
- type HiveOptions
- type Option
Constants ¶
const ( // URI is the Thrift URI for the Hive Metastore (e.g., "thrift://localhost:9083") URI = "uri" // Warehouse is the default warehouse location for tables Warehouse = "warehouse" TableTypeKey = "table_type" TableTypeIceberg = "ICEBERG" TableTypeExternalTable = "EXTERNAL_TABLE" // Ref: https://github.com/apache/hive/blob/7060d94843fdbc548445db6aac84dd60b44641ee/standalone-metastore/metastore-common/src/main/java/org/apache/hadoop/hive/metastore/TableType.java#L27 TableTypeVirtualView = "VIRTUAL_VIEW" // Ref: https://github.com/apache/iceberg/blob/2f170322d425a4c6267a9033efa2107c9bfc53db/hive-metastore/src/main/java/org/apache/iceberg/hive/HiveOperationsBase.java#L57 TableTypeIcebergView = "ICEBERG_VIEW" MetadataLocationKey = "metadata_location" PreviousMetadataLocationKey = "previous_metadata_location" ExternalKey = "EXTERNAL" // Lock configuration property keys LockCheckMinWaitTime = "lock-check-min-wait-time" LockCheckMaxWaitTime = "lock-check-max-wait-time" LockCheckRetries = "lock-check-retries" // Default lock configuration values DefaultLockCheckMinWaitTime = 100 * time.Millisecond // 100ms DefaultLockCheckMaxWaitTime = 60 * time.Second // 1 minute DefaultLockCheckRetries = 4 )
Variables ¶
var ErrLockAcquisitionFailed = errors.New("failed to acquire lock")
ErrLockAcquisitionFailed is returned when a lock cannot be acquired after all retries.
Functions ¶
func DatabaseIdentifier ¶
func DatabaseIdentifier(database string) table.Identifier
DatabaseIdentifier returns a database identifier for a Hive database.
func TableIdentifier ¶
func TableIdentifier(database, tableName string) table.Identifier
TableIdentifier returns a table identifier for a Hive table.
Types ¶
type Catalog ¶
type Catalog struct {
// contains filtered or unexported fields
}
func NewCatalog ¶
func NewCatalog(props iceberg.Properties, opts ...Option) (*Catalog, error)
func NewCatalogWithClient ¶
func NewCatalogWithClient(client HiveClient, props iceberg.Properties) *Catalog
func (*Catalog) CatalogType ¶
func (*Catalog) CheckNamespaceExists ¶
func (c *Catalog) CheckNamespaceExists(ctx context.Context, namespace table.Identifier) (bool, error)
CheckNamespaceExists checks if a namespace exists in the catalog.
func (*Catalog) CheckTableExists ¶
CheckTableExists checks if a table exists in the catalog.
func (*Catalog) CheckViewExists ¶
CheckViewExists checks if a view exists in the catalog.
func (*Catalog) CommitTable ¶
func (*Catalog) CreateNamespace ¶
func (c *Catalog) CreateNamespace(ctx context.Context, namespace table.Identifier, props iceberg.Properties) error
CreateNamespace creates a new namespace in the catalog.
func (*Catalog) CreateTable ¶
func (*Catalog) DropNamespace ¶
DropNamespace drops a namespace from the catalog.
func (*Catalog) ListNamespaces ¶
func (c *Catalog) ListNamespaces(ctx context.Context, parent table.Identifier) ([]table.Identifier, error)
func (*Catalog) ListTables ¶
func (c *Catalog) ListTables(ctx context.Context, namespace table.Identifier) iter.Seq2[table.Identifier, error]
ListTables returns a list of table identifiers in the given namespace.
func (*Catalog) ListViews ¶
func (c *Catalog) ListViews(ctx context.Context, namespace table.Identifier) iter.Seq2[table.Identifier, error]
ListViews returns a list of view identifiers in the given namespace.
func (*Catalog) LoadNamespaceProperties ¶
func (c *Catalog) LoadNamespaceProperties(ctx context.Context, namespace table.Identifier) (iceberg.Properties, error)
LoadNamespaceProperties loads the properties for a namespace.
func (*Catalog) RenameTable ¶
func (*Catalog) UpdateNamespaceProperties ¶
func (c *Catalog) UpdateNamespaceProperties(ctx context.Context, namespace table.Identifier, removals []string, updates iceberg.Properties, ) (catalog.PropertiesUpdateSummary, error)
UpdateNamespaceProperties updates the properties for a namespace.
type HiveClient ¶
type HiveClient interface {
Close() error
GetDatabase(ctx context.Context, name string) (*hive_metastore.Database, error)
CreateDatabase(ctx context.Context, database *hive_metastore.Database) error
AlterDatabase(ctx context.Context, dbname string, db *hive_metastore.Database) error
DropDatabase(ctx context.Context, name string, deleteData, cascade bool) error
GetAllDatabases(ctx context.Context) ([]string, error)
GetTable(ctx context.Context, dbName, tableName string) (*hive_metastore.Table, error)
CreateTable(ctx context.Context, tbl *hive_metastore.Table) error
AlterTable(ctx context.Context, dbName, tableName string, newTbl *hive_metastore.Table) error
DropTable(ctx context.Context, dbName, tableName string, deleteData bool) error
GetTables(ctx context.Context, dbName, pattern string) ([]string, error)
Lock(ctx context.Context, request *hive_metastore.LockRequest) (*hive_metastore.LockResponse, error)
CheckLock(ctx context.Context, lockId int64) (*hive_metastore.LockResponse, error)
Unlock(ctx context.Context, lockId int64) error
}
type HiveOptions ¶
type HiveOptions struct {
URI string
Warehouse string
// Lock configuration for atomic commits
LockMinWaitTime time.Duration
LockMaxWaitTime time.Duration
LockRetries int
// contains filtered or unexported fields
}
func NewHiveOptions ¶
func NewHiveOptions() *HiveOptions
func (*HiveOptions) ApplyProperties ¶
func (o *HiveOptions) ApplyProperties(props iceberg.Properties)
type Option ¶
type Option func(*HiveOptions)
func WithProperties ¶
func WithProperties(props iceberg.Properties) Option