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
I had searched in the issues and found no similar issues.
Version
2.0.4
What's Wrong?
--1. 先创建TEST1表
drop table IF EXISTS TEST1;
CREATE TABLE IF NOT EXISTS TEST1 ( ID int NULL COMMENT 'ID', ID1 int NULL COMMENT 'ID1', ID2 int NULL COMMENT 'ID2'
) UNIQUE KEY( ID
) DISTRIBUTED BY HASH(ID) BUCKETS AUTO PROPERTIES (
"replication_allocation" = "tag.location.default: 1",
"enable_unique_key_merge_on_write" = "true",
"store_row_column" = "true"
);
-- 2. 表中插入一条记录
insert into TEST1(ID,ID1,ID2) values(1,1,1);
select * from TEST1;
查询结果
-- 3. 删除此记录
delete from TEST1 where ID=1;
--4. 设置部分更新
set enable_unique_key_partial_update=true;
set enable_insert_strict=false;
--5. 在此插入相同key值记录
insert into TEST1(ID,ID1) values(1,2);
select * from TEST1;
Prerequisite Knowledge: During the process of updating partial columns, existing data may be read. If the key of the newly imported data for partial columns already exists, BE (Backend) will read the rows with the same key and update the data of the partial columns. If the key does not exist, BE will write the newly imported data of the partial columns and fill in the default values for other columns.
Since the storage engine used by Doris is similar to the LSM-tree structure, the delete statement does not actually delete the data but marks it for deletion. The delete statement in Doris writes the delete information into the delete predicate, marking the data for deletion with a predicate.
Reason: In step 3, the data with key=1 was deleted, so key=1 was written into the delete predicate. In step 5, when partially updating the columns with key=1, the old data was read without considering the effect of the delete predicate, resulting in the ID2 column showing the previously deleted value.
Solution: When reading and completing data for partial column updates, consider the delete predicate to solve the issue.
Search before asking
Version
2.0.4
What's Wrong?
--1. 先创建TEST1表
drop table IF EXISTS TEST1;
CREATE TABLE IF NOT EXISTS
TEST1
(ID
int NULL COMMENT 'ID',ID1
int NULL COMMENT 'ID1',ID2
int NULL COMMENT 'ID2') UNIQUE KEY(
ID
) DISTRIBUTED BY HASH(
ID
) BUCKETS AUTO PROPERTIES ("replication_allocation" = "tag.location.default: 1",
"enable_unique_key_merge_on_write" = "true",
"store_row_column" = "true"
);
-- 2. 表中插入一条记录
insert into TEST1(ID,ID1,ID2) values(1,1,1);
select * from TEST1;
查询结果
-- 3. 删除此记录
delete from TEST1 where ID=1;
--4. 设置部分更新
set enable_unique_key_partial_update=true;
set enable_insert_strict=false;
--5. 在此插入相同key值记录
insert into TEST1(ID,ID1) values(1,2);
select * from TEST1;
What You Expected?
上面第五步骤中期望结果为
How to Reproduce?
No response
Anything Else?
No response
Are you willing to submit PR?
Code of Conduct
The text was updated successfully, but these errors were encountered: