Golang

Pinot Client for Golang

Pinot provides a native Go client to query database directly from go application.

Install

  1. Follow this Pinot quickstart link to install and start Pinot locally.

bin/quick-start-batch.sh
git clone [email protected]:startreedata/pinot-client-go.git
cd pinot-client-go
  1. Build and run the example application to query from the Pinot batch quickstart.

go build ./examples/batch-quickstart
./batch-quickstart

Use 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

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 Pinot query language (PQL) queries.

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:

Was this helpful?