Documentation ¶
Index ¶
- Constants
- Variables
- 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) FetchLogs() []string
- 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(getProgress bool) (status *hiveserver.TGetOperationStatusResp)
- func (c *Cursor) RowMap(ctx context.Context) map[string]interface{}
- func (c *Cursor) WaitForCompletion(ctx context.Context)
- type DialContextFunc
- type HiveError
- 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 ¶
var DEFAULT_ERROR_CODE = int32(-1)
var DEFAULT_ERROR_MESSAGE = "unknown error"
var DEFAULT_SQL_STATE = ""
var DEFAULT_STATUS = hiveserver.TStatus{ StatusCode: hiveserver.TStatusCode_ERROR_STATUS, InfoMessages: nil, SqlState: &DEFAULT_SQL_STATE, ErrorCode: &DEFAULT_ERROR_CODE, ErrorMessage: &DEFAULT_ERROR_MESSAGE, }
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 Database string ConnectTimeout time.Duration SocketTimeout time.Duration HttpTimeout time.Duration DialContext DialContextFunc DisableKeepAlives bool // Maximum length of the data in bytes. Used for SASL. MaxSize uint32 }
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 {
// 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 ¶
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
type Cursor ¶
type Cursor struct { Err error // Caller is responsible for managing this channel Logs chan<- []string // 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) FetchLogs ¶
FetchLogs returns all the Hive execution logs for the latest query up to the current point
func (*Cursor) Poll ¶
func (c *Cursor) Poll(getProgress 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 DialContextFunc ¶
type HiveError ¶
type HiveError struct { // Simple error message, without the full stack trace. Surfaced from Thrift. Message string // See https://github.com/apache/hive/blob/master/common/src/java/org/apache/hadoop/hive/ql/ErrorMsg.java for info about error codes ErrorCode int // contains filtered or unexported fields }
HiveError represents an error surfaced from Hive. We attach the specific Error code along with the usual message.
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, maxLength uint32) (*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