Documentation ¶
Index ¶
- func IndexRangesToKVRanges(sc *stmtctx.StatementContext, tid, idxID int64, ranges []*ranger.NewRange, ...) ([]kv.KeyRange, error)
- func TableHandlesToKVRanges(tid int64, handles []int64) []kv.KeyRange
- func TableRangesToKVRanges(tid int64, ranges []*ranger.NewRange, 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.NewRange) *RequestBuilder
- func (builder *RequestBuilder) SetKeepOrder(order bool) *RequestBuilder
- func (builder *RequestBuilder) SetKeyRanges(keyRanges []kv.KeyRange) *RequestBuilder
- func (builder *RequestBuilder) SetPriority(priority int) *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.NewRange, fb *statistics.QueryFeedback) *RequestBuilder
- type SelectResult
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 ¶
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 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 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 { // 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 // 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 ¶
Analyze do a analyze request.
func Checksum ¶
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.