homework-jianmu/tests/script/tsim/join/left_anti_join.sim

192 lines
3.6 KiB
Plaintext

sql connect
sql use test0;
sql select a.ts, b.ts from sta a left anti join sta b on a.ts = b.ts and a.ts < '2023-11-17 16:29:02' order by a.ts
if $rows != 5 then
return -1
endi
if $data00 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data01 != NULL then
return -1
endi
if $data10 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data11 != NULL then
return -1
endi
if $data20 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data21 != NULL then
return -1
endi
if $data30 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data31 != NULL then
return -1
endi
if $data40 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data41 != NULL then
return -1
endi
sql select a.col1, b.col1 from sta a left anti join sta b on a.ts = b.ts and a.col1 != b.col1 where a.ts < '2023-11-17 16:29:02' order by a.col1;
if $rows != 1 then
return -1
endi
if $data00 != 3 then
return -1
endi
if $data01 != NULL then
return -1
endi
sql select a.col1, b.col1 from sta a left anti join sta b on a.ts = b.ts;
if $rows != 0 then
return -1
endi
sql select a.ts, b.ts from tba1 a left anti join tba2 b on a.ts = b.ts order by a.ts;
if $rows != 2 then
return -1
endi
if $data00 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data01 != NULL then
return -1
endi
if $data10 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data11 != NULL then
return -1
endi
sql select a.col1, b.col1 from tba2 a left anti join tba1 b on a.ts = b.ts order by a.col1;
if $rows != 2 then
return -1
endi
if $data00 != 3 then
return -1
endi
if $data01 != NULL then
return -1
endi
if $data10 != 7 then
return -1
endi
if $data11 != NULL then
return -1
endi
sql select a.ts, b.ts from tba1 a left anti join tba2 b on a.ts = b.ts order by a.ts desc;
if $rows != 2 then
return -1
endi
if $data00 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data01 != NULL then
return -1
endi
if $data10 != @23-11-17 16:29:02.000@ then
return -1
endi
if $data11 != NULL then
return -1
endi
sql select a.ts, b.ts from sta a left anti join sta b on a.ts = b.ts and b.ts < '2023-11-17 16:29:03.000' order by a.ts desc;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data01 != NULL then
return -1
endi
if $data10 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data11 != NULL then
return -1
endi
if $data20 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data21 != NULL then
return -1
endi
if $data30 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data31 != NULL then
return -1
endi
sql select a.ts, b.ts from sta a left anti join sta b on a.ts = b.ts and b.ts < '2023-11-17 16:29:03.000' order by b.ts desc;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data01 != NULL then
return -1
endi
if $data10 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data11 != NULL then
return -1
endi
if $data20 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data21 != NULL then
return -1
endi
if $data30 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data31 != NULL then
return -1
endi
sql select a.ts, b.ts from sta a left anti join sta b on a.ts = b.ts and b.ts < '2023-11-17 16:29:03.000' order by a.ts desc, b.ts;
if $rows != 4 then
return -1
endi
if $data00 != @23-11-17 16:29:05.000@ then
return -1
endi
if $data01 != NULL then
return -1
endi
if $data10 != @23-11-17 16:29:04.000@ then
return -1
endi
if $data11 != NULL then
return -1
endi
if $data20 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data21 != NULL then
return -1
endi
if $data30 != @23-11-17 16:29:03.000@ then
return -1
endi
if $data31 != NULL then
return -1
endi