This is an automated email from the ASF dual-hosted git repository.
ipolyzos pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fluss.git
The following commit(s) were added to refs/heads/main by this push:
new e51fcdaa1 [docs] Add docs for flink materialized table (#1798)
e51fcdaa1 is described below
commit e51fcdaa15f21ceeb51cec8b1e59e303ee89843d
Author: Ron <[email protected]>
AuthorDate: Mon Oct 13 00:55:49 2025 +0800
[docs] Add docs for flink materialized table (#1798)
* [docs] Add docs for flink materialized table
* small improvements
---------
Co-authored-by: 风离 <[email protected]>
Co-authored-by: ipolyzos <[email protected]>
---
website/docs/engine-flink/ddl.md | 103 +++++++++++++++++++++++++++
website/docs/engine-flink/getting-started.md | 37 +++++-----
2 files changed, 123 insertions(+), 17 deletions(-)
diff --git a/website/docs/engine-flink/ddl.md b/website/docs/engine-flink/ddl.md
index 052d44bc4..dd1788e4c 100644
--- a/website/docs/engine-flink/ddl.md
+++ b/website/docs/engine-flink/ddl.md
@@ -273,3 +273,106 @@ ALTER TABLE my_multi_fields_part_log_table DROP PARTITION
(dt = '2025-03-05', na
```
For more details, refer to the [Flink ALTER
TABLE(DROP)](https://nightlies.apache.org/flink/flink-docs-release-1.20/docs/dev/table/sql/alter/#drop)
documentation.
+
+## Materialized Table
+### Overview
+Flink Materialized Table is a new table type introduced in Flink SQL that
simplifies the development of both batch and streaming data pipelines.
+By defining the data freshness and query during creation, Flink automatically
derives the table schema and generates a refresh pipeline to maintain the
desired freshness level. This provides a unified and consistent development
experience for both real-time and batch workloads. For more information, see
the [Flink Materialized
Table](https://nightlies.apache.org/flink/flink-docs-release-1.20/docs/dev/table/materialized-table/overview)
documentation.
+
+Starting from Fluss version 0.8, Flink Materialized Table is now supported,
which can significantly reduce the cost of building real-time data pipelines
with Apache Flink and Fluss. Materialized tables in Fluss are implemented as
regular Fluss tables with special metadata to identify them as materialized
tables.
+
+### Create Materialized Table
+
+Materialized tables are created using the `CREATE MATERIALIZED TABLE`
statement with a freshness interval and a query definition:
+
+```sql title="Flink SQL"
+CREATE MATERIALIZED TABLE shop_summary
+FRESHNESS = INTERVAL '5' SECOND
+AS SELECT
+ DATE_FORMAT(order_time, 'yyyy-MM-dd') AS order_date,
+ shop_id,
+ COUNT(*) AS order_count,
+ SUM(amount) AS total_amount
+FROM orders
+GROUP BY DATE_FORMAT(order_time, 'yyyy-MM-dd'), shop_id;
+```
+
+#### Supported Refresh Modes
+
+Apache Fluss currently supports **CONTINUOUS** refresh mode for materialized
table, which means the materialized table is continuously refreshed. The
**FULL** refresh mode will be supported in future releases.
+
+#### Schema Definition
+
+The schema of a materialized table is automatically inferred from the query
definition. You cannot manually specify column names and types - they are
derived from the SELECT statement.
+
+```sql title="Flink SQL"
+-- The schema will be automatically inferred as:
+-- order_date: STRING
+-- shop_id: BIGINT
+-- order_count: BIGINT
+-- total_amount: BIGINT
+CREATE MATERIALIZED TABLE daily_sales
+FRESHNESS = INTERVAL '1' MINUTE
+AS SELECT
+ DATE_FORMAT(created_at, 'yyyy-MM-dd') AS order_date,
+ shop_id,
+ COUNT(*) AS order_count,
+ SUM(amount) AS total_amount
+FROM sales_events
+GROUP BY DATE_FORMAT(created_at, 'yyyy-MM-dd'), shop_id;
+```
+
+### Alter Materialized Table
+
+You can suspend and resume materialized tables to control their refresh
behavior:
+
+#### Suspend Materialized Table
+
+```sql title="Flink SQL"
+ALTER MATERIALIZED TABLE shop_summary SUSPEND;
+```
+
+This stops the automatic refresh of the materialized table and saves the
current state.
+
+#### Resume Materialized Table
+
+```sql title="Flink SQL"
+ALTER MATERIALIZED TABLE shop_summary RESUME;
+```
+
+This resumes the automatic refresh of the materialized table from the last
saved state.
+
+### Drop Materialized Table
+
+To delete a materialized table:
+
+```sql title="Flink SQL"
+DROP MATERIALIZED TABLE shop_summary;
+```
+
+This will drop the materialized table and stop the background refresh job.
+
+### Materialized Table Options
+
+Materialized tables support the same table options as regular Fluss tables,
including partitioning and bucketing:
+
+```sql title="Flink SQL"
+CREATE MATERIALIZED TABLE partitioned_summary
+FRESHNESS = INTERVAL '10' SECOND
+AS SELECT
+ dt,
+ shop_id,
+ COUNT(*) AS order_count
+FROM orders
+GROUP BY dt, shop_id
+PARTITIONED BY (dt)
+WITH (
+ 'bucket.num' = '4'
+);
+```
+
+### Limitations
+
+- Only continuous refresh mode is supported
+- Schema is automatically derived from the query
+- Materialized tables are stored as regular Fluss tables with special metadata
diff --git a/website/docs/engine-flink/getting-started.md
b/website/docs/engine-flink/getting-started.md
index d58222c9e..21ea8c1cb 100644
--- a/website/docs/engine-flink/getting-started.md
+++ b/website/docs/engine-flink/getting-started.md
@@ -9,7 +9,7 @@ sidebar_position: 1
For a quick introduction to running Flink, refer to the [Quick
Start](quickstart/flink.md) guide.
-## Support Flink Versions
+## Supported Flink Versions
| Fluss Connector Versions | Supported Flink Versions |
|--------------------------|--------------------------|
| $FLUSS_VERSION_SHORT$ | 1.18, 1.19, 1.20 |
@@ -20,23 +20,26 @@ Fluss supports Apache Flink's Table API and Flink's
DataStream API.
For Flink's Table API, Fluss supports the following features:
-| Feature support | Flink | Notes
|
+| Feature Support | Flink | Notes
|
|---------------------------------------------------|-------|----------------------------------------|
-| [SQL create catalog](ddl.md#create-catalog) | ✔️ |
|
-| [SQL create database](ddl.md#create-database) | ✔️ |
|
-| [SQL drop database](ddl.md#drop-database) | ✔️ |
|
-| [SQL create table](ddl.md#create-table) | ✔️ |
|
-| [SQL create table like](ddl.md#create-table-like) | ✔️ |
|
-| [SQL drop table](ddl.md#drop-table) | ✔️ |
|
-| [SQL show partitions](ddl.md#show-partitions) | ✔️ |
|
-| [SQL add partition](ddl.md#add-partition) | ✔️ |
|
-| [SQL drop partition](ddl.md#drop-partition) | ✔️ |
|
-| [SQL select](reads.md) | ✔️ | Support both
streaming and batch mode. |
-| [SQL limit](reads.md#limit-read) | ✔️ | Only for Log
Table |
-| [SQL insert into](writes.md) | ✔️ | Support both
streaming and batch mode. |
-| [SQL delete from](writes.md#delete-from) | ✔️ | Only in batch
mode. |
-| [SQL update](writes.md#update) | ✔️ | Only in batch
mode. |
-| [SQL lookup join](lookups.md) | ✔️ |
|
+| [SQL Create Catalog](ddl.md#create-catalog) | ✔️ |
|
+| [SQL Create Database](ddl.md#create-database) | ✔️ |
|
+| [SQL Drop Database](ddl.md#drop-database) | ✔️ |
|
+| [SQL Create Table](ddl.md#create-table) | ✔️ |
|
+| [SQL Create Table Like](ddl.md#create-table-like) | ✔️ |
|
+| [SQL Drop Table](ddl.md#drop-table) | ✔️ |
|
+| [SQL Create Materialized Table](ddl.md#materialized-table) | ✔️ |
Continuous refresh mode only |
+| [SQL Alter Materialized Table](ddl.md#alter-materialized-table) | ✔️ |
Suspend/Resume support |
+| [SQL Drop Materialized Table](ddl.md#drop-materialized-table) | ✔️ |
|
+| [SQL Show Partitions](ddl.md#show-partitions) | ✔️ |
|
+| [SQL Add Partition](ddl.md#add-partition) | ✔️ |
|
+| [SQL Drop Partition](ddl.md#drop-partition) | ✔️ |
|
+| [SQL Select](reads.md) | ✔️ | Support both
streaming and batch mode. |
+| [SQL Limit](reads.md#limit-read) | ✔️ | Only for Log
Table |
+| [SQL Insert Into](writes.md) | ✔️ | Support both
streaming and batch mode. |
+| [SQL Delete From](writes.md#delete-from) | ✔️ | Only in batch
mode. |
+| [SQL Update](writes.md#update) | ✔️ | Only in batch
mode. |
+| [SQL Lookup Join](lookups.md) | ✔️ |
|
For Flink's DataStream API, you can see [DataStream
API](docs/engine-flink/datastream.mdx) for more details.