Copy as Markdown[Open in ChatGPT](https://chatgpt.com/?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Farray%2Fissuperset.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)[Open in Claude](https://claude.ai/new?q=Read%20https%3A%2F%2Fdocs-docusaurus.kinsta.page%2Fdataprime%2Flanguage-reference%2Ffunctions-reference%2Farray%2Fissuperset.md%20and%20help%20me%20with%20my%20question%20about%20this%20Coralogix%20documentation%20page.)

# `isSuperset`

## Description

Returns `true` if `array1` is a superset of `array2`, or `false` otherwise.

* When comparing `array1` and `array2`, 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`, and `enum`.

## Syntax

Like many functions in DataPrime, `isSuperset` supports<!-- --> [two notations](https://docs-docusaurus.kinsta.page/dataprime/language-reference/functions-reference/.md),<!-- --> **function** and **method**. These interchangeable forms allow flexibility in how you structure expressions.

* Function notation
* Method notation

```
isSuperset(array1: array<T>, array2: array<T>): bool
```

```
(array1: array<T>).isSuperset(array2: array<T>): bool
```

## Arguments

| Name     | Type       | Required | Description                                                        |
| -------- | ---------- | -------- | ------------------------------------------------------------------ |
| `array1` | `array<T>` | **true** | The array to test as a superset                                    |
| `array2` | `array<T>` | **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:

```
{

    "all_jobs": ["Chris", "John", "Adam", "Ariel", "Zev"],

    "started_jobs": ["Chris", "John"]

}
```

By applying `isSuperset`, you can verify that `all_jobs` fully contains the elements in `started_jobs`.

### Example query

* Function notation
* Method notation

```
create is_superset from isSuperset(all_jobs, started_jobs)
```

```
create is_superset from all_jobs.isSuperset(started_jobs)
```

### 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

}
```
