Help us shape the future of Go! Take the 2026 Go Developer Survey

drill

package module
v0.0.0-...-4efcbab Latest Latest
Warning

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

Go to latest
Published: Jul 4, 2017 License: MIT Imports: 6 Imported by: 0

README

go-drill

Go client for Apache Drill that utilizes REST API

Query Example

d, err := NewDrillbit("http://localhost:8047")

type fileQuery struct {
    Name             string
    IsDirectory      string
    IsFile           bool   `json:",string"`
    Length           uint64 `json:",string"`
    Owner            string
    Group            string
    Permissions      string
    AccessTime       string
    ModificationTime string
}

res := make([]fileQuery, 0)

err = d.Query(&res, "show files in dfs")

TODO

  • Queries
  • Profiles
  • Storage plugins
  • Stats
  • Options
  • Test and coverage reports

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Drillbit

type Drillbit struct {
	// contains filtered or unexported fields
}

func NewDrillFromZK

func NewDrillFromZK(zkpath string) (*Drillbit, error)

NewDrillFromZK connects to Zookeeper and queries the drillbits

func NewDrillbit

func NewDrillbit(endpoint string) (*Drillbit, error)

NewDrill connects to a given Drillbit by its REST API

func (*Drillbit) CreateStorage

func (d *Drillbit) CreateStorage(name string, storage Storage) (*ResultState, error)

CreateStorage given a storage name and Storage instance, returns the result as ResultState format

func (*Drillbit) DeleteProfile

func (d *Drillbit) DeleteProfile(queryId string) (interface{}, error)

DeleteProfile given a query id, returns success if the query is running, otherwise it returns an error as a string so it cannot be decoded

func (*Drillbit) DeleteStorage

func (d *Drillbit) DeleteStorage(name string) (*ResultState, error)

DeleteStorage given a storage name, returns the result as ResultState format

func (*Drillbit) DisableStorage

func (d *Drillbit) DisableStorage(name string) (*ResultState, error)

DisableStorage given a storage name, returns the result as ResultState format

func (*Drillbit) EnableStorage

func (d *Drillbit) EnableStorage(name string) (*ResultState, error)

EnableStorage given a storage name, returns the result as ResultState format

func (*Drillbit) GetProfile

func (d *Drillbit) GetProfile(queryId string) (interface{}, error)

GetProfile given a query id, returns query profile

func (*Drillbit) GetStorage

func (d *Drillbit) GetStorage(name string) (*Storage, error)

GetStorage given a storage name, returns the storage as Storage format

func (*Drillbit) Profiles

func (d *Drillbit) Profiles() (*Profiles, error)

Profiles returns all running and finished queries as Profile format array

func (*Drillbit) Query

func (d *Drillbit) Query(v interface{}, sql string) error

Query is an extension to RawQuery method, which assumes the response is given object, so that we can assume that we can convert to given interface easily so that the caller can use it in a type-safe like manner.

func (*Drillbit) RawQuery

func (d *Drillbit) RawQuery(sql string) (*QueryResponse, error)

RawQuery given an SQL, returns the official QueryResponse format

func (*Drillbit) Storage

func (d *Drillbit) Storage() (*[]Storage, error)

Storage returns all storage as Storage format array

type Profile

type Profile struct {
	QueryID  string
	Time     string
	Location string
	Foreman  string
	Query    string
	State    string
	User     string
}

type Profiles

type Profiles struct {
	RunningQueries  []Profile
	FinishedQueries []Profile
}

type QueryResponse

type QueryResponse struct {
	Columns []string
	Rows    []interface{}
}

QueryResponse is a https://drill.apache.org/docs/rest-api/#query

type ResultState

type ResultState struct {
	Result string `json:"result"`
}

type Storage

type Storage struct {
	Name   string      `json:"name"`
	Config interface{} `json:"config"`
}

Jump to

Keyboard shortcuts

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