Documentation ¶
Index ¶
- Constants
- type ConnectConfiguration
- type Connection
- type Cursor
- func (c *Cursor) Cancel()
- func (c *Cursor) Close()
- func (c *Cursor) Description() [][]string
- func (c *Cursor) Error() error
- func (c *Cursor) Exec(ctx context.Context, query string)
- func (c *Cursor) Execute(ctx context.Context, query string, async bool)
- func (c *Cursor) FetchOne(ctx context.Context, dests ...interface{})
- func (c *Cursor) Finished() bool
- func (c *Cursor) HasMore(ctx context.Context) bool
- func (c *Cursor) Poll(getProgres bool) (status *hiveserver.TGetOperationStatusResp)
- func (c *Cursor) RowMap(ctx context.Context) map[string]interface{}
- func (c *Cursor) WaitForCompletion(ctx context.Context)
- type DatabaseMetaData
- func (md *DatabaseMetaData) GetColumns(ctx context.Context, catalog string, schemaPattern string, ...) (cursor *Cursor)
- func (md *DatabaseMetaData) GetSchemas(ctx context.Context) (cursor *Cursor)
- func (md *DatabaseMetaData) GetTables(ctx context.Context, catalog string, schemaPattern string, ...) (cursor *Cursor)
- type TSaslTransport
- func (p *TSaslTransport) Close() (err error)
- func (p *TSaslTransport) Flush(ctx context.Context) (err error)
- func (p *TSaslTransport) IsOpen() bool
- func (p *TSaslTransport) Open() (err error)
- func (p *TSaslTransport) Read(buf []byte) (l int, err error)
- func (p *TSaslTransport) RemainingBytes() uint64
- func (p *TSaslTransport) SetMaxLength(maxLength uint32)
- func (p *TSaslTransport) Write(buf []byte) (int, error)
Constants ¶
const ( START = 1 OK = 2 BAD = 3 ERROR = 4 COMPLETE = 5 )
const DEFAULT_FETCH_SIZE int64 = 1000
const DEFAULT_MAX_LENGTH = 16384000
const ZOOKEEPER_DEFAULT_NAMESPACE = "hiveserver2"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ConnectConfiguration ¶
type ConnectConfiguration struct { Username string Principal string Password string Service string HiveConfiguration map[string]string PollIntervalInMillis int FetchSize int64 TransportMode string HTTPPath string TLSConfig *tls.Config ZookeeperNamespace string }
ConnectConfiguration is the configuration for the connection The fields have to be filled manually but not all of them are required Depends on the auth and kind of connection.
func NewConnectConfiguration ¶
func NewConnectConfiguration() *ConnectConfiguration
NewConnectConfiguration returns a connect configuration, all with empty fields
type Connection ¶
type Connection struct { SessionHandle *hiveserver.TSessionHandle // contains filtered or unexported fields }
Connection holds the information for getting a cursor to hive
func Connect ¶
func Connect(host string, port int, auth string, configuration *ConnectConfiguration) (conn *Connection, err error)
Connect to hive server
func ConnectZookeeper ¶ added in v1.0.7
func ConnectZookeeper(hosts string, auth string, configuration *ConnectConfiguration) (conn *Connection, err error)
Connect to zookeper to get hive hosts and then connect to hive. hosts is in format host1:port1,host2:port2,host3:port3 (zookeeper hosts).
func (*Connection) Cursor ¶
func (c *Connection) Cursor() *Cursor
Cursor creates a cursor from a connection
func (*Connection) MetaData ¶ added in v1.1.2
func (c *Connection) MetaData() *DatabaseMetaData
type Cursor ¶
type Cursor struct { OperationHandle *hiveserver.TOperationHandle Err error // contains filtered or unexported fields }
Cursor is used for fetching the rows after a query
func (*Cursor) Description ¶
Description return a map with the names of the columns and their types must be called after a FetchResult request a context should be added here but seems to be ignored by thrift
func (*Cursor) Poll ¶
func (c *Cursor) Poll(getProgres bool) (status *hiveserver.TGetOperationStatusResp)
Poll returns the current status of the last operation
func (*Cursor) WaitForCompletion ¶
WaitForCompletion waits for an async operation to finish
type DatabaseMetaData ¶ added in v1.1.2
type DatabaseMetaData struct {
// contains filtered or unexported fields
}
func (*DatabaseMetaData) GetColumns ¶ added in v1.1.2
func (*DatabaseMetaData) GetSchemas ¶ added in v1.1.2
func (md *DatabaseMetaData) GetSchemas(ctx context.Context) (cursor *Cursor)
type TSaslTransport ¶
type TSaslTransport struct { OpeningContext context.Context // contains filtered or unexported fields }
TSaslTransport is a tranport thrift struct that uses SASL
func NewTSaslTransport ¶
func NewTSaslTransport(trans thrift.TTransport, host string, mechanismName string, configuration map[string]string) (*TSaslTransport, error)
NewTSaslTransport return a TSaslTransport
func (*TSaslTransport) Close ¶
func (p *TSaslTransport) Close() (err error)
Close close a SASL transport connection
func (*TSaslTransport) Flush ¶
func (p *TSaslTransport) Flush(ctx context.Context) (err error)
Flush the bytes in the buffer
func (*TSaslTransport) IsOpen ¶
func (p *TSaslTransport) IsOpen() bool
IsOpen opens a SASL connection
func (*TSaslTransport) Open ¶
func (p *TSaslTransport) Open() (err error)
Open check if a SASL transport connection is opened
func (*TSaslTransport) RemainingBytes ¶
func (p *TSaslTransport) RemainingBytes() uint64
RemainingBytes return the size of the unwrapped bytes
func (*TSaslTransport) SetMaxLength ¶
func (p *TSaslTransport) SetMaxLength(maxLength uint32)
SetMaxLength set the maxLength