# 一大波自定义函数上新！新增社区贡献者数量喜人 | Greptime 双周精选

Source: https://greptime.cn/blogs/2025-03-19-biweekly-report

## 内容概述
作为一个成长中的开源项目，GreptimeDB 的进展离不开来自全球的社区贡献者们，感谢各位！

最近的更新内容如下：

- **为 OpenTelemetry Trace 增加新的数据模型**
- **新增向量函数，如 `vec_subvector` 和 `vec_kth_elem`**
- **将默认的 `data_home` 目录从 `/tmp` 更改为当前文件夹**
- **支持新的 PromQL 函数，如 `quantile` 和 `count_values`**
- **Pipeline 相关优化**
  - 支持在 Transform 中设置 `tag` 字段
  - 支持在 Pipeline 中设置 `inverted index`
  - 添加 `simple extract processor`

## 社区贡献者名单

在过去的两周里，GreptimeDB 共合并了 **94 个 PR**，其中有 **8 位独立贡献者**，累计 **12 个 PR** 被成功合并，还有很多待合并的 PR 。

祝贺以下各位在过去 2 周内成为我们最突出的贡献者：
 
> 注：按照 GitHub 用户名首字母顺序排列
> - @*[AntiTopQuark](https://github.com/AntiTopQuark)* **[db#5623](https://github.com/GreptimeTeam/greptimedb/pull/5623)** 
> - @*[lau-jay](https://github.com/lau-jay)* **[docs#1579](https://github.com/GreptimeTeam/docs/pull/1579)**
> - @*[linyihai](https://github.com/linyihai)* **[db#5616](https://github.com/GreptimeTeam/greptimedb/pull/5616) [docs#1544](https://github.com/GreptimeTeam/docs/pull/1544)**
> - @*[Pikady](https://github.com/Pikady)* **[db#5674](https://github.com/GreptimeTeam/greptimedb/pull/5674)**  
> - @*[SNC123](https://github.com/SNC123)* **[db#5683](https://github.com/GreptimeTeam/greptimedb/pull/5683)** 
> - @*[Wenbin1002](https://github.com/Wenbin1002)* **[db#5728](https://github.com/GreptimeTeam/greptimedb/pull/5728)** 
> - @*[wtzhang23](https://github.com/wtzhang23)* **[promql-parser#105](https://github.com/GreptimeTeam/promql-parser/commit/700ea041d494464ca0c81e4f72b2d8b5920e3e07)**
> - @*[yihong0618](https://github.com/yihong0618)* **[db#5715](https://github.com/GreptimeTeam/greptimedb/pull/5715) [db#5706](https://github.com/GreptimeTeam/greptimedb/pull/5706) [db#5657](https://github.com/GreptimeTeam/greptimedb/pull/5657) [db#5585](https://github.com/GreptimeTeam/greptimedb/pull/5585)**

👏 欢迎 @*[lau-jay](https://github.com/lau-jay)* @*[Pikady](https://github.com/Pikady)* @*[SNC123](https://github.com/SNC123)* @*[Wenbin1002](https://github.com/Wenbin1002)* @*[wtzhang23](https://github.com/wtzhang23)* 作为新的贡献者加入到社区，并成功合并了 PR，还有更多来自其他独立贡献者的 PR 正在等待合并。

<figure>
<img src="/zh/blogs/2025-03-19-biweekly-report/contributorimage.png" alt="（图 1：GreptimeDB 新晋 Contributor）" style="width: 80%; margin: 0 auto"/>
<figcaption>（图 1：GreptimeDB 新晋 Contributor）</figcaption>
</figure>

🎉 衷心感谢我们所有的成员，贡献者和布道师们！是你们的付出让我们的项目得以成功，也是你们让 GreptimeDB 成为一个更优质的产品。让我们一起努力，建立一个更棒的社区！

## PR 亮点

#### [db#5622 OpenTelemetry Trace 数据模型优化](https://github.com/GreptimeTeam/greptimedb/pull/5622)

GreptimeDB 进一步优化了 OpenTelemetry Trace 的数据建模，以提升可观测性和查询效率，具体更新如下：
- **内置 Pipeline**： 引入 `greptime_trace_v1`；
- **属性展开**： 默认情况下，`attributes` 自动扩展为独立列。
- **Skipping Index**： 为 `trace_id`、`parent_span_id` 和 `span_name` 添加了 `skipping index`，提高查询性能。
- **分区规则优化**：`trace_id` 在 `greptime_trace_v1` 和 `v0` 中增加默认分区规则，提升数据组织和检索效率。

### 新增向量函数

#### [db#5683 `vec_subvector` 向量函数](https://github.com/GreptimeTeam/greptimedb/pull/5683)

新增 `vec_subvector(vec, start, end)` 向量函数，支持提取从 `start`（包含）到 `end`（不包含）的子向量，实现高效切片。 

查询示例如下：

```sql
SELECT vec_to_string(vec_subvector("[1, 2, 3, 4, 5]", 1, 3)) AS result;
```

输出结果为：

```sql
+--------+
| result |
+--------+
| [2,3]  |
+--------+
```

#### [db#5674 `vec_kth_elem` 向量函数](https://github.com/GreptimeTeam/greptimedb/pull/5674)

新增 `vec_kth_elem(vec, k)` 向量函数，用于获取向量的第 `k` 个元素，简化向量数据的访问。 

查询示例如下：

```sql
SELECT vec_kth_elem("[2, 4, 6]", 1) AS result;
```

输出结果为：

```sql
+--------+
| result |
+--------+
| 4      |
+--------+
```

## Good First Issue

### [db#5120 添加向量函数 `JSON_TO_VEC` 和 `VEC_TO_JSON`](https://github.com/GreptimeTeam/greptimedb/pull/5210)

- 难度：中等
- 关键字：向量

## 关于 Greptime

[Greptime 格睿科技](https://greptime.cn/)专注于为可观测、物联网及车联网等领域提供实时、高效的数据存储和分析服务，帮助客户挖掘数据的深层价值。目前基于云原生的时序数据库 [GreptimeDB](https://github.com/GreptimeTeam/greptimedb) 已经衍生出多款适合不同用户的解决方案，更多信息或 demo 展示请联系下方小助手（微信号：greptime）。

欢迎对开源感兴趣的朋友们参与贡献和讨论，从带有 good first issue 标签的 issue 开始你的开源之旅吧～期待在开源社群里遇见你！添加小助手微信即可加入“技术交流群”与志同道合的朋友们面对面交流哦~

Star us on GitHub Now: https://github.com/GreptimeTeam/greptimedb

官网：https://greptime.cn/

文档：https://docs.greptime.cn/

Twitter: https://twitter.com/Greptime

Slack: https://greptime.com/slack

LinkedIn: https://www.linkedin.com/company/greptime/
