HonestManXin opened a new pull request, #54936:
URL: https://github.com/apache/doris/pull/54936
In some business scenarios, business operations need to update different
columns in the same wide table through two or more data streams. For example,
one data stream will write in real time to update some fields of this table;
another data stream will perform imports on demand to update other columns of
this table. During the update process, both data stream jobs need to ensure the
order of replacement; and during queries, data from all columns should be
queryable.
```shell
CREATE TABLE `upsert_test` (
`a` bigint(20) NULL COMMENT "",
`b` int(11) NULL COMMENT "",
`c` int(11) NULL COMMENT "",
`d` int(11) NULL COMMENT "",
`e` int(11) NULL COMMENT "",
`s1` int(11) NULL COMMENT "",
`s2` int(11) NULL COMMENT ""
) ENGINE=OLAP
UNIQUE KEY(`a`, `b`)
COMMENT "OLAP"
DISTRIBUTED BY HASH(`a`, `b`) BUCKETS 1
PROPERTIES (
"replication_num" = "1",
"sequence_mapping.s1" = "c,d",
"sequence_mapping.s2" = "e"
);
MySQL [test]> insert into upsert_test(a, b, c, d, s1) values (1,1,2,2,2);
Query OK, 1 row affected (0.15 sec)
{'label':'insert_fadb7c3fe6041c6-a51094f635017b12', 'status':'VISIBLE',
'txnId':'2'}
MySQL [test]> insert into upsert_test(a, b, c, d, s1) values (1,1,1,1,1);
Query OK, 1 row affected (0.07 sec)
{'label':'insert_1f3d1d5eb28447fe-889427c9da075c11', 'status':'VISIBLE',
'txnId':'3'}
MySQL [test]> select * from upsert_test;
+------+------+------+------+------+------+------+
| a | b | c | d | e | s1 | s2 |
+------+------+------+------+------+------+------+
| 1 | 1 | 2 | 2 | NULL | 2 | NULL |
+------+------+------+------+------+------+------+
MySQL [test]> insert into upsert_test(a, b, e, s2) values (1,1,2,2);
Query OK, 1 row affected (0.05 sec)
{'label':'insert_3b9614ce9a4e4dc3-97bbbb9b881c24aa', 'status':'VISIBLE',
'txnId':'4'}
MySQL [test]> select * from upsert_test;
+------+------+------+------+------+------+------+
| a | b | c | d | e | s1 | s2 |
+------+------+------+------+------+------+------+
| 1 | 1 | 2 | 2 | 2 | 2 | 2 |
+------+------+------+------+------+------+------+
1 row in set (0.01 sec)
```
--
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]