Skip to content

Commit 9355db4

Browse files
committed
[doc]Without switching the query mode of FlinkSQL, an exception will be thrown when deleting data from the fluss primary key table
1 parent 94c8073 commit 9355db4

File tree

1 file changed

+29
-1
lines changed
  • website/docs/table-design/table-types/pk-table

1 file changed

+29
-1
lines changed

website/docs/table-design/table-types/pk-table/index.md

Lines changed: 29 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,35 @@ CREATE TABLE T
123123

124124
If the data written to the primary-key table is
125125
sequentially `+I(1, 2.0, 'apple')`, `+I(1, 4.0, 'banana')`, `-D(1, 4.0, 'banana')`, then the following change data will
126-
be generated.
126+
be generated.For example, the execution process of the following Flink SQL statement:
127+
128+
```sql title="Flink SQL"
129+
-- 1. Switch to batch processing mode
130+
-- In this mode, we can perform POST and DELETE operations.
131+
-- Note: In this environment, full table SELECT is restricted in batch mode.
132+
SET execution.runtime-mode = batch;
133+
134+
-- 2. Insert two pieces of data (executed in batch mode)
135+
-- Flink will submit these data as insertion events to the cluster.
136+
INSERT INTO T (k, v1) VALUES (1, 2.0,'apple');
137+
INSERT INTO T (k, v1) VALUES (1, 4.0,'banana');
138+
139+
-- 3. Perform deletion operation
140+
-- This DELETE operation will mark records with primary key k=1 as deleted.
141+
-- Within Fluss, it generates a '- D' change log event.
142+
DELETE FROM T WHERE k = 1;
143+
144+
145+
-- 4. According to the experiment, Fluss has limitations on SELECT in batch processing mode.
146+
-- Only data lake tables or primary key point queries are supported.
147+
-- After switching to streaming mode, we can observe the change logs of the table.
148+
-- The SELECT here will act as a stream query, continuously displaying updates to the table.
149+
SET execution.runtime-mode = streaming;
150+
SELECT * FROM T;
151+
152+
```
153+
154+
Generate the following change data:
127155

128156
```text
129157
+I(1, 2.0, 'apple')

0 commit comments

Comments
 (0)