本文整理汇总了Golang中github.com/pingcap/tidb/expression.AggregationFunction.SetMode方法的典型用法代码示例。如果您正苦于以下问题:Golang AggregationFunction.SetMode方法的具体用法?Golang AggregationFunction.SetMode怎么用?Golang AggregationFunction.SetMode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类github.com/pingcap/tidb/expression.AggregationFunction
的用法示例。
在下文中一共展示了AggregationFunction.SetMode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。
示例1: decompose
// decompose splits an aggregate function to two parts: a final mode function and a partial mode function. Currently
// there are no differences between partial mode and complete mode, so we can confuse them.
func (a *aggPushDownSolver) decompose(aggFunc expression.AggregationFunction, schema expression.Schema, id string) ([]expression.AggregationFunction, expression.Schema) {
// Result is a slice because avg should be decomposed to sum and count. Currently we don't process this case.
result := []expression.AggregationFunction{aggFunc.Clone()}
for _, aggFunc := range result {
schema = append(schema, &expression.Column{
ColName: model.NewCIStr(fmt.Sprintf("join_agg_%d", len(schema))), // useless but for debug
FromID: id,
Position: len(schema),
RetType: aggFunc.GetType(),
})
}
aggFunc.SetArgs(expression.Schema2Exprs(schema[len(schema)-len(result):]))
aggFunc.SetMode(expression.FinalMode)
return result, schema
}