hive

package
v1.2.1 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// TimestampFormat is JDBC compliant timestamp format
	TimestampFormat = "2006-01-02 15:04:05.999999999"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

Client represents Hive Client

func NewClient

func NewClient(client thrift.TClient, log *log.Logger, opts *Options) *Client

NewClient creates Hive Client

func (*Client) OpenSession

func (c *Client) OpenSession(ctx context.Context) (*Session, error)

OpenSession creates new hive session

type ColDesc

type ColDesc struct {
	Name string

	DatabaseTypeName string
	ScanType         reflect.Type

	// Impala columns are always Nullable, except some Kudu columns
	NotNull bool

	Length    int64
	HasLength bool

	Precision         int64
	Scale             int64
	HasPrecisionScale bool
}

ColDesc mirrors sql.ColumnType struct which we can't just reuse because its fields are private

type ColumnName added in v1.1.0

type ColumnName struct {
	Schema     string
	TableName  string
	ColumnName string
}

type DBMetadata

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

DBMetadata exposes the database schema. It does not own the underlying client and session so they must be open while the objects and the data iterators are used.

func (DBMetadata) GetColumnsSeq added in v1.1.0

func (m DBMetadata) GetColumnsSeq(ctx context.Context, schemaPattern string, tableNamePattern string, columnNamePattern string) (iter.Seq[ColumnName], *error)

func (DBMetadata) GetSchemasSeq

func (m DBMetadata) GetSchemasSeq(ctx context.Context, pattern string) (iter.Seq[string], *error)

func (DBMetadata) GetTablesSeq

func (m DBMetadata) GetTablesSeq(ctx context.Context, schemaPattern string, tableNamePattern string) (iter.Seq[TableName], *error)

GetTablesSeq returns tables and views that match the criteria as an iterator. Patterns use LIKE syntax Unlike SHOW TABLES IN, GetTablesSeq can work across schemas and can report if the results are tables or views.

type Operation

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

Operation represents hive operation

func (*Operation) CheckStateAndStatus added in v1.0.0

func (op *Operation) CheckStateAndStatus(ctx context.Context) (cli_service.TOperationState, error)

CheckStateAndStatus returns the operation state if both the state and status are ok

func (*Operation) Close

func (op *Operation) Close(ctx context.Context) (int64, error)

Close closes operation and returns rows affected if any

func (*Operation) FetchResults

func (op *Operation) FetchResults(ctx context.Context, schema *TableSchema) (*ResultSet, error)

FetchResults lazily prepares query result from server

func (*Operation) GetResultSetMetadata

func (op *Operation) GetResultSetMetadata(ctx context.Context) (*TableSchema, error)

GetResultSetMetadata return schema

func (*Operation) HasResultSet

func (op *Operation) HasResultSet() bool

HasResultSet return if operation has result set

func (*Operation) RowsAffected

func (op *Operation) RowsAffected() float64

RowsAffected return number of rows affected by operation

func (*Operation) WaitToFinish

func (op *Operation) WaitToFinish(ctx context.Context) error

WaitToFinish waits for the operation to reach a FINISHED state Returns error if the operation fails or the context is cancelled.

type Options

type Options struct {
	MaxRows      int64
	MemLimit     string
	QueryTimeout int
}

Options for Hive Client

type ResultSet

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

ResultSet ...

func (*ResultSet) Next

func (rs *ResultSet) Next(dest []driver.Value) error

Next ...

type Session

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

Session represents hive session

func (*Session) Close

func (s *Session) Close(ctx context.Context) error

Close session

func (*Session) DBMetadata

func (s *Session) DBMetadata() DBMetadata

func (*Session) ExecuteStatement

func (s *Session) ExecuteStatement(ctx context.Context, stmt string) (*Operation, error)

ExecuteStatement returns hive operation

func (*Session) Ping

func (s *Session) Ping(ctx context.Context) error

Ping checks the connection

type TableName

type TableName struct {
	Schema string
	Name   string
	Type   string
}

type TableSchema

type TableSchema struct {
	Columns []*ColDesc
}

Jump to

Keyboard shortcuts

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