set_union()set_union()

返回一个 dynamic 数组,其中包含在任意数组 (arr1 ∪ arr2 ∪ ...) 中的所有非重复值的集合。Returns a dynamic array of the set of all distinct values that are in any of arrays - (arr1 ∪ arr2 ∪ ...).

语法Syntax

set_union(arr1, arr2[, *arr3*, ...]``)set_union(arr1, arr2[, *arr3*, ...]``)

参数Arguments

  • arr1...arrN:用于创建并集的输入数组(至少两个数组)。arr1...arrN : Input arrays to create a union set (at least two arrays). 所有参数都必须是动态数组(请参阅 pack_array)。All arguments must be dynamic arrays (see pack_array).

返回Returns

返回一个动态数组,其中包含在任意数组中的所有非重复值的集合。Returns a dynamic array of the set of all distinct values that are in any of arrays. 请参阅 set_intersect()set_difference()See set_intersect() and set_difference().

示例Example

range x from 1 to 3 step 1
| extend y = x * 2
| extend z = y * 2
| extend w = z * 2
| extend a1 = pack_array(x,y,x,z), a2 = pack_array(x, y), a3 = pack_array(w)
| project set_union(a1, a2, a3)
Column1Column1
[1,2,4,8][1,2,4,8]
[2,4,8,16][2,4,8,16]
[3,6,12,24][3,6,12,24]