Skip to content

Hang on merge statement with data change delta table #3391

@htran1

Description

@htran1

Hang is observed in 2.1.210, but not 2.0.206.

In the following script, the first execution of the merge returns 1 row. The second execution hangs.

drop table if exists test;
create table test (id int primary key, val1 int, val2 int);

insert into test (id, val1, val2) values (1, 2, 3);
insert into test (id, val1, val2) values (2, 2, 3);
insert into test (id, val1, val2) values (3, 2, 3);
commit;

select test.id from final table (
    merge into test using (
        select t.id, t.val1, t.val2 from (select 1, 2, 3) t (id, val1, val2)) t on test.id = t.id when matched and test.id = 1 then update set test.id = 1, test.val1 = 2, test.val2 = 3 when not matched then insert(id, val1, val2) values (t.id, t.val1, t.val2)) test;

select test.id from final table (
    merge into test using (
        select t.id, t.val1, t.val2 from (select 1, 2, 3) t (id, val1, val2)) t on test.id = t.id when matched and test.id = 1 then update set test.id = 1, test.val1 = 2, test.val2 = 3 when not matched then insert(id, val1, val2) values (t.id, t.val1, t.val2)) test;

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions