Skip to content

Commit

Permalink
chore: fix flaky test 09_0036_merge_into_without_dist
Browse files Browse the repository at this point in the history
  • Loading branch information
dantengsky committed Sep 14, 2024
1 parent 26b1a17 commit 8fe23ce
Showing 1 changed file with 35 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -612,24 +612,59 @@ create table source_test(a int,b string,delete_flag bool) cluster by(a,b);
statement ok
insert into source_test values(1,'d',true),(2,'e',true),(3,'f',false),(4,'e',true),(5,'f',false);

###############################################################################
# To avoid flakiness, using different stage names for http and mysql handlers #
# testing of these 2 handlers may be run concurrently, and conflict with each #
# other, leading to flaky tests. #
###############################################################################

onlyif mysql
statement ok
drop stage if exists source_parquet;

onlyif mysql
statement ok
create stage source_parquet file_format = (type = parquet);

onlyif mysql
statement ok
remove @source_parquet;

onlyif mysql
statement ok
copy into @source_parquet from (select * from source_test);

onlyif mysql
query TTT
merge into `target_test` as tt using (select `a`,`b`,`delete_flag` from @source_parquet (pattern => '.*[.]parquet')) as ss on (ss.`a` = tt.`a`)
when matched and ss.`delete_flag` = true then delete when matched then update * when not matched and ss.`delete_flag` = false then insert *;
----
1 1 2


onlyif http
statement ok
drop stage if exists source_parquet_http;

onlyif http
statement ok
create stage source_parquet_http file_format = (type = parquet);

onlyif http
statement ok
remove @source_parquet_http;

onlyif http
statement ok
copy into @source_parquet_http from (select * from source_test);

onlyif http
query TTT
merge into `target_test` as tt using (select `a`,`b`,`delete_flag` from @source_parquet_http (pattern => '.*[.]parquet')) as ss on (ss.`a` = tt.`a`)
when matched and ss.`delete_flag` = true then delete when matched then update * when not matched and ss.`delete_flag` = false then insert *;
----
1 1 2

query TT
select * from target_test order by a;
----
Expand Down

0 comments on commit 8fe23ce

Please sign in to comment.