当前位置: 首页>>代码示例>>Golang>>正文


Golang AggregationFunction.IsDistinct方法代码示例

本文整理汇总了Golang中github.com/pingcap/tidb/expression.AggregationFunction.IsDistinct方法的典型用法代码示例。如果您正苦于以下问题:Golang AggregationFunction.IsDistinct方法的具体用法?Golang AggregationFunction.IsDistinct怎么用?Golang AggregationFunction.IsDistinct使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在github.com/pingcap/tidb/expression.AggregationFunction的用法示例。


在下文中一共展示了AggregationFunction.IsDistinct方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Golang代码示例。

示例1: isDecomposable

// isDecomposable checks if an aggregate function is decomposable. An aggregation function $F$ is decomposable
// if there exist aggregation functions F_1 and F_2 such that F(S_1 union all S_2) = F_2(F_1(S_1),F_1(S_2)),
// where S_1 and S_2 are two sets of values. We call S_1 and S_2 partial groups.
// It's easy to see that max, min, first row is decomposable, no matter whether it's distinct, but sum(distinct) and
// count(distinct) is not.
// Currently we don't support avg and concat.
func (a *aggPushDownSolver) isDecomposable(fun expression.AggregationFunction) bool {
	switch fun.GetName() {
	case ast.AggFuncAvg, ast.AggFuncGroupConcat:
		// TODO: Support avg push down.
		return false
	case ast.AggFuncMax, ast.AggFuncMin, ast.AggFuncFirstRow:
		return true
	case ast.AggFuncSum, ast.AggFuncCount:
		return !fun.IsDistinct()
	default:
		return false
	}
}
开发者ID:pingcap,项目名称:tidb,代码行数:19,代码来源:aggregation_push_down.go


注:本文中的github.com/pingcap/tidb/expression.AggregationFunction.IsDistinct方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。