Skip to content

Set

Set operations: union, intersection, difference, unique.

4 modules

ModuleDescription
Set DifferenceGet elements in first array but not in others
Set IntersectionGet intersection of two or more arrays
Set UnionGet union of two or more arrays
Set UniqueRemove duplicate elements from array

Modules

Set Difference

set.difference

Get elements in first array but not in others

Parameters:

NameTypeRequiredDefaultDescription
sourcearrayYes-Source array
excludearrayYes-Source array

Output:

FieldTypeDescription
resultarrayArrays of elements to exclude
countnumberElements in source but not in exclude arrays
removed_countnumberElements in source but not in exclude arrays

Set Intersection

set.intersection

Get intersection of two or more arrays

Parameters:

NameTypeRequiredDefaultDescription
arraysarrayYes-Arrays to intersect (array of arrays)

Output:

FieldTypeDescription
resultarrayArrays to intersect (array of arrays)
countnumberIntersection of all arrays

Set Union

set.union

Get union of two or more arrays

Parameters:

NameTypeRequiredDefaultDescription
arraysarrayYes-Arrays to combine (array of arrays)

Output:

FieldTypeDescription
resultarrayArrays to combine (array of arrays)
countnumberUnion of all arrays

Set Unique

set.unique

Remove duplicate elements from array

Parameters:

NameTypeRequiredDefaultDescription
arrayarrayYes-Array to deduplicate
preserve_orderbooleanNoTrueArray to deduplicate

Output:

FieldTypeDescription
resultarrayKeep first occurrence order
countnumberArray with unique elements
duplicates_removednumberArray with unique elements

Released under the Apache 2.0 License.