Documentation ¶
Index ¶
- type AggFuncDesc
- func (a *AggFuncDesc) Clone() *AggFuncDesc
- func (a *AggFuncDesc) Equal(ctx sessionctx.Context, other *AggFuncDesc) bool
- func (a *AggFuncDesc) EvalNullValueInOuterJoin(ctx sessionctx.Context, schema *expression.Schema) (types.Datum, bool)
- func (a *AggFuncDesc) Split(ordinal []int) (partialAggDesc, finalAggDesc *AggFuncDesc)
- func (a *AggFuncDesc) String() string
- func (a *AggFuncDesc) UpdateNotNullFlag4RetType(hasGroupBy, allAggsFirstRow bool) error
- func (a *AggFuncDesc) WrapCastAsDecimalForAggArgs(ctx sessionctx.Context)
- func (a *AggFuncDesc) WrapCastForAggArgs(ctx sessionctx.Context)
- type AggFunctionMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
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 // OrderByItems represents the order by clause used in GROUP_CONCAT OrderByItems []*util.ByItems // contains filtered or unexported fields }
AggFuncDesc describes an aggregation function signature, only used in planner.
func NewAggFuncDesc ¶
func NewAggFuncDesc(ctx sessionctx.Context, name string, args []expression.Expression, hasDistinct bool) (*AggFuncDesc, error)
NewAggFuncDesc creates an aggregation function signature descriptor.
func (*AggFuncDesc) Clone ¶
func (a *AggFuncDesc) Clone() *AggFuncDesc
Clone copies an aggregation function signature totally.
func (*AggFuncDesc) Equal ¶
func (a *AggFuncDesc) Equal(ctx sessionctx.Context, other *AggFuncDesc) bool
Equal checks whether two aggregation function signatures are equal.
func (*AggFuncDesc) EvalNullValueInOuterJoin ¶
func (a *AggFuncDesc) EvalNullValueInOuterJoin(ctx sessionctx.Context, schema *expression.Schema) (types.Datum, bool)
EvalNullValueInOuterJoin gets the null value when the aggregation is upon an outer join, and the aggregation function's input is null. If there is no matching row for the inner table of an outer join, an aggregation function only involves constant and/or columns belongs to the inner table will be set to the null value. The input stands for the schema of Aggregation's child. If the function can't produce a null value, the second return value will be false. e.g. Table t with only one row: +-------+---------+---------+ | Table | Field | Type | +-------+---------+---------+ | t | a | int(11) | +-------+---------+---------+ +------+ | a | +------+ | 1 | +------+
Table s which is empty: +-------+---------+---------+ | Table | Field | Type | +-------+---------+---------+ | s | a | int(11) | +-------+---------+---------+
Query: `select t.a as `t.a`, count(95), sum(95), avg(95), bit_or(95), bit_and(95), bit_or(95), max(95), min(95), s.a as `s.a`, avg(95) from t left join s on t.a = s.a;` +------+-----------+---------+---------+------------+-------------+------------+---------+---------+------+----------+ | t.a | count(95) | sum(95) | avg(95) | bit_or(95) | bit_and(95) | bit_or(95) | max(95) | min(95) | s.a | avg(s.a) | +------+-----------+---------+---------+------------+-------------+------------+---------+---------+------+----------+ | 1 | 1 | 95 | 95.0000 | 95 | 95 | 95 | 95 | 95 | NULL | NULL | +------+-----------+---------+---------+------------+-------------+------------+---------+---------+------+----------+
func (*AggFuncDesc) Split ¶
func (a *AggFuncDesc) Split(ordinal []int) (partialAggDesc, finalAggDesc *AggFuncDesc)
Split splits `a` into two aggregate descriptors for partial phase and final phase individually. This function is only used when executing aggregate function parallelly. ordinal indicates the column ordinal of the intermediate result.
func (*AggFuncDesc) String ¶
func (a *AggFuncDesc) String() string
String implements the fmt.Stringer interface.
func (*AggFuncDesc) UpdateNotNullFlag4RetType ¶
func (a *AggFuncDesc) UpdateNotNullFlag4RetType(hasGroupBy, allAggsFirstRow bool) error
UpdateNotNullFlag4RetType checks if we should remove the NotNull flag for the return type of the agg.
func (*AggFuncDesc) WrapCastAsDecimalForAggArgs ¶
func (a *AggFuncDesc) WrapCastAsDecimalForAggArgs(ctx sessionctx.Context)
WrapCastAsDecimalForAggArgs wraps the args of some specific aggregate functions with a cast as decimal function. See issue #19426
func (*AggFuncDesc) WrapCastForAggArgs ¶
func (a *AggFuncDesc) WrapCastForAggArgs(ctx sessionctx.Context)
WrapCastForAggArgs wraps the args of an aggregate function with a cast function.
type AggFunctionMode ¶
type AggFunctionMode int
AggFunctionMode stands for the aggregation function's mode.
const ( CompleteMode AggFunctionMode = iota FinalMode Partial1Mode Partial2Mode )
|-----------------|--------------|--------------| | AggFunctionMode | input | output | |-----------------|--------------|--------------| | CompleteMode | origin data | final result | | FinalMode | partial data | final result | | Partial1Mode | origin data | partial data | | Partial2Mode | partial data | partial data | | DedupMode | origin data | origin data | |-----------------|--------------|--------------|