Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AggFunc ¶
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 ¶
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 ¶
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 ¶
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.
type SlidingWindowAggFunc ¶
type SlidingWindowAggFunc interface { // Slide evaluates the aggregate functions using a sliding window. The input // lastStart and lastEnd are the interval of the former sliding window, // shiftStart, shiftEnd mean the sliding window offset. Note that the input // PartialResult stores the intermediate result which will be used in the next // sliding window, ensure call ResetPartialResult after a frame are evaluated // completely. Slide(sctx sessionctx.Context, rows []chunk.Row, lastStart, lastEnd uint64, shiftStart, shiftEnd uint64, pr PartialResult) error }
SlidingWindowAggFunc is the interface to evaluate the aggregate functions using sliding window.
Source Files ¶
- aggfuncs.go
- builder.go
- func_avg.go
- func_bitfuncs.go
- func_count.go
- func_count_distinct.go
- func_cume_dist.go
- func_first_row.go
- func_group_concat.go
- func_json_objectagg.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
- func_varpop.go
- row_number.go
Click to show internal directories.
Click to hide internal directories.