set_difference()set_difference()

返回一个 dynamic (JSON) 数组,其中包含存在于第一个数组中但不存在于其他数组中的所有非重复值的集合 - (((arr1 \ arr2) \ arr3) \ ...)。Returns a dynamic (JSON) array of the set of all distinct values that are in the first array but aren't in other arrays - (((arr1 \ arr2) \ arr3) \ ...).

语法Syntax

set_difference(arr1, arr2[, *arr3*, ...])set_difference(arr1, arr2[, *arr3*, ...])

参数Arguments

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

返回Returns

返回一个动态数组,其中包含存在于 arr1 中但不存在于其他数组中的所有非重复值的集合。Returns a dynamic array of the set of all distinct values that are in arr1 but aren't in other arrays. 请参阅 set_union()set_intersect()See set_union() and set_intersect().

示例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(x,y,w)
| project set_difference(a1, a2, a3)
Column1Column1
[4][4]
[8][8]
 [12][12]
print arr = set_difference(dynamic([1,2,3]), dynamic([1,2,3]))
arrarr
[][]