isSuperset
Description
Returns true if array1 is a superset of array2, or false otherwise.
- When comparing
array1andarray2, duplicates are discarded. This means two arrays of different lengths but with the same unique elements are considered equal. - Supported element types include
string,bool,number,interval,timestamp,regexp, andenum.
Syntax
Like many functions in DataPrime, isSuperset supports two notations, function and method notation. These interchangeable forms allow flexibility in how you structure expressions.
Arguments
| Name | Type | Required | Description |
|---|---|---|---|
| array1 | array | true | The array to test as a superset |
| array2 | array | true | The array to test against, must be fully contained within array1 |
Example
Use case: Verify if all jobs contain the started jobs
Suppose you want to confirm that a list of all jobs includes every job that has been started. Consider the following input:
By applying isSuperset, you can verify that all_jobs fully contains the elements in started_jobs.
Example query
Example output
The result will include a new field is_superset indicating whether the superset condition is satisfied:
{
"all_jobs": ["Chris", "John", "Adam", "Ariel", "Zev"],
"started_jobs": ["Chris", "John"],
"is_superset": true
}
Theme
Light