Documentation
¶
Overview ¶
Package pinot provides a client for Pinot, a real-time distributed OLAP datastore.
Index ¶
- func DecompressGrpcPayload(payload []byte, compression string) ([]byte, error)
- type AggregationResult
- type BrokerResponse
- type ClientConfig
- type Connection
- func NewFromBrokerList(brokerList []string) (*Connection, error)
- func NewFromBrokerListAndClient(brokerList []string, httpClient *http.Client) (*Connection, error)
- func NewFromController(controllerAddress string) (*Connection, error)
- func NewFromControllerAndClient(controllerAddress string, httpClient *http.Client) (*Connection, error)
- func NewFromZookeeper(zkPath []string, zkPathPrefix string, pinotCluster string) (*Connection, error)
- func NewFromZookeeperAndClient(zkPath []string, zkPathPrefix string, pinotCluster string, ...) (*Connection, error)
- func NewWithConfig(config *ClientConfig) (*Connection, error)
- func NewWithConfigAndClient(config *ClientConfig, httpClient *http.Client) (*Connection, error)
- func (c *Connection) CloseTrace()
- func (c *Connection) ExecuteSQL(table string, query string) (*BrokerResponse, error)
- func (c *Connection) ExecuteSQLWithParams(table string, queryPattern string, params []interface{}) (*BrokerResponse, error)
- func (c *Connection) OpenTrace()
- func (c *Connection) Prepare(table string, queryTemplate string) (PreparedStatement, error)
- func (c *Connection) UseMultistageEngine(useMultistageEngine bool)
- type ControllerConfig
- type Exception
- type GroupValue
- type GrpcConfig
- type GrpcTLSConfig
- type HTTPClient
- type PreparedStatement
- type ReadZNode
- type Request
- type RespSchema
- type ResultTable
- func (r ResultTable) Get(rowIndex int, columnIndex int) interface{}
- func (r ResultTable) GetColumnCount() int
- func (r ResultTable) GetColumnDataType(columnIndex int) string
- func (r ResultTable) GetColumnName(columnIndex int) string
- func (r ResultTable) GetDouble(rowIndex int, columnIndex int) float64
- func (r ResultTable) GetFloat(rowIndex int, columnIndex int) float32
- func (r ResultTable) GetInt(rowIndex int, columnIndex int) int32
- func (r ResultTable) GetLong(rowIndex int, columnIndex int) int64
- func (r ResultTable) GetRowCount() int
- func (r ResultTable) GetString(rowIndex int, columnIndex int) string
- type SelectionResults
- type ZookeeperConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type AggregationResult ¶
type AggregationResult struct {
Function string `json:"function"`
Value string `json:"value,omitempty"`
GroupByColumns []string `json:"groupByColumns,omitempty"`
GroupByResult []GroupValue `json:"groupByResult,omitempty"`
}
AggregationResult is the data structure for PQL aggregation result
type BrokerResponse ¶
type BrokerResponse struct {
SelectionResults *SelectionResults `json:"SelectionResults,omitempty"`
ResultTable *ResultTable `json:"resultTable,omitempty"`
TraceInfo map[string]string `json:"traceInfo,omitempty"`
AggregationResults []*AggregationResult `json:"aggregationResults,omitempty"`
Exceptions []Exception `json:"exceptions"`
NumSegmentsProcessed int `json:"numSegmentsProcessed"`
NumServersResponded int `json:"numServersResponded"`
NumSegmentsQueried int `json:"numSegmentsQueried"`
NumServersQueried int `json:"numServersQueried"`
NumSegmentsMatched int `json:"numSegmentsMatched"`
NumConsumingSegmentsQueried int `json:"numConsumingSegmentsQueried"`
NumDocsScanned int64 `json:"numDocsScanned"`
NumEntriesScannedInFilter int64 `json:"numEntriesScannedInFilter"`
NumEntriesScannedPostFilter int64 `json:"numEntriesScannedPostFilter"`
TotalDocs int64 `json:"totalDocs"`
TimeUsedMs int `json:"timeUsedMs"`
MinConsumingFreshnessTimeMs int64 `json:"minConsumingFreshnessTimeMs"`
NumGroupsLimitReached bool `json:"numGroupsLimitReached"`
}
BrokerResponse is the data structure for broker response.
type ClientConfig ¶
type ClientConfig struct {
// Additional HTTP headers to include in broker query API requests
ExtraHTTPHeader map[string]string
// GrpcConfig enables gRPC broker queries when set
GrpcConfig *GrpcConfig
// Zookeeper Configs
ZkConfig *ZookeeperConfig
// Controller Config
ControllerConfig *ControllerConfig
// BrokerList
BrokerList []string
// HTTP request timeout in your broker query for API requests
HTTPTimeout time.Duration
// UseMultistageEngine is a flag to enable multistage query execution engine
UseMultistageEngine bool
}
ClientConfig configs to create a PinotDbConnection
type Connection ¶
type Connection struct {
// contains filtered or unexported fields
}
Connection to Pinot, normally created through calls to the {@link ConnectionFactory}.
func NewFromBrokerList ¶
func NewFromBrokerList(brokerList []string) (*Connection, error)
NewFromBrokerList create a new Pinot connection with pre configured Pinot Broker list.
func NewFromBrokerListAndClient ¶ added in v0.2.0
func NewFromBrokerListAndClient(brokerList []string, httpClient *http.Client) (*Connection, error)
NewFromBrokerListAndClient create a new Pinot connection with pre configured Pinot Broker list and http client.
func NewFromController ¶ added in v0.2.0
func NewFromController(controllerAddress string) (*Connection, error)
NewFromController creates a new Pinot connection that periodically fetches available brokers via the Controller API.
func NewFromControllerAndClient ¶ added in v0.2.0
func NewFromControllerAndClient(controllerAddress string, httpClient *http.Client) (*Connection, error)
NewFromControllerAndClient creates a new Pinot connection that periodically fetches available brokers via the Controller API.
func NewFromZookeeper ¶
func NewFromZookeeper(zkPath []string, zkPathPrefix string, pinotCluster string) (*Connection, error)
NewFromZookeeper create a new Pinot connection through Pinot Zookeeper.
func NewFromZookeeperAndClient ¶ added in v0.2.0
func NewFromZookeeperAndClient(zkPath []string, zkPathPrefix string, pinotCluster string, httpClient *http.Client) (*Connection, error)
NewFromZookeeperAndClient create a new Pinot connection through Pinot Zookeeper and http client.
func NewWithConfig ¶
func NewWithConfig(config *ClientConfig) (*Connection, error)
NewWithConfig create a new Pinot connection.
func NewWithConfigAndClient ¶ added in v0.2.0
func NewWithConfigAndClient(config *ClientConfig, httpClient *http.Client) (*Connection, error)
NewWithConfigAndClient create a new Pinot connection with pre-created http client.
func (*Connection) CloseTrace ¶ added in v0.2.0
func (c *Connection) CloseTrace()
CloseTrace for the connection
func (*Connection) ExecuteSQL ¶
func (c *Connection) ExecuteSQL(table string, query string) (*BrokerResponse, error)
ExecuteSQL for a given table
func (*Connection) ExecuteSQLWithParams ¶ added in v0.4.0
func (c *Connection) ExecuteSQLWithParams(table string, queryPattern string, params []interface{}) (*BrokerResponse, error)
ExecuteSQLWithParams executes an SQL query with parameters for a given table
func (*Connection) OpenTrace ¶ added in v0.2.0
func (c *Connection) OpenTrace()
OpenTrace for the connection
func (*Connection) Prepare ¶ added in v0.8.0
func (c *Connection) Prepare(table string, queryTemplate string) (PreparedStatement, error)
Prepare creates a new PreparedStatement for the given table and query template. The query template should use '?' as placeholders for parameters. Example: "SELECT * FROM table WHERE column1 = ? AND column2 = ?"
func (*Connection) UseMultistageEngine ¶ added in v0.3.0
func (c *Connection) UseMultistageEngine(useMultistageEngine bool)
UseMultistageEngine for the connection
type ControllerConfig ¶ added in v0.2.0
type ControllerConfig struct {
// Additional HTTP headers to include in the controller API request
ExtraControllerAPIHeaders map[string]string
ControllerAddress string
// Frequency of broker data refresh in milliseconds via controller API - defaults to 1000ms
UpdateFreqMs int
}
ControllerConfig describes connection of a controller-based selector that periodically fetches table-to-broker mapping via the controller API
type GroupValue ¶
GroupValue is the data structure for PQL aggregation GroupBy result
type GrpcConfig ¶ added in v0.10.0
type GrpcConfig struct {
// Encoding controls result serialization. Supported values: JSON, ARROW.
Encoding string
// Compression controls response compression. Supported values: ZSTD, LZ4_FAST, LZ4_HIGH, DEFLATE, GZIP, SNAPPY, NONE.
Compression string
// BlockRowSize is the number of rows per response block.
BlockRowSize int
// Timeout controls gRPC request timeout.
Timeout time.Duration
// ExtraMetadata adds metadata entries to the gRPC request.
ExtraMetadata map[string]string
// TLS config for secure gRPC connections.
TLSConfig *GrpcTLSConfig
}
GrpcConfig describes how to configure broker gRPC queries
type GrpcTLSConfig ¶ added in v0.10.0
type GrpcTLSConfig struct {
Enabled bool
CACertPath string
ServerName string
InsecureSkipVerify bool
}
GrpcTLSConfig configures TLS for gRPC connections.
type HTTPClient ¶ added in v0.2.0
HTTPClient is an interface for http.Client
type PreparedStatement ¶ added in v0.8.0
type PreparedStatement interface {
// SetString sets the parameter at the given index to the given string value
SetString(parameterIndex int, value string) error
// SetInt sets the parameter at the given index to the given int value
SetInt(parameterIndex int, value int) error
// SetInt64 sets the parameter at the given index to the given int64 value
SetInt64(parameterIndex int, value int64) error
// SetFloat64 sets the parameter at the given index to the given float64 value
SetFloat64(parameterIndex int, value float64) error
// SetBool sets the parameter at the given index to the given bool value
SetBool(parameterIndex int, value bool) error
// Set sets the parameter at the given index to the given value (any supported type)
Set(parameterIndex int, value interface{}) error
// Execute executes the prepared statement with the currently set parameters
Execute() (*BrokerResponse, error)
// ExecuteWithParams executes the prepared statement with the given parameters
// This is a convenience method that sets all parameters and executes in one call
ExecuteWithParams(params ...interface{}) (*BrokerResponse, error)
// GetQuery returns the original query template
GetQuery() string
// GetParameterCount returns the number of parameters in the prepared statement
GetParameterCount() int
// ClearParameters clears all currently set parameters
ClearParameters() error
// Close closes the prepared statement and releases any associated resources
Close() error
}
PreparedStatement represents a prepared statement with bind variables that can be executed multiple times with different parameter values. It's similar to database/sql.Stmt but adapted for Pinot.
type Request ¶
type Request struct {
// contains filtered or unexported fields
}
Request is used in server request to host multiple pinot query types, like PQL, SQL.
type RespSchema ¶
type RespSchema struct {
ColumnDataTypes []string `json:"columnDataTypes"`
ColumnNames []string `json:"columnNames"`
}
RespSchema is response schema
type ResultTable ¶
type ResultTable struct {
DataSchema RespSchema `json:"dataSchema"`
Rows [][]interface{} `json:"rows"`
}
ResultTable is a ResultTable
func (ResultTable) Get ¶
func (r ResultTable) Get(rowIndex int, columnIndex int) interface{}
Get returns a ResultTable entry given row index and column index
func (ResultTable) GetColumnCount ¶
func (r ResultTable) GetColumnCount() int
GetColumnCount returns how many columns in the ResultTable
func (ResultTable) GetColumnDataType ¶
func (r ResultTable) GetColumnDataType(columnIndex int) string
GetColumnDataType returns column data type given column index
func (ResultTable) GetColumnName ¶
func (r ResultTable) GetColumnName(columnIndex int) string
GetColumnName returns column name given column index
func (ResultTable) GetDouble ¶
func (r ResultTable) GetDouble(rowIndex int, columnIndex int) float64
GetDouble returns a ResultTable double entry given row index and column index
func (ResultTable) GetFloat ¶
func (r ResultTable) GetFloat(rowIndex int, columnIndex int) float32
GetFloat returns a ResultTable float entry given row index and column index
func (ResultTable) GetInt ¶
func (r ResultTable) GetInt(rowIndex int, columnIndex int) int32
GetInt returns a ResultTable int entry given row index and column index
func (ResultTable) GetLong ¶
func (r ResultTable) GetLong(rowIndex int, columnIndex int) int64
GetLong returns a ResultTable long entry given row index and column index
func (ResultTable) GetRowCount ¶
func (r ResultTable) GetRowCount() int
GetRowCount returns how many rows in the ResultTable
type SelectionResults ¶
type SelectionResults struct {
Columns []string `json:"columns"`
Results [][]interface{} `json:"results"`
}
SelectionResults is the data structure for PQL selection result
type ZookeeperConfig ¶
ZookeeperConfig describes how to config Pinot Zookeeper connection
Source Files
¶
- brokerSelector.go
- clientTransport.go
- config.go
- connection.go
- connectionFactory.go
- controllerBasedBrokerSelector.go
- controllerResponse.go
- dynamicBrokerSelector.go
- grpcBrokerClientTransport.go
- json.go
- jsonAsyncHTTPClientTransport.go
- prepared_statement.go
- request.go
- response.go
- simplebrokerselector.go
- tableAwareBrokerSelector.go