variance()(聚合函数)variance() (aggregation function)

将某组视为样本,计算该组内 Expr 的方差。Calculates the variance of Expr across the group, considering the group as a sample.

  • 使用的公式:Used formula:

方差示例

  • 只能在 summarize 内的聚合上下文中使用Can be used only in context of aggregation inside summarize

语法Syntax

summarize variance(Expr)summarize variance(Expr)

参数Arguments

  • Expr:用于聚合计算的表达式。Expr : Expression that will be used for aggregation calculation.

返回Returns

组中 Expr 的方差值。The variance value of Expr across the group.

示例Examples

range x from 1 to 5 step 1
| summarize make_list(x), variance(x) 
list_xlist_x variance_xvariance_x
[ 1, 2, 3, 4, 5][ 1, 2, 3, 4, 5] 2.52.5