statistics

package
v0.0.0-...-815d2fd Latest Latest
Warning

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

Go to latest
Published: Jul 15, 2016 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Overview

Package statistics is a generated protocol buffer package.

It is generated from these files:

statistics.proto

It has these top-level messages:

ColumnPB
TablePB

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Column

type Column struct {
	ID  int64 // Column ID.
	NDV int64 // Number of distinct values.

	// Histogram elements.
	//
	// A bucket number is the number of items stored in all previous buckets and the current bucket.
	// bucket numbers are always in increasing order.
	//
	// A bucket value is the greatest item value stored in the bucket.
	//
	// Repeat is the number of repeats of the bucket value, it can be used to find popular values.
	//
	// We could have make a bucket struct contains number, value and repeat, but that would be harder to
	// serialize, so we store every bucket field in its own slice instead. those slices all have
	// the bucket count length.
	Numbers []int64
	Values  []types.Datum
	Repeats []int64
}

Column represents statistics for a column.

func (*Column) BetweenRowCount

func (c *Column) BetweenRowCount(a, b types.Datum) (int64, error)

BetweenRowCount estimates the row count where column greater or equal to a and less than b.

func (*Column) EqualRowCount

func (c *Column) EqualRowCount(value types.Datum) (int64, error)

EqualRowCount estimates the row count where the column equals to value.

func (*Column) LessRowCount

func (c *Column) LessRowCount(value types.Datum) (int64, error)

LessRowCount estimates the row count where the column less than value.

func (*Column) String

func (c *Column) String() string

type ColumnPB

type ColumnPB struct {
	Id               *int64  `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
	Ndv              *int64  `protobuf:"varint,2,opt,name=ndv" json:"ndv,omitempty"`
	Numbers          []int64 `protobuf:"varint,3,rep,name=numbers" json:"numbers,omitempty"`
	Value            []byte  `protobuf:"bytes,4,opt,name=value" json:"value,omitempty"`
	Repeats          []int64 `protobuf:"varint,5,rep,name=repeats" json:"repeats,omitempty"`
	XXX_unrecognized []byte  `json:"-"`
}

func (*ColumnPB) Descriptor

func (*ColumnPB) Descriptor() ([]byte, []int)

func (*ColumnPB) GetId

func (m *ColumnPB) GetId() int64

func (*ColumnPB) GetNdv

func (m *ColumnPB) GetNdv() int64

func (*ColumnPB) GetNumbers

func (m *ColumnPB) GetNumbers() []int64

func (*ColumnPB) GetRepeats

func (m *ColumnPB) GetRepeats() []int64

func (*ColumnPB) GetValue

func (m *ColumnPB) GetValue() []byte

func (*ColumnPB) ProtoMessage

func (*ColumnPB) ProtoMessage()

func (*ColumnPB) Reset

func (m *ColumnPB) Reset()

func (*ColumnPB) String

func (m *ColumnPB) String() string

type Table

type Table struct {
	TS      int64 // build timestamp.
	Columns []*Column
	Count   int64 // Total row count in a table.
	// contains filtered or unexported fields
}

Table represents statistics for a table.

func NewTable

func NewTable(ti *model.TableInfo, ts, count, numBuckets int64, columnSamples [][]types.Datum) (*Table, error)

NewTable creates a table statistics.

func PseudoTable

func PseudoTable(ti *model.TableInfo) *Table

PseudoTable creates a pseudo table statistics when statistic can not be found in KV store.

func TableFromPB

func TableFromPB(ti *model.TableInfo, tpb *TablePB) (*Table, error)

TableFromPB creates a table statistics from protobuffer.

func (*Table) String

func (t *Table) String() string

String implements Stringer interface.

func (*Table) ToPB

func (t *Table) ToPB() (*TablePB, error)

ToPB converts Table to TablePB.

type TablePB

type TablePB struct {
	Id               *int64      `protobuf:"varint,1,opt,name=id" json:"id,omitempty"`
	Ts               *int64      `protobuf:"varint,2,opt,name=ts" json:"ts,omitempty"`
	Count            *int64      `protobuf:"varint,3,opt,name=count" json:"count,omitempty"`
	Columns          []*ColumnPB `protobuf:"bytes,4,rep,name=columns" json:"columns,omitempty"`
	XXX_unrecognized []byte      `json:"-"`
}

func (*TablePB) Descriptor

func (*TablePB) Descriptor() ([]byte, []int)

func (*TablePB) GetColumns

func (m *TablePB) GetColumns() []*ColumnPB

func (*TablePB) GetCount

func (m *TablePB) GetCount() int64

func (*TablePB) GetId

func (m *TablePB) GetId() int64

func (*TablePB) GetTs

func (m *TablePB) GetTs() int64

func (*TablePB) ProtoMessage

func (*TablePB) ProtoMessage()

func (*TablePB) Reset

func (m *TablePB) Reset()

func (*TablePB) String

func (m *TablePB) String() string

Jump to

Keyboard shortcuts

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