Documentation ¶
Index ¶
- func IndexRangesToKVRanges(sc *stmtctx.StatementContext, tid, idxID int64, ranges []*ranger.Range, ...) ([]kv.KeyRange, error)
- func TableHandlesToKVRanges(tid int64, handles []int64) []kv.KeyRange
- func TableRangesToKVRanges(tid int64, ranges []*ranger.Range, fb *statistics.QueryFeedback) []kv.KeyRange
- type RequestBuilder
- func (builder *RequestBuilder) Build() (*kv.Request, error)
- func (builder *RequestBuilder) SetAnalyzeRequest(ana *tipb.AnalyzeReq) *RequestBuilder
- func (builder *RequestBuilder) SetChecksumRequest(checksum *tipb.ChecksumRequest) *RequestBuilder
- func (builder *RequestBuilder) SetConcurrency(concurrency int) *RequestBuilder
- func (builder *RequestBuilder) SetDAGRequest(dag *tipb.DAGRequest) *RequestBuilder
- func (builder *RequestBuilder) SetDesc(desc bool) *RequestBuilder
- func (builder *RequestBuilder) SetFromSessionVars(sv *variable.SessionVars) *RequestBuilder
- func (builder *RequestBuilder) SetIndexRanges(sc *stmtctx.StatementContext, tid, idxID int64, ranges []*ranger.Range) *RequestBuilder
- func (builder *RequestBuilder) SetKeepOrder(order bool) *RequestBuilder
- func (builder *RequestBuilder) SetKeyRanges(keyRanges []kv.KeyRange) *RequestBuilder
- func (builder *RequestBuilder) SetMemTracker(sctx sessionctx.Context, label fmt.Stringer) *RequestBuilder
- func (builder *RequestBuilder) SetStreaming(streaming bool) *RequestBuilder
- func (builder *RequestBuilder) SetTableHandles(tid int64, handles []int64) *RequestBuilder
- func (builder *RequestBuilder) SetTableRanges(tid int64, tableRanges []*ranger.Range, fb *statistics.QueryFeedback) *RequestBuilder
- type SelectResult
- func Analyze(ctx context.Context, client kv.Client, kvReq *kv.Request, vars *kv.Variables, ...) (SelectResult, error)
- func Checksum(ctx context.Context, client kv.Client, kvReq *kv.Request, vars *kv.Variables) (SelectResult, error)
- func Select(ctx context.Context, sctx sessionctx.Context, kvReq *kv.Request, ...) (SelectResult, error)
- func SelectWithRuntimeStats(ctx context.Context, sctx sessionctx.Context, kvReq *kv.Request, ...) (SelectResult, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func IndexRangesToKVRanges ¶
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 ¶
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.Range, fb *statistics.QueryFeedback) []kv.KeyRange
TableRangesToKVRanges converts table ranges to "KeyRange".
Types ¶
type RequestBuilder ¶
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 construct 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.Range) *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) SetMemTracker ¶
func (builder *RequestBuilder) SetMemTracker(sctx sessionctx.Context, label fmt.Stringer) *RequestBuilder
SetMemTracker sets a memTracker for this 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.Range, fb *statistics.QueryFeedback) *RequestBuilder
SetTableRanges sets "KeyRanges" for "kv.Request" by converting "tableRanges" to "KeyRanges" firstly.
type SelectResult ¶
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 ¶
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 ¶
func Checksum(ctx context.Context, client kv.Client, kvReq *kv.Request, vars *kv.Variables) (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.
func SelectWithRuntimeStats ¶
func SelectWithRuntimeStats(ctx context.Context, sctx sessionctx.Context, kvReq *kv.Request, fieldTypes []*types.FieldType, fb *statistics.QueryFeedback, copPlanIDs []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.