Documentation ¶
Index ¶
- func GetGroupKey(ctx sessionctx.Context, input *chunk.Chunk, groupKey [][]byte, ...) ([][]byte, error)
- type AfFinalResult
- type AggSpillDiskAction
- type AggWorkerInfo
- type AggWorkerStat
- type HashAggExec
- func (e *HashAggExec) ActionSpill() memory.ActionOnExceed
- func (e *HashAggExec) Close() error
- func (e *HashAggExec) IsInvalidMemoryUsageTrackingForTest() bool
- func (e *HashAggExec) IsSpillTriggeredForTest() bool
- func (e *HashAggExec) Next(ctx context.Context, req *chunk.Chunk) error
- func (e *HashAggExec) Open(ctx context.Context) error
- func (e *HashAggExec) OpenSelf() error
- type HashAggFinalWorker
- type HashAggInput
- type HashAggPartialWorker
- type HashAggRuntimeStats
- type ParallelAggSpillDiskAction
- type StreamAggExec
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func GetGroupKey ¶
func GetGroupKey(ctx sessionctx.Context, input *chunk.Chunk, groupKey [][]byte, groupByItems []expression.Expression) ([][]byte, error)
GetGroupKey evaluates the group items and args of aggregate functions.
Types ¶
type AfFinalResult ¶
type AfFinalResult struct {
// contains filtered or unexported fields
}
AfFinalResult indicates aggregation functions final result.
type AggSpillDiskAction ¶
type AggSpillDiskAction struct { memory.BaseOOMAction // contains filtered or unexported fields }
AggSpillDiskAction implements memory.ActionOnExceed for unparalleled HashAgg. If the memory quota of a query is exceeded, AggSpillDiskAction.Action is triggered.
func (*AggSpillDiskAction) Action ¶
func (a *AggSpillDiskAction) Action(t *memory.Tracker)
Action set HashAggExec spill mode.
func (*AggSpillDiskAction) GetPriority ¶
func (*AggSpillDiskAction) GetPriority() int64
GetPriority get the priority of the Action
type AggWorkerInfo ¶
AggWorkerInfo contains the agg worker information.
type AggWorkerStat ¶
AggWorkerStat record the AggWorker runtime stat
func (*AggWorkerStat) Clone ¶
func (w *AggWorkerStat) Clone() *AggWorkerStat
Clone implements the RuntimeStats interface.
type HashAggExec ¶
type HashAggExec struct { exec.BaseExecutor Sc *stmtctx.StatementContext PartialAggFuncs []aggfuncs.AggFunc FinalAggFuncs []aggfuncs.AggFunc GroupByItems []expression.Expression DefaultVal *chunk.Chunk // IsChildReturnEmpty indicates whether the child executor only returns an empty input. IsChildReturnEmpty bool // After we support parallel execution for aggregation functions with distinct, // we can remove this attribute. IsUnparallelExec bool // contains filtered or unexported fields }
HashAggExec deals with all the aggregate functions. It is built from the Aggregate Plan. When Next() is called, it reads all the data from Src and updates all the items in PartialAggFuncs. The parallel execution flow is as the following graph shows:
+-------------+ | Main Thread | +------+------+ ^ | + +-+- +-+ | | ...... | | finalOutputCh +++- +-+ ^ | +---------------+ | | +--------------+ +--------------+ | final worker | ...... | final worker | +------------+-+ +-+------------+ ^ ^ | | +-+ +-+ ...... +-+ | | | | | | ... ... ... partialOutputChs | | | | | | +++ +++ +++ ^ ^ ^ +-+ | | | | | +--------o----+ | inputCh +-+ | +-----------------+---+ | | | | ... +---+------------+ +----+-----------+ | | | partial worker | ...... | partial worker | +++ +--------------+-+ +-+--------------+ | ^ ^ | | | +----v---------+ +++ +-+ +++ | data fetcher | +------> | | | | ...... | | partialInputChs +--------------+ +-+ +-+ +-+
func (*HashAggExec) ActionSpill ¶
func (e *HashAggExec) ActionSpill() memory.ActionOnExceed
ActionSpill returns an action for spilling intermediate data for hashAgg.
func (*HashAggExec) Close ¶
func (e *HashAggExec) Close() error
Close implements the Executor Close interface.
func (*HashAggExec) IsInvalidMemoryUsageTrackingForTest ¶
func (e *HashAggExec) IsInvalidMemoryUsageTrackingForTest() bool
IsInvalidMemoryUsageTrackingForTest is for test
func (*HashAggExec) IsSpillTriggeredForTest ¶
func (e *HashAggExec) IsSpillTriggeredForTest() bool
IsSpillTriggeredForTest is for test.
func (*HashAggExec) Open ¶
func (e *HashAggExec) Open(ctx context.Context) error
Open implements the Executor Open interface.
func (*HashAggExec) OpenSelf ¶
func (e *HashAggExec) OpenSelf() error
OpenSelf just opens the hash aggregation executor.
type HashAggFinalWorker ¶
type HashAggFinalWorker struct { BInMap int // contains filtered or unexported fields }
HashAggFinalWorker indicates the final workers of parallel hash agg execution, the number of the worker can be set by `tidb_hashagg_final_concurrency`.
type HashAggInput ¶
type HashAggInput struct {
// contains filtered or unexported fields
}
HashAggInput indicates the input of hash agg exec.
type HashAggPartialWorker ¶
type HashAggPartialWorker struct { BInMaps []int // contains filtered or unexported fields }
HashAggPartialWorker indicates the partial workers of parallel hash agg execution, the number of the worker can be set by `tidb_hashagg_partial_concurrency`.
type HashAggRuntimeStats ¶
type HashAggRuntimeStats struct { PartialConcurrency int PartialWallTime int64 FinalConcurrency int FinalWallTime int64 PartialStats []*AggWorkerStat FinalStats []*AggWorkerStat }
HashAggRuntimeStats record the HashAggExec runtime stat
func (*HashAggRuntimeStats) Clone ¶
func (e *HashAggRuntimeStats) Clone() execdetails.RuntimeStats
Clone implements the RuntimeStats interface.
func (*HashAggRuntimeStats) Merge ¶
func (e *HashAggRuntimeStats) Merge(other execdetails.RuntimeStats)
Merge implements the RuntimeStats interface.
func (*HashAggRuntimeStats) String ¶
func (e *HashAggRuntimeStats) String() string
String implements the RuntimeStats interface.
func (*HashAggRuntimeStats) Tp ¶
func (*HashAggRuntimeStats) Tp() int
Tp implements the RuntimeStats interface.
type ParallelAggSpillDiskAction ¶
type ParallelAggSpillDiskAction struct { memory.BaseOOMAction // contains filtered or unexported fields }
ParallelAggSpillDiskAction implements memory.ActionOnExceed for parallel HashAgg.
func (*ParallelAggSpillDiskAction) Action ¶
func (p *ParallelAggSpillDiskAction) Action(t *memory.Tracker)
Action set HashAggExec spill mode.
func (*ParallelAggSpillDiskAction) GetPriority ¶
func (*ParallelAggSpillDiskAction) GetPriority() int64
GetPriority get the priority of the Action
type StreamAggExec ¶
type StreamAggExec struct { exec.BaseExecutor // IsChildReturnEmpty indicates whether the child executor only returns an empty input. IsChildReturnEmpty bool DefaultVal *chunk.Chunk GroupChecker *vecgroupchecker.VecGroupChecker AggFuncs []aggfuncs.AggFunc // contains filtered or unexported fields }
StreamAggExec deals with all the aggregate functions. It assumes all the input data is sorted by group by key. When Next() is called, it will return a result for the same group.
func (*StreamAggExec) Close ¶
func (e *StreamAggExec) Close() error
Close implements the Executor Close interface.
func (*StreamAggExec) Open ¶
func (e *StreamAggExec) Open(ctx context.Context) error
Open implements the Executor Open interface.
func (*StreamAggExec) OpenSelf ¶
func (e *StreamAggExec) OpenSelf() error
OpenSelf just opens the StreamAggExec.