Golang
Pinot Client for Golang
Pinot provides a native Go client to query the database directly from Go application.
Install
Follow this Pinot quickstart to install and start Pinot locally.
bin/quick-start-batch.shCheck out the client library GitHub repository.
git clone git@github.com:startreedata/pinot-client-go.git
cd pinot-client-goBuild and run the example application to query from the Pinot batch quickstart.
go build ./examples/batch-quickstart
./batch-quickstartUse the Golang client
Create a Pinot connection
Initialize the Pinot client using one of the methods below.
Zookeeper Path
pinotClient := pinot.NewFromZookeeper([]string{"localhost:2123"}, "", "QuickStartCluster")List of broker addresses
ClientConfig
The Go client repository contains an example script.
Note: You need not configure “content-type” as a header in ExtraHTTPHeader.
ClientConfig with HTTP client
If you require a specialized HTTP client, you have the option to create your own HTTP client and utilize the NewWithConfigAndClient function to establish a Pinot client that can accommodate a custom HTTP client.
The Go client repository contains an example script.
Query Pinot
The Go client repository contains an example script.
Code snippet:
Response format
The query response has the following format:
Note that AggregationResults and SelectionResults are holders for legacy PQL (Pinot Query Language) queries, which have been deprecated since Pinot 0.7.1. Use the SQL API and ResultTable instead.
Meanwhile, ResultTable is the holder for SQL queries. ResultTable is defined as:
RespSchema is defined as:
There are multiple functions defined for ResultTable, such as the following:
See an example of a function in use here and below:
Last updated
Was this helpful?

