You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: website/docs/table-design/table-types/pk-table/merge-engines/versioned.md
+33-21Lines changed: 33 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -5,29 +5,41 @@ sidebar_position: 3
5
5
6
6
# Versioned Merge Engine
7
7
8
-
By setting `'table.merge-engine' = 'versioned'`, users can update data based on the configured version column. Updates will be carried out when the latest value of the specified field is greater than or equal to the stored value. If it is less than or null, no update will be made.
9
-
This feature is particularly valuable for replacing [Deduplication](https://nightlies.apache.org/flink/flink-docs-release-1.20/docs/dev/table/sql/queries/deduplication/) transformations in streaming computations, reducing complexity and improving overall efficiency.
8
+
The **Versioned Merge Engine** enables data updates based on version numbers or event timestamps. It ensures that only the row with the highest version number (or event timestamp) for a given primary key is retained. This mechanism is particularly useful for deduplicating or merging out-of-order data while guaranteeing eventual consistency with the upstream source.
10
9
11
-
:::note
12
-
When using `versioned` merge engine, there are the following limits:
13
-
-`UPDATE` and `DELETE` statements are not supported.
14
-
- Partial update is not supported.
15
-
-`UPDATE_BEFORE` and `DELETE` changelog events are ignored automatically.
16
-
:::
10
+
By setting `'table.merge-engine' = 'versioned'`, users can update data based on a configured version column. Updates are performed when the latest value of the specified field is greater than or equal to the stored value. If the incoming value is less than the stored value or is null, no update will occur.
11
+
12
+
This feature is especially valuable as a replacement for [Deduplication](https://nightlies.apache.org/flink/flink-docs-release-1.20/docs/dev/table/sql/queries/deduplication/) transformations in streaming computations. It simplifies workflows, reduces complexity, and improves overall efficiency.
17
13
18
-
## Versioned Merge Column
19
14
20
15
:::note
21
-
The versioned merge column supports the following data types.
22
-
- INT
23
-
- BIGINT
24
-
- TIMESTAMP
25
-
- TIMESTAMP(p)
26
-
- TIMESTAMP_LTZ
27
-
- TIMESTAMP_LTZ(p)
16
+
When using the `versioned` merge engine, keep the following limitations in mind:
17
+
-**`UPDATE` and `DELETE` statements are not supported.**
18
+
-**Partial updates are not supported.**
19
+
-**`UPDATE_BEFORE` and `DELETE` changelog events are ignored automatically.**
28
20
:::
29
21
30
-
example:
22
+
### Version Column
23
+
24
+
The version column is a column in the table that stores the version number (or event timestamp) of the data record.
25
+
When enabling the versioned merge engine, the version column must be explicitly specified using the property:
0 commit comments