> ## Documentation Index
> Fetch the complete documentation index at: https://private-7c7dfe99-fix-nav-issues.mintlify.site/llms.txt
> Use this file to discover all available pages before exploring further.

> Documentación de las funciones uniqTheta

# Funciones uniqTheta

Las funciones uniqTheta operan sobre dos objetos uniqThetaSketch para realizar cálculos de operaciones de conjuntos como ∪ / ∩ / × (union/intersect/not) y devuelven un nuevo objeto uniqThetaSketch que contiene el resultado.

Un objeto uniqThetaSketch se construye mediante la función de agregación uniqTheta con -State.

UniqThetaSketch es una estructura de datos para almacenar conjuntos de valores aproximados.
Para obtener más información, consulte: [Theta Sketch Framework](https://datasketches.apache.org/docs/Theta/ThetaSketches.html#theta-sketch-framework).

<div id="uniqthetaunion">
  ## uniqThetaUnion
</div>

Dos objetos `uniqThetaSketch` para realizar una unión (operación de conjuntos ∪); el resultado es un nuevo `uniqThetaSketch`.

```sql theme={null}
uniqThetaUnion(uniqThetaSketch,uniqThetaSketch)
```

**Argumentos**

* `uniqThetaSketch` – objeto uniqThetaSketch.

**Ejemplo**

```sql theme={null}
SELECT finalizeAggregation(uniqThetaUnion(a, b)) AS a_union_b, finalizeAggregation(a) AS a_cardinality, finalizeAggregation(b) AS b_cardinality
FROM
(SELECT arrayReduce('uniqThetaState',[1,2]) AS a, arrayReduce('uniqThetaState',[2,3,4]) AS b );
```

```text theme={null}
┌─a_union_b─┬─a_cardinality─┬─b_cardinality─┐
│         4 │             2 │             3 │
└───────────┴───────────────┴───────────────┘
```

<div id="uniqthetaintersect">
  ## uniqThetaIntersect
</div>

Dos objetos uniqThetaSketch para calcular su intersección (operación de conjuntos ∩); el resultado es un nuevo uniqThetaSketch.

```sql theme={null}
uniqThetaIntersect(uniqThetaSketch,uniqThetaSketch)
```

**Argumentos**

* `uniqThetaSketch` – objeto uniqThetaSketch.

**Ejemplo**

```sql theme={null}
SELECT finalizeAggregation(uniqThetaIntersect(a, b)) AS a_intersect_b, finalizeAggregation(a) AS a_cardinality, finalizeAggregation(b) AS b_cardinality
FROM
(SELECT arrayReduce('uniqThetaState',[1,2]) AS a, arrayReduce('uniqThetaState',[2,3,4]) AS b );
```

```text theme={null}
┌─a_intersect_b─┬─a_cardinality─┬─b_cardinality─┐
│             1 │             2 │             3 │
└───────────────┴───────────────┴───────────────┘
```

<div id="uniqthetanot">
  ## uniqThetaNot
</div>

Dos objetos uniqThetaSketch para realizar un cálculo a\_not\_b (operación de conjuntos ×); el resultado es un nuevo uniqThetaSketch.

```sql theme={null}
uniqThetaNot(uniqThetaSketch,uniqThetaSketch)
```

**Argumentos**

* `uniqThetaSketch` – objeto `uniqThetaSketch`.

**Ejemplo**

```sql theme={null}
SELECT finalizeAggregation(uniqThetaNot(a, b)) AS a_not_b, finalizeAggregation(a) AS a_cardinality, finalizeAggregation(b) AS b_cardinality
FROM
(SELECT arrayReduce('uniqThetaState',[2,3,4]) AS a, arrayReduce('uniqThetaState',[1,2]) AS b );
```

```text theme={null}
┌─a_not_b─┬─a_cardinality─┬─b_cardinality─┐
│       2 │             3 │             2 │
└─────────┴───────────────┴───────────────┘
```

**Véase también**

* [uniqThetaSketch](/es/reference/functions/aggregate-functions/uniqthetasketch)

{/*AUTOGENERATED_START*/}
