This page explains how to use the set_union function in APL.
set_union
function in APL to combine two dynamic arrays into one, returning a new array that includes all distinct elements from both. The order of elements in the result isn’t guaranteed and may differ from the original input arrays.
You can use set_union
when you need to merge two arrays and eliminate duplicates. It’s especially useful in scenarios where you need to perform set-based logic, such as comparing user activity across multiple sources, correlating IPs from different datasets, or combining traces or log attributes from different events.
Splunk SPL users
set_union
works similarly to using mvappend
followed by mvdedup
in SPL. While SPL stores multivalue fields and uses field-based manipulation, APL focuses on dynamic arrays. You need to explicitly apply set logic in APL using functions like set_union
.ANSI SQL users
set_union
. However, conceptually, set_union
behaves like applying UNION
between two subqueries that return one column each, followed by a DISTINCT
.Name | Type | Description |
---|---|---|
Array1 | dynamic | The first array to merge. |
Array2 | dynamic | The second array to merge. |
set_union
to return the union of two arrays.
Query
_time | together |
---|---|
May 22, 11:42:52 | [1, 2, 3, 4, 5 ] |