tidb: github.com/pingcap/tidb/executor/aggfuncs Index | Files

package aggfuncs

import "github.com/pingcap/tidb/executor/aggfuncs"

Index

Package Files

aggfuncs.go builder.go func_avg.go func_bitfuncs.go func_count.go func_cume_dist.go func_first_row.go func_group_concat.go func_lead_lag.go func_max_min.go func_ntile.go func_percent_rank.go func_rank.go func_sum.go func_value.go row_number.go

type AggFunc Uses

type AggFunc interface {
    // AllocPartialResult allocates a specific data structure to store the
    // partial result, initializes it, and converts it to PartialResult to
    // return back. Aggregate operator implementation, no matter it's a hash
    // or stream, should hold this allocated PartialResult for the further
    // operations like: "ResetPartialResult", "UpdatePartialResult".
    AllocPartialResult() PartialResult

    // ResetPartialResult resets the partial result to the original state for a
    // specific aggregate function. It converts the input PartialResult to the
    // specific data structure which stores the partial result and then reset
    // every field to the proper original state.
    ResetPartialResult(pr PartialResult)

    // UpdatePartialResult updates the specific partial result for an aggregate
    // function using the input rows which all belonging to the same data group.
    // It converts the PartialResult to the specific data structure which stores
    // the partial result and then iterates on the input rows and update that
    // partial result according to the functionality and the state of the
    // aggregate function.
    UpdatePartialResult(sctx sessionctx.Context, rowsInGroup []chunk.Row, pr PartialResult) error

    // MergePartialResult will be called in the final phase when parallelly
    // executing. It converts the PartialResult `src`, `dst` to the same specific
    // data structure which stores the partial results, and then evaluate the
    // final result using the partial results as input values.
    MergePartialResult(sctx sessionctx.Context, src, dst PartialResult) error

    // AppendFinalResult2Chunk finalizes the partial result and append the
    // final result to the input chunk. Like other operations, it converts the
    // input PartialResult to the specific data structure which stores the
    // partial result and then calculates the final result and append that
    // final result to the chunk provided.
    AppendFinalResult2Chunk(sctx sessionctx.Context, pr PartialResult, chk *chunk.Chunk) error
}

AggFunc is the interface to evaluate the aggregate functions.

func Build Uses

func Build(ctx sessionctx.Context, aggFuncDesc *aggregation.AggFuncDesc, ordinal int) AggFunc

Build is used to build a specific AggFunc implementation according to the input aggFuncDesc.

func BuildWindowFunctions Uses

func BuildWindowFunctions(ctx sessionctx.Context, windowFuncDesc *aggregation.AggFuncDesc, ordinal int, orderByCols []*expression.Column) AggFunc

BuildWindowFunctions builds specific window function according to function description and order by columns.

type PartialResult Uses

type PartialResult unsafe.Pointer

PartialResult represents data structure to store the partial result for the aggregate functions. Here we use unsafe.Pointer to allow the partial result to be any type.

Package aggfuncs imports 22 packages (graph) and is imported by 7 packages. Updated 2019-09-03. Refresh now. Tools for package owners.