aggregation

package
v0.0.0-...-3903214 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 6, 2021 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AggEvaluateContext

type AggEvaluateContext struct {
	DistinctChecker *distinctChecker
	Count           int64
	Value           types.Datum
	Buffer          *bytes.Buffer // Buffer is used for group_concat.
	GotFirstRow     bool          // It will check if the agg has met the first row key.
}

AggEvaluateContext is used to store intermediate result when calculating aggregate functions.

type AggFuncDesc

type AggFuncDesc struct {

	// Mode represents the execution mode of the aggregation function.
	//Mode AggFunctionMode
	// HasDistinct represents whether the aggregation function contains distinct attribute.
	HasDistinct bool
	// contains filtered or unexported fields
}

AggFuncDesc describes an aggregation function signature, only used in planner.

func NewAggFuncDesc

func NewAggFuncDesc(ctx sctx.Context, name string, args []expression.Expression, hasDistinct bool) (*AggFuncDesc, error)

NewAggFuncDesc creates an aggregation function signature descriptor.

func (*AggFuncDesc) GetAggFunc

func (a *AggFuncDesc) GetAggFunc(ctx sctx.Context) Aggregation

GetAggFunc gets an evaluator according to the aggregation function signature.

type Aggregation

type Aggregation interface {
	// Update during executing.
	Update(evalCtx *AggEvaluateContext, sc *stmtctx.StatementContext, row chunk.Row) error

	// GetPartialResult will called by coprocessor to get partial results. For avg function, partial results will return
	// sum and count values at the same time.
	GetPartialResult(evalCtx *AggEvaluateContext) []types.Datum

	// GetResult will be called when all data have been processed.
	GetResult(evalCtx *AggEvaluateContext) types.Datum

	// CreateContext creates a new AggEvaluateContext for the aggregation function.
	CreateContext(sc *stmtctx.StatementContext) *AggEvaluateContext

	// ResetContext resets the content of the evaluate context.
	ResetContext(sc *stmtctx.StatementContext, evalCtx *AggEvaluateContext)
}

Aggregation stands for aggregate functions.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL