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

返回组中“Expr”的所有值的 dynamic (JSON) 数组,其 Predicate 的计算结果为 trueReturns a dynamic (JSON) array of all the values of Expr in the group, for which Predicate evaluates to true.

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

语法Syntax

summarize make_list_if(Expr, Predicate [, MaxSize])summarize make_list_if(Expr, Predicate [, MaxSize])

参数Arguments

  • Expr:用于聚合计算的表达式。Expr: Expression that will be used for aggregation calculation.
  • 谓词:必须计算为 true 的谓词,用于将“Expr”添加到结果中。Predicate: Predicate that has to evaluate to true, in order for Expr to be added to the result.
  • MaxSize 是对返回元素最大数目的可选整数限制(默认值是 1048576)。MaxSize is an optional integer limit on the maximum number of elements returned (default is 1048576). MaxSize 值不能超过 1048576。MaxSize value cannot exceed 1048576.

返回Returns

返回组中“Expr”的所有值的 dynamic (JSON) 数组,其 Predicate 的计算结果为 trueReturns a dynamic (JSON) array of all the values of Expr in the group, for which Predicate evaluates to true. 如果未对 summarize 运算符的输入进行排序,那么生成的数组中的元素顺序是不确定的。If the input to the summarize operator is not sorted, the order of elements in the resulting array is undefined. 如果对 summarize 运算符的输入进行了排序,则生成的数组中的元素顺序和输入一样。If the input to the summarize operator is sorted, the order of elements in the resulting array tracks that of the input.

示例Example

let T = datatable(name:string, day_of_birth:long)
[
   "John", 9,
   "Paul", 18,
   "George", 25,
   "Ringo", 7
];
T
| summarize make_list_if(name, strlen(name) > 4)
list_namelist_name
["George", "Ringo"]["George", "Ringo"]

另请参阅See also

make_list 函数,它在无谓词表达式的情况下执行相同的操作。make_list function, which does the same, without predicate expression.