Any()(聚合函数)any() (aggregation function)

任意为汇总运算符中的每个组选择一条记录,并返回对每个此类记录的一个或多个表达式的值。Arbitrarily chooses one record for each group in a summarize operator, and returns the value of one or more expressions over each such record.


summarize any ( ( Expr [, Expr2 ...]) | * )summarize any ( ( Expr [, Expr2 ...]) | * )


  • Expr:从要返回的输入中选择的每条记录的表达式。Expr : An expression over each record selected from the input to return.
  • Expr2Expr2 .. ExprN :其他表达式。ExprN : Additional expressions.


any 聚合函数返回为每个记录计算的表达式的值,这些值是从每组汇总运算符中随机选择的。The any aggregation function returns the values of the expressions calculated for each of the records, selected randomly from each group of the summarize operator.

如果提供了 * 参数,则该函数的行为就像表达式是汇总运算符禁止分组依据列(如果有)的输入的所有列一样。If the * argument is provided, the function behaves as if the expressions are all columns of the input to the summarize operator barring the group-by columns, if any.


此函数有助于获取每个复合组键值的一列或多列的示例值。This function is useful when you want to get a sample value of one or more columns per value of the compound group key.

当使用单个列引用提供函数时,该函数将尝试返回非 null/非空值(如果存在此类值)。When the function is provided with a single column reference, it will attempt to return a non-null/non-empty value, if such value is present.

由于此函数的随机本质,在 summarize 运算符的单个应用中多次使用该函数并不等效于单次将其用于多个表达式。As a result of the random nature of this function, using it multiple times in a single application of the summarize operator is not equivalent to using it a single time with multiple expressions. 前者可以让每个应用选择不同的记录,而后者可保证所有值都是通过单个记录(每个不同的组)计算得出的。The former may have each application select a different record, while the latter guarantees that all values are calculated over a single record (per distinct group).


显示随机洲:Show Random Continent:

Continents | summarize any(Continent)

Any 1

显示随机记录的所有详细信息:Show all the details for a random record:

Continents | summarize any(*)

Any 2

显示每个随机洲的所有详细信息:Show all the details for each random continent:

Continents | summarize any(*) by Continent

Any 3