-
Notifications
You must be signed in to change notification settings - Fork 753
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
for merge-into stmt with both matched and not-matched branch, right join is used, after got the joined result-set, a column of the result-set is chosen as the "split" column, i.e. for rows of the split column, those are nulls are recognized as no-matched, and others as matched. before this PR, an arbitrary column of target table is picked as the "split" column, which is unsafe, since the "arbitrary column" may have NULL values originally, which may lead to incorrectly treat a matched row as unmatched, and unexpected result (data duplication).
- Loading branch information
1 parent
28c543e
commit 2ec12ac
Showing
4 changed files
with
31 additions
and
17 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
28 changes: 28 additions & 0 deletions
28
tests/sqllogictests/suites/base/09_fuse_engine/09_0040_merge_into_issue_15643.test
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
statement ok | ||
create or replace database m_test; | ||
|
||
statement ok | ||
use m_test; | ||
|
||
statement ok | ||
create table t(a string, b string, c string, d string, k string); | ||
|
||
statement ok | ||
create table s(a string, b string, c string, d string, k string); | ||
|
||
statement ok | ||
insert into t(k) values('k'); | ||
|
||
statement ok | ||
insert into s(k) values('k'); | ||
|
||
|
||
query II | ||
merge into t using s on t.k = s.k when matched then update * when not matched then insert *; | ||
---- | ||
0 1 | ||
|
||
query TTTTT | ||
select * from t; | ||
---- | ||
NULL NULL NULL NULL k |