> ## Documentation Index
> Fetch the complete documentation index at: /documents/llms.txt
> Use this file to discover all available pages before exploring further.

# ds_theta_combine

> 跨行合并序列化的 Apache DataSketches Theta 草图，返回单个联合紧凑草图（VARBINARY）。

聚合函数。跨行合并序列化的 Apache DataSketches Theta 草图（`VARBINARY`），返回单个序列化的紧凑草图。

输入可以是来自任何源的紧凑 theta 草图列：通过 [`ds_theta_accumulate`](/documents/cn/4.2/sql-reference/sql-functions/aggregate-functions/ds_theta_accumulate) 构建、由成对标量集合运算 [`ds_theta_union`](/documents/cn/4.2/sql-reference/sql-functions/scalar-functions/ds_theta_union) / [`ds_theta_intersect`](/documents/cn/4.2/sql-reference/sql-functions/scalar-functions/ds_theta_intersect) / [`ds_theta_a_not_b`](/documents/cn/4.2/sql-reference/sql-functions/scalar-functions/ds_theta_a_not_b) 产生，或从 Parquet/Iceberg 作为原始 `VARBINARY` 加载的外部草图。

线上格式为标准的 Apache DataSketches C++ 紧凑 theta 序列化格式，结果草图与任何使用默认哈希种子的 Apache DataSketches 实现可互操作。

## 语法

```Haskell theme={null}
VARBINARY ds_theta_combine(sketch)
```

* `sketch`: 紧凑 theta 草图的 `VARBINARY` 列。

## 示例

```SQL theme={null}
-- 将日级草图卷起到年度
SELECT year(day), ds_theta_estimate(ds_theta_combine(daily_sk))
FROM daily_sketches
GROUP BY year(day);
```

## 关键词

DS\_THETA\_COMBINE, DS\_THETA\_ACCUMULATE, DS\_THETA\_ESTIMATE, DS\_THETA\_COUNT\_DISTINCT


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.