Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
34 commits
Select commit Hold shift + click to select a range
b1f4e15
[INIT] Start translation to Simplified-Chinese
github-actions[bot] Aug 24, 2025
2aedfc0
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
14adfd1
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
3ac5474
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
23f3f82
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
e89227b
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
b5bad28
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
97c3477
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
ad740aa
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
b66aea6
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
db748cd
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
a7e5a15
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
ad2b2a8
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
5ae3f4e
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
b1e5e62
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
f66df6b
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
ac65a9e
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
37a5be3
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
ed85ca3
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
8adf2fe
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
0a8a69c
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
3ae9a1f
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
c1fba79
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
8cbd9c5
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
48ca122
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
2415fe5
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
b896f21
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
fc69f11
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
26e05e6
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
4a84c70
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
d5b4879
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
a95ed6a
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
645aee5
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
ed3243e
🌐 Translate 10-enterprise-features.md to Simplified-Chinese
github-actions[bot] Aug 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .translation-init
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Translation initialization: 2025-08-24T10:54:05.598944
Translation initialization: 2025-08-24T13:02:31.727965
104 changes: 52 additions & 52 deletions docs/cn/guides/00-products/01-dee/10-enterprise-features.md

Large diffs are not rendered by default.

16 changes: 8 additions & 8 deletions docs/cn/guides/20-cloud/20-manage/01-monitor.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
title: "监控使用情况"
---

Databend Cloud 提供了监控功能,帮助您全面了解您和您的组织成员在平台上的使用情况。要访问 **Monitor** 页面,请单击主页侧边栏菜单中的 **Monitor**。该页面包括以下选项卡
Databend Cloud 提供监控功能,帮助你全面了解你和组织成员在平台上的使用情况。要访问 **Monitor** 页面,请在主页侧边栏菜单中点击 **Monitor**。该页面包含以下选项卡

