Documentation
¶
Index ¶
- func GetGroupKey(ctx sessionctx.Context, input *chunk.Chunk, groupKey [][]byte, ...) ([][]byte, error)
- type AfFinalResult
- type AggPartialResultMapper
- type AggSpillDiskAction
- type AggWorkerInfo
- type AggWorkerStat
- type HashAggExec
- type HashAggFinalWorker
- type HashAggInput
- type HashAggIntermData
- type HashAggPartialWorker
- type HashAggRuntimeStats
- 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 AggPartialResultMapper ¶
type AggPartialResultMapper map[string][]aggfuncs.PartialResult
AggPartialResultMapper contains aggregate function results
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() *AggSpillDiskAction
ActionSpill returns a AggSpillDiskAction for spilling intermediate data for hashAgg.
func (*HashAggExec) Close ¶
func (e *HashAggExec) Close() error
Close implements the Executor Close interface.
type HashAggFinalWorker ¶
type HashAggFinalWorker struct {
// 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 HashAggIntermData ¶
type HashAggIntermData struct {
// contains filtered or unexported fields
}
HashAggIntermData indicates the intermediate data of aggregation execution.
type HashAggPartialWorker ¶
type HashAggPartialWorker struct {
// 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 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.