greptimedb-flow
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseGreptimeDB Flow Guide
GreptimeDB Flow 指南
Create GreptimeDB flow definition to do time window based aggregation on the fly
while data ingested into GreptimeDB. This is how GreptimeDB's lightweight
streaming engine works.
Flow is also known as:
- Stream computing
- Materialized View
- Continuous aggregation
创建GreptimeDB流定义,以便在数据写入GreptimeDB时,实时执行基于时间窗口的聚合操作。这就是GreptimeDB轻量级流处理引擎的工作方式。
Flow也被称为:
- 流计算
- Materialized View(物化视图)
- Continuous Aggregation(持续聚合)
The workflow
工作流程
To create GreptimeDB flow task, we should follow these phases:
要创建GreptimeDB流任务,需遵循以下阶段:
Phase 1. Learn and understand GreptimeDB Flow
阶段1:学习并理解GreptimeDB Flow
First, we read GreptimeDB flow definitions and how it works from the
documentation.
There are doc pages available, use WebFetch to load and understand them:
- Overview and quick example: https://docs.greptime.com/user-guide/flow-computation/overview/
- Examples for continuous aggregation: https://docs.greptime.com/user-guide/flow-computation/continuous-aggregation/
- SQL DDL for flow, sink table and related concepts: https://docs.greptime.com/user-guide/flow-computation/manage-flow/
首先,我们从官方文档中学习GreptimeDB流的定义及其工作原理。
可通过WebFetch加载以下文档页面进行学习:
Phase 2. Create flow tasks
阶段2:创建流任务
We should try to understand:
- time window the user wants to use
- aggregation fields and group-by rules
Create the flow and sink table DDL. Note that we will always provide statement for sink table, together with the statement
because it's required.
CREATE TABLECREATE FLOW我们需要明确:
- 用户想要使用的时间窗口
- 聚合字段与分组规则
创建流和目标表的DDL语句。请注意,我们需要同时提供目标表的语句和流的语句,因为这是必填要求。
CREATE TABLECREATE FLOWPhase 3. Verify the tasks
阶段3:验证任务
If greptimedb-mcp-server is available, we can use its tools to
execute the DDL. Try to generate some sample data, insert into source table,
then verify the sink table via SQL SELECT statements. We can use MySQL style
SELECT statements on GreptimeDB for most cases.
execute_sql如果greptimedb-mcp-server可用,我们可以使用其工具执行DDL语句。尝试生成一些示例数据并插入源表,然后通过SQL SELECT语句验证目标表的数据。大多数情况下,我们可以在GreptimeDB上使用MySQL风格的SELECT语句。
execute_sqlReference
参考资料
- Aggregation functions of Flow: https://docs.greptime.com/user-guide/flow-computation/expressions/
- A full list of aggregation functions https://docs.greptime.com/reference/sql/functions/df-functions/#aggregate-functions