pinot

package
v0.4.0 Latest Latest
Warning

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

Go to latest
Published: Apr 7, 2024 License: Apache-2.0 Imports: 13 Imported by: 15

Documentation

Overview

Package pinot provides a client for Pinot, a real-time distributed OLAP datastore.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

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
	// 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) 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 Exception

type Exception struct {
	Message   string `json:"message"`
	ErrorCode int    `json:"errorCode"`
}

Exception is Pinot exceptions.

type GroupValue

type GroupValue struct {
	Value string   `json:"value"`
	Group []string `json:"group"`
}

GroupValue is the data structure for PQL aggregation GroupBy result

type HTTPClient added in v0.2.0

type HTTPClient interface {
	Do(req *http.Request) (*http.Response, error)
}

HTTPClient is an interface for http.Client

type ReadZNode

type ReadZNode func(path string) ([]byte, error)

ReadZNode reads a ZNode content as bytes from Zookeeper

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

func (ResultTable) GetString

func (r ResultTable) GetString(rowIndex int, columnIndex int) string

GetString returns a ResultTable string entry given row index and column index

type SelectionResults

type SelectionResults struct {
	Columns []string        `json:"columns"`
	Results [][]interface{} `json:"results"`
}

SelectionResults is the data structure for PQL selection result

type ZookeeperConfig

type ZookeeperConfig struct {
	PathPrefix        string
	ZookeeperPath     []string
	SessionTimeoutSec int
}

ZookeeperConfig describes how to config Pinot Zookeeper connection

Jump to

Keyboard shortcuts

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