當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。