tidb: github.com/pingcap/tidb/distsql Index | Files

package distsql

import "github.com/pingcap/tidb/distsql"

Index

Package Files

distsql.go request_builder.go select_result.go stream.go

func IndexRangesToKVRanges Uses

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

IndexRangesToKVRanges converts index ranges to "KeyRange".

func TableHandlesToKVRanges Uses

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 Uses

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

TableRangesToKVRanges converts table ranges to "KeyRange".

type RequestBuilder Uses

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 Uses

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

Build builds a "kv.Request".

func (*RequestBuilder) SetAnalyzeRequest Uses

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

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

func (*RequestBuilder) SetChecksumRequest Uses

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

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

func (*RequestBuilder) SetConcurrency Uses

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

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

func (*RequestBuilder) SetDAGRequest Uses

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

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

func (*RequestBuilder) SetDesc Uses

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

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

func (*RequestBuilder) SetFromSessionVars Uses

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

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

func (*RequestBuilder) SetIndexRanges Uses

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

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

func (*RequestBuilder) SetKeepOrder Uses

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

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

func (*RequestBuilder) SetKeyRanges Uses

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

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

func (*RequestBuilder) SetMemTracker Uses

func (builder *RequestBuilder) SetMemTracker(tracker *memory.Tracker) *RequestBuilder

SetMemTracker sets a memTracker for this request.

func (*RequestBuilder) SetStreaming Uses

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

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

func (*RequestBuilder) SetTableHandles Uses

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 Uses

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

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

type SelectResult Uses

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

SelectResult is an iterator of coprocessor partial results.

func Analyze Uses

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

Analyze do a analyze request.

func Checksum Uses

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

Checksum sends a checksum request.

func Select Uses

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.

func SelectWithRuntimeStats Uses

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

SelectWithRuntimeStats sends a DAG request, returns SelectResult. The difference from Select is that SelectWithRuntimeStats will set copPlanIDs into selectResult, which can help selectResult to collect runtime stats.

Package distsql imports 23 packages (graph) and is imported by 42 packages. Updated 2019-09-18. Refresh now. Tools for package owners.