- [Metrics](#metrics)
- [SQL History](#sql-history)
Expand All @@ -11,7 +11,7 @@ Databend Cloud 提供了监控功能,帮助您全面了解您和您的组织

## Metrics

**Metrics** 选项卡显示图表,以可视化方式展示以下指标的使用统计信息,涵盖过去一小时、一天或一周的数据
**Metrics** 选项卡以图表形式直观展示以下指标的使用统计,数据范围涵盖过去一小时、一天或一周

- Storage Size
- SQL Query Count
Expand All @@ -22,17 +22,17 @@ Databend Cloud 提供了监控功能,帮助您全面了解您和您的组织

## SQL History

**SQL History** 选项卡显示组织内所有用户已执行的 SQL 语句列表。通过单击列表顶部的 **Filter**,您可以按多个维度过滤记录
**SQL History** 选项卡列出组织内所有用户已执行的 SQL 语句。点击列表顶部的 **Filter**,可按多个维度筛选记录

单击 **SQL History** 页面上的记录会显示有关 Databend Cloud 如何执行 SQL 语句的详细信息,从而可以访问以下选项卡
**SQL History** 页面点击某条记录,可查看 Databend Cloud 执行该 SQL 语句的详细信息,并访问以下选项卡

- **Query Details**:包括 Query State(成功或失败)、Rows Scanned、Warehouse、Bytes Scanned、Start Time、End Time 和 Handler Type。
- **Query Profile**:说明 SQL 语句的执行方式。有关更多信息,请参见 [Query Profile](/guides/query/query-profile)
- **Query Details**:包含 Query State(成功或失败)、Rows Scanned、Warehouse、Bytes Scanned、Start Time、End Time 和 Handler Type。
- **Query Profile**:展示 SQL 语句的执行过程

## Task History

**Task History** 选项卡提供了组织内所有已执行任务的完整日志,使用户可以查看任务设置并监控其状态
**Task History** 选项卡提供组织内所有已执行任务的完整日志,方便用户查看任务配置并监控其状态

## Audit

**Audit** 选项卡记录所有组织成员的操作日志,包括操作类型、操作时间、IP 地址和操作员帐户。通过单击列表顶部的 **Filter**,您可以按多个维度过滤记录
**Audit** 选项卡记录所有组织成员的操作日志,包括操作类型、操作时间、IP 地址和操作者账号。点击列表顶部的 **Filter**,可按多个维度筛选记录
24 changes: 12 additions & 12 deletions docs/cn/guides/51-ai-functions/01-external-functions.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
---
title: 使用外部函数(External Function)自定义 AI/ML
title: 使用外部函数自定义 AI/ML
---

# 使用外部函数(External Function)自定义 AI/ML
# 使用外部函数自定义 AI/ML

通过将 Databend 与您自己的基础设施连接,构建强大的 AI/ML 能力。外部函数(External Function)让您部署自定义模型、利用 GPU 加速并与任何 ML 框架集成,同时确保数据安全。
通过将 Databend 与您自己的基础设施连接,构建强大的 AI/ML 能力。外部函数(External Function)让您能够部署自定义模型、利用 GPU 加速,并与任何 ML 框架集成,同时确保数据安全。

## 核心能力

Expand All @@ -13,14 +13,14 @@ title: 使用外部函数(External Function)自定义 AI/ML
| **自定义模型** | 使用任何开源或专有的 AI/ML 模型 |
| **GPU 加速** | 部署在配备 GPU 的机器上以加快推理速度 |
| **数据隐私** | 将数据保留在您的基础设施内 |
| **可扩展性** | 独立扩展并优化资源 |
| **可扩展性** | 独立扩展和资源优化 |
| **灵活性** | 支持任何编程语言和 ML 框架 |

## 工作原理

1. **创建 AI 服务器**:使用 Python 和 [databend-udf](https://pypi.org/project/databend-udf) 构建 AI/ML 服务器
2. **注册函数**:通过 `CREATE FUNCTION` 将服务器接入 Databend
3. **在 SQL 中使用**:直接在 SQL 查询中调用自定义 AI 函数
1. **创建 AI 服务器**:使用 Python 和 [databend-udf](https://pypi.org/project/databend-udf) 构建您的 AI/ML 服务器
2. **注册函数**:使用 `CREATE FUNCTION` 将您的服务器连接到 Databend
3. **在 SQL 中使用**:直接在 SQL 查询中调用您的自定义 AI 函数

## 示例:文本嵌入函数

Expand All @@ -44,12 +44,12 @@ def ai_embed_768(inputs: list[str], headers) -> list[list[float]]:
# 转换为列表格式
return [embedding.tolist() for embedding in embeddings]
except Exception as e:
print(f"生成嵌入时出错:{e}")
# 出错时返回空列表
print(f"Error generating embeddings: {e}")
# 如果出错,则返回空列表
return [[] for _ in inputs]

if __name__ == '__main__':
print("在端口 8815 启动嵌入 UDF 服务器...")
print("正在端口 8815 上启动嵌入 UDF 服务器...")
server = UDFServer("0.0.0.0:8815")
server.add_function(ai_embed_768)
server.serve()
Expand Down Expand Up @@ -78,5 +78,5 @@ LIMIT 5;

## 了解更多

- **[外部函数(External Function)指南](/guides/query/external-function)** - 完整的设置与部署说明
- **[Databend Cloud](https://databend.cn)** - 免费账户体验外部函数
- **[外部函数指南](/guides/query/advanced/external-function)** - 完整的设置和部署说明
- **[Databend Cloud](https://databend.cn)** - 使用免费账户试用外部函数
90 changes: 90 additions & 0 deletions docs/cn/guides/54-query/00-basics/aggregating-data.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
---
title: 聚合数据
---

学习如何使用 GROUP BY、聚合函数(Aggregate Function)和高级分组技术来汇总和分析数据。

## 基本聚合

### 常用聚合函数
```sql
-- 计算行数
SELECT COUNT(*) FROM employees;

-- 统计函数
SELECT
AVG(salary) as avg_salary,
MIN(salary) as min_salary,
MAX(salary) as max_salary,
SUM(salary) as total_salary
FROM employees;
```

## GROUP BY 基础

### 单列分组
```sql
-- 按部门统计员工人数
SELECT department, COUNT(*) as emp_count
FROM employees
GROUP BY department;

-- 按部门计算平均薪资
SELECT department, AVG(salary) as avg_salary
FROM employees
GROUP BY department
ORDER BY avg_salary DESC;
```

### 多列分组
```sql
-- 按部门和入职年份分组
SELECT
department,
EXTRACT(YEAR FROM hire_date) as hire_year,
COUNT(*) as count,
AVG(salary) as avg_salary
FROM employees
GROUP BY department, EXTRACT(YEAR FROM hire_date)
ORDER BY department, hire_year;
```

### GROUP BY 与 HAVING
```sql
-- 查找员工人数超过 5 人的部门
SELECT department, COUNT(*) as emp_count
FROM employees
GROUP BY department
HAVING COUNT(*) > 5;

-- 平均薪资大于 70000 的部门
SELECT department, AVG(salary) as avg_salary
FROM employees
GROUP BY department
HAVING AVG(salary) > 70000;
```

## 高级分组

### GROUP BY ALL
```sql
-- 自动按所有非聚合列进行分组
SELECT department, job_title, COUNT(*) as count
FROM employees
GROUP BY ALL;
```

## 高级分组扩展

Databend 支持 SQL:2003 标准分组扩展:

- **[ROLLUP](./groupby/group-by-rollup.md)** - 分层小计
- **[CUBE](./groupby/group-by-cube.md)** - 所有可能的组合
- **[GROUPING SETS](./groupby/group-by-grouping-sets.md)** - 自定义组合

## 最佳实践

1. **使用适当的聚合函数** - COUNT(*) 与 COUNT(column)
2. **分组前过滤** - 在 GROUP BY 前使用 WHERE
3. **使用 HAVING 进行聚合条件过滤** - 在聚合后过滤分组
4. **考虑索引(Index)** - GROUP BY 的列应当被索引
103 changes: 103 additions & 0 deletions docs/cn/guides/54-query/00-basics/filtering-selection.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
---
title: 过滤与选择
---

学习在 Databend 中使用 SELECT、WHERE 和基本操作查询(Query)数据的基础知识。

## 基本 SELECT 查询

### 选择列
```sql
-- 选择特定列
SELECT name, salary FROM employees;

-- 选择所有列
SELECT * FROM employees;

-- 使用列别名进行选择
SELECT name AS employee_name, salary AS monthly_pay
FROM employees;
```

### 使用 WHERE 进行过滤
```sql
-- 简单条件
SELECT * FROM employees WHERE department = 'Engineering';

-- 多重条件
SELECT * FROM employees
WHERE salary > 70000 AND department = 'Engineering';

-- 使用 OR
SELECT * FROM employees
WHERE department = 'Engineering' OR department = 'Marketing';

-- 范围条件
SELECT * FROM employees
WHERE salary BETWEEN 60000 AND 80000;

-- 模式匹配
SELECT * FROM employees
WHERE name LIKE 'A%'; -- 名字以 'A' 开头
```

## 排序结果

### ORDER BY 子句
```sql
-- 按单列排序
SELECT * FROM employees ORDER BY salary DESC;

-- 按多列排序
SELECT * FROM employees
ORDER BY department ASC, salary DESC;

-- 按列位置排序
SELECT name, salary FROM employees ORDER BY 2 DESC;
```

## 限制结果

### LIMIT 和 OFFSET
```sql
-- 获取薪水最高的 5 名员工
SELECT * FROM employees
ORDER BY salary DESC
LIMIT 5;

-- 分页 - 跳过前 10 条,获取接下来的 5 条
SELECT * FROM employees
ORDER BY salary DESC
LIMIT 5 OFFSET 10;
```

## 常用运算符

### 比较运算符
- `=` 等于
- `!=` 或 `<>` 不等于
- `>` 大于
- `<` 小于
- `>=` 大于或等于
- `<=` 小于或等于

### 逻辑运算符
- `AND` 两个条件都必须为真
- `OR` 任一条件为真即可
- `NOT` 对条件取反

### NULL 处理
```sql
-- 检查 NULL 值
SELECT * FROM employees WHERE manager_id IS NULL;

-- 检查非 NULL 值
SELECT * FROM employees WHERE manager_id IS NOT NULL;
```

## 最佳实践

1. **明确指定列** - 在生产环境中避免使用 `SELECT *`
2. **使用索引(Index)** - 对索引列使用 WHERE 条件可以加快查询速度
3. **限制大量结果** - 在进行探索性查询时,始终使用 LIMIT
4. **尽早过滤** - 尽可能在进行连接(JOIN)之前应用 WHERE 条件
77 changes: 77 additions & 0 deletions docs/cn/guides/54-query/00-basics/groupby/group-by-cube.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
---
title: GROUP BY CUBE
---

`GROUP BY CUBE` 是 [GROUP BY](index.md) 子句的扩展,与 [GROUP BY ROLLUP](group-by-rollup.md) 类似。除了生成 `GROUP BY ROLLUP` 的所有行之外,`GROUP BY CUBE` 还会添加所有“交叉表”行。小计行是进一步聚合的行,其值通过计算用于生成分组行的相同聚合函数得出。

一个 `CUBE` 分组等价于一连串的 GROUPING SETS(分组集),本质上是一种更简洁的写法。CUBE 规范中的 N 个元素对应 `2^N` 个 `GROUPING SETS`。

## 语法

```sql
SELECT ...
FROM ...
[ ... ]
GROUP BY CUBE ( groupCube [ , groupCube [ , ... ] ] )
[ ... ]
```

其中:
```sql
groupCube ::= { <column_alias> | <position> | <expr> }
```

- `<column_alias>`:查询块 SELECT 列表中出现的列别名。

- `<position>`:SELECT 列表中表达式的位置。

- `<expr>`:当前作用域内表的任意表达式。


## 示例

假设我们有一张名为 sales_data 的表,其结构及示例数据如下:

```sql
CREATE TABLE sales_data (
region VARCHAR(255),
product VARCHAR(255),
sales_amount INT
);

INSERT INTO sales_data (region, product, sales_amount) VALUES
('North', 'WidgetA', 200),
('North', 'WidgetB', 300),
('South', 'WidgetA', 400),
('South', 'WidgetB', 100),
('West', 'WidgetA', 300),
('West', 'WidgetB', 200);
```

现在,我们使用 `GROUP BY CUBE` 子句获取每个地区与产品的总销售额,以及所有可能的聚合结果:

```sql
SELECT region, product, SUM(sales_amount) AS total_sales
FROM sales_data
GROUP BY CUBE (region, product);
```

结果如下:
```sql
+--------+---------+-------------+
| region | product | total_sales |
+--------+---------+-------------+
| South | NULL | 500 |
| NULL | WidgetB | 600 |
| West | NULL | 500 |
| North | NULL | 500 |
| West | WidgetB | 200 |
| NULL | NULL | 1500 |
| North | WidgetB | 300 |
| South | WidgetA | 400 |
| North | WidgetA | 200 |
| NULL | WidgetA | 900 |
| West | WidgetA | 300 |
| South | WidgetB | 100 |
+--------+---------+-------------+
```
Loading