yujun777 opened a new issue, #65800:
URL: https://github.com/apache/doris/issues/65800
## Description
For a Merge-on-Write (MOW) unique-key table, a `MIN_DELTA` stream
incorrectly returns the value from the `DELETE` operation when an update is
followed by a delete on the same row.
`MIN_DELTA` should merge the sequence below into one `DELETE` operation
using the original value from `UPDATE_BEFORE`.
## Reproduction
```sql
CREATE TABLE mow_min_delta_bug (
id BIGINT,
v1 INT
) ENGINE=OLAP
UNIQUE KEY(id)
DISTRIBUTED BY HASH(id) BUCKETS 1
PROPERTIES (
"replication_num" = "1",
"enable_unique_key_merge_on_write" = "true",
"binlog.enable" = "true",
"binlog.format" = "ROW",
"binlog.need_historical_value" = "true"
);
INSERT INTO mow_min_delta_bug VALUES (1, 10);
CREATE STREAM mow_min_delta_bug_stream
ON TABLE mow_min_delta_bug
PROPERTIES (
"type" = "min_delta",
"show_initial_rows" = "false"
);
INSERT INTO mow_min_delta_bug VALUES (1, 11);
DELETE FROM mow_min_delta_bug WHERE id = 1;
SELECT id, v1, __DORIS_STREAM_CHANGE_TYPE_COL__
FROM mow_min_delta_bug_stream;
```
The row-level operations are:
```text
UPDATE_BEFORE(10), UPDATE_AFTER(11), DELETE(11)
```
## Actual behavior
The stream returns:
```text
id v1 change_type
1 11 DELETE
```
## Expected behavior
The stream should return:
```text
id v1 change_type
1 10 DELETE
```
When `UPDATE` and `DELETE` are merged into a single `DELETE`, the delete row
should preserve the old value from `UPDATE_BEFORE`, not the updated value from
`UPDATE_AFTER` or `DELETE`.
## Related issues
Related to #65265 and #65418.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]