distsql

package
v2.0.0-rc.4+incompatible Latest Latest
Warning

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

Go to latest
Published: Mar 30, 2018 License: Apache-2.0 Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func IndexRangesToKVRanges

func IndexRangesToKVRanges(sc *stmtctx.StatementContext, tid, idxID int64, ranges []*ranger.NewRange, fb *statistics.QueryFeedback) ([]kv.KeyRange, error)

IndexRangesToKVRanges converts index ranges to "KeyRange".

func TableHandlesToKVRanges

func TableHandlesToKVRanges(tid int64, handles []int64) []kv.KeyRange

TableHandlesToKVRanges converts sorted handle to kv ranges. For continuous handles, we should merge them to a single key range.

func TableRangesToKVRanges

func TableRangesToKVRanges(tid int64, ranges []*ranger.NewRange, fb *statistics.QueryFeedback) []kv.KeyRange

TableRangesToKVRanges converts table ranges to "KeyRange".

Types

type PartialResult

type PartialResult interface {
	// Next returns the next rowData of the sub result.
	// If no more row to return, rowData would be nil.
	Next(context.Context) (rowData []types.Datum, err error)
	// Close closes the partial result.
	Close() error
}

PartialResult is the result from a single region server.

type RequestBuilder

type RequestBuilder struct {
	kv.Request
	// contains filtered or unexported fields
}

RequestBuilder is used to build a "kv.Request". It is called before we issue a kv request by "Select".

func (*RequestBuilder) Build

func (builder *RequestBuilder) Build() (*kv.Request, error)

Build builds a "kv.Request".

func (*RequestBuilder) SetAnalyzeRequest

func (builder *RequestBuilder) SetAnalyzeRequest(ana *tipb.AnalyzeReq) *RequestBuilder

SetAnalyzeRequest sets the request type to "ReqTypeAnalyze" and cosntruct request data.

func (*RequestBuilder) SetChecksumRequest

func (builder *RequestBuilder) SetChecksumRequest(checksum *tipb.ChecksumRequest) *RequestBuilder

SetChecksumRequest sets the request type to "ReqTypeChecksum" and construct request data.

func (*RequestBuilder) SetConcurrency

func (builder *RequestBuilder) SetConcurrency(concurrency int) *RequestBuilder

SetConcurrency sets "Concurrency" for "kv.Request".

func (*RequestBuilder) SetDAGRequest

func (builder *RequestBuilder) SetDAGRequest(dag *tipb.DAGRequest) *RequestBuilder

SetDAGRequest sets the request type to "ReqTypeDAG" and cosntruct request data.

func (*RequestBuilder) SetDesc

func (builder *RequestBuilder) SetDesc(desc bool) *RequestBuilder

SetDesc sets "Desc" for "kv.Request".

func (*RequestBuilder) SetFromSessionVars

func (builder *RequestBuilder) SetFromSessionVars(sv *variable.SessionVars) *RequestBuilder

SetFromSessionVars sets the following fields for "kv.Request" from session variables: "Concurrency", "IsolationLevel", "NotFillCache".

func (*RequestBuilder) SetIndexRanges

func (builder *RequestBuilder) SetIndexRanges(sc *stmtctx.StatementContext, tid, idxID int64, ranges []*ranger.NewRange) *RequestBuilder

SetIndexRanges sets "KeyRanges" for "kv.Request" by converting index range "ranges" to "KeyRanges" firstly.

func (*RequestBuilder) SetKeepOrder

func (builder *RequestBuilder) SetKeepOrder(order bool) *RequestBuilder

SetKeepOrder sets "KeepOrder" for "kv.Request".

func (*RequestBuilder) SetKeyRanges

func (builder *RequestBuilder) SetKeyRanges(keyRanges []kv.KeyRange) *RequestBuilder

SetKeyRanges sets "KeyRanges" for "kv.Request".

func (*RequestBuilder) SetPriority

func (builder *RequestBuilder) SetPriority(priority int) *RequestBuilder

SetPriority sets "Priority" for "kv.Request".

func (*RequestBuilder) SetStreaming

func (builder *RequestBuilder) SetStreaming(streaming bool) *RequestBuilder

SetStreaming sets "Streaming" flag for "kv.Request".

func (*RequestBuilder) SetTableHandles

func (builder *RequestBuilder) SetTableHandles(tid int64, handles []int64) *RequestBuilder

SetTableHandles sets "KeyRanges" for "kv.Request" by converting table handles "handles" to "KeyRanges" firstly.

func (*RequestBuilder) SetTableRanges

func (builder *RequestBuilder) SetTableRanges(tid int64, tableRanges []*ranger.NewRange, fb *statistics.QueryFeedback) *RequestBuilder

SetTableRanges sets "KeyRanges" for "kv.Request" by converting "tableRanges" to "KeyRanges" firstly.

type SelectResult

type SelectResult interface {
	// Next gets the next partial result.
	Next(context.Context) (PartialResult, error)
	// NextRaw gets the next raw result.
	NextRaw(context.Context) ([]byte, error)
	// NextChunk reads the data into chunk.
	NextChunk(context.Context, *chunk.Chunk) error
	// Close closes the iterator.
	Close() error
	// Fetch fetches partial results from client.
	// The caller should call SetFields() before call Fetch().
	Fetch(context.Context)
}

SelectResult is an iterator of coprocessor partial results.

func Analyze

func Analyze(ctx context.Context, client kv.Client, kvReq *kv.Request) (SelectResult, error)

Analyze do a analyze request.

func Checksum

func Checksum(ctx context.Context, client kv.Client, kvReq *kv.Request) (SelectResult, error)

Checksum sends a checksum request.

func Select

func Select(ctx context.Context, sctx sessionctx.Context, kvReq *kv.Request, fieldTypes []*types.FieldType, fb *statistics.QueryFeedback) (SelectResult, error)

Select sends a DAG request, returns SelectResult. In kvReq, KeyRanges is required, Concurrency/KeepOrder/Desc/IsolationLevel/Priority are optional.

Jump to

Keyboard shortcuts

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