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

> يحسب العدد التقريبي لقيم الوسائط المختلفة باستخدام Theta Sketch Framework.

# uniqTheta

<div id="uniqTheta">
  ## uniqTheta
</div>

أُضيف في: v21.6.0

يحسب العدد التقريبي لقيم الوسائط المختلفة باستخدام [Theta Sketch Framework](https://datasketches.apache.org/docs/Theta/ThetaSketches.html#theta-sketch-framework).

<Accordion title="تفاصيل التنفيذ">
  تحسب هذه الدالة قيمة hash لجميع المعلمات في aggregate، ثم تستخدمها في الحسابات.
  وتستخدم خوارزمية [KMV](https://datasketches.apache.org/docs/Theta/InverseEstimate.html) لتقدير عدد قيم الوسائط المختلفة.

  يُستخدم sketch بحجم 4096 ‏(2^12) وبدقة 64-bit.
  ويبلغ حجم الحالة نحو 41 KB.

  يبلغ الخطأ النسبي 3.125% (بمستوى ثقة 95%)، راجع [جدول الخطأ النسبي](https://datasketches.apache.org/docs/Theta/ThetaErrorTable.html) لمزيد من التفاصيل.
</Accordion>

**البنية**

```sql theme={null}
uniqTheta(x[, ...])
```

**الوسائط**

* `x` — تأخذ الدالة عددًا متغيرًا من المعلمات. [`Tuple(T)`](/ar/reference/data-types/tuple) أو [`Array(T)`](/ar/reference/data-types/array) أو [`Date`](/ar/reference/data-types/date) أو [`DateTime`](/ar/reference/data-types/datetime) أو [`String`](/ar/reference/data-types/string) أو [`(U)Int*`](/ar/reference/data-types/int-uint) أو [`Float*`](/ar/reference/data-types/float) أو [`Decimal`](/ar/reference/data-types/decimal)

**القيمة المُعادة**

تعيد رقمًا من النوع UInt64 يمثّل العدد التقريبي لقيم الوسائط المختلفة. [`UInt64`](/ar/reference/data-types/int-uint)

**أمثلة**

**الاستخدام الأساسي**

```sql title=Query theme={null}
CREATE TABLE example_theta
(
    id UInt32,
    category String
)
ENGINE = Memory;

INSERT INTO example_theta VALUES
(1, 'A'), (2, 'B'), (3, 'A'), (4, 'C'), (5, 'B'), (6, 'A');

SELECT uniqTheta(category) as theta_unique_categories
FROM example_theta;
```

```response title=Response theme={null}
┌─theta_unique_categories─┐
│                       3 │
└─────────────────────────┘
```

**انظر أيضًا**

* [uniq](/ar/reference/functions/aggregate-functions/uniq)
* [uniqCombined](/ar/reference/functions/aggregate-functions/uniqCombined)
* [uniqCombined64](/ar/reference/functions/aggregate-functions/uniqCombined64)
* [uniqHLL12](/ar/reference/functions/aggregate-functions/uniqHLL12)
* [uniqExact](/ar/reference/functions/aggregate-functions/uniqExact)
