sql connect sql use test0; #inner join + join group sql select sum(a.col1) c1 from sta a join sta b on a.ts = b.ts and a.t1 = b.t1; if $rows != 1 then return -1 endi if $data00 != 30 then return -1 endi sql_error select diff(a.col1) c1 from sta a join sta b on a.ts = b.ts and a.t1 = b.t1; sql_error select csum(b.col1) from sta a join sta b on a.ts = b.ts and a.t1 = b.t1; sql select tail(b.col1, 1) from sta a join sta b on a.ts = b.ts and a.t1 = b.t1; if $rows != 1 then return -1 endi if $data00 != 7 then return -1 endi sql select tail(b.col1, 1) from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 and a.t1 > 0; if $rows != 1 then return -1 endi if $data00 != 7 then return -1 endi sql select count(a.col1) c1 from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 interval(1s); if $rows != 6 then return -1 endi if $data00 != 2 then return -1 endi if $data10 != 1 then return -1 endi if $data20 != 1 then return -1 endi if $data30 != 2 then return -1 endi if $data40 != 1 then return -1 endi if $data50 != 1 then return -1 endi sql_error select count(a.col1) c1 from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 session(a.ts, 1s); sql_error select count(a.col1) c1 from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 session(b.ts, 1s); sql_error select count(a.col1) c1 from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 state_window(b.col1); sql_error select csum(b.col1) from sta a join sta b on a.ts = b.ts and a.t1 = b.t1 interval(1s); #inner join + no join group sql select sum(a.col1) c1 from sta a join sta b on a.ts = b.ts; if $rows != 1 then return -1 endi if $data00 != 42 then return -1 endi sql select diff(a.col1) c1 from tba1 a join tba2 b on a.ts = b.ts; if $rows != 1 then return -1 endi if $data00 != 3 then return -1 endi sql_error select csum(b.col1) from sta a join sta b on a.ts = b.ts; sql select csum(b.col1) from tba1 a join tba2 b on a.ts = b.ts; if $rows != 2 then return -1 endi if $data00 != 2 then return -1 endi if $data10 != 7 then return -1 endi sql select count(a.col1) c1 from sta a join sta b on a.ts = b.ts interval(1s); if $rows != 6 then return -1 endi if $data00 != 4 then return -1 endi if $data10 != 1 then return -1 endi if $data20 != 1 then return -1 endi if $data30 != 4 then return -1 endi if $data40 != 1 then return -1 endi if $data50 != 1 then return -1 endi sql select count(a.col1) c1 from sta a join sta b on a.ts = b.ts session(a.ts, 1s); if $rows != 1 then return -1 endi if $data00 != 12 then return -1 endi sql select count(a.col1) c1 from sta a join sta b on a.ts = b.ts session(b.ts, 1s); if $rows != 1 then return -1 endi if $data00 != 12 then return -1 endi sql select count(a.col1) c1 from sta a join sta b on a.ts = b.ts state_window(b.col1); #left join sql select sum(a.col1) c1 from sta a left join sta b on a.ts = b.ts; if $rows != 1 then return -1 endi if $data00 != 42 then return -1 endi sql select diff(a.col1) c1 from tba1 a left join tba2 b on a.ts = b.ts; if $rows != 3 then return -1 endi if $data00 != 2 then return -1 endi if $data10 != 1 then return -1 endi if $data20 != 1 then return -1 endi sql select diff(b.col1) c1 from tba1 a left join tba2 b on a.ts = b.ts; if $rows != 3 then return -1 endi if $data00 != NULL then return -1 endi if $data10 != 3 then return -1 endi if $data20 != NULL then return -1 endi sql_error select csum(b.col1) from sta a left join sta b on a.ts = b.ts; sql select csum(b.col1) from tba1 a left join tba2 b on a.ts = b.ts; if $rows != 2 then return -1 endi if $data00 != 2 then return -1 endi if $data10 != 7 then return -1 endi sql select count(a.col1) c1 from sta a left join sta b on a.ts = b.ts interval(1s); if $rows != 6 then return -1 endi if $data00 != 4 then return -1 endi if $data10 != 1 then return -1 endi if $data20 != 1 then return -1 endi if $data30 != 4 then return -1 endi if $data40 != 1 then return -1 endi if $data50 != 1 then return -1 endi sql select count(a.col1) c1 from sta a left join sta b on a.ts = b.ts session(a.ts, 1s); if $rows != 1 then return -1 endi if $data00 != 12 then return -1 endi sql_error select count(a.col1) c1 from sta a left join sta b on a.ts = b.ts session(b.ts, 1s); sql select count(a.col1) c1 from sta a left join sta b on a.ts = b.ts state_window(b.col1); #left semi join sql select sum(a.col1) c1 from sta a left semi join sta b on a.ts = b.ts; if $rows != 1 then return -1 endi if $data00 != 30 then return -1 endi sql select diff(a.col1) c1 from tba1 a left semi join tba2 b on a.ts = b.ts; if $rows != 1 then return -1 endi if $data00 != 3 then return -1 endi sql select diff(b.col1) c1 from tba1 a left semi join tba2 b on a.ts = b.ts; if $rows != 1 then return -1 endi if $data00 != 3 then return -1 endi sql_error select csum(b.col1) from sta a left semi join sta b on a.ts = b.ts; sql select csum(b.col1) from tba1 a left semi join tba2 b on a.ts = b.ts; if $rows != 2 then return -1 endi if $data00 != 2 then return -1 endi if $data10 != 7 then return -1 endi sql select count(a.col1) c1 from sta a left semi join sta b on a.ts = b.ts interval(1s); if $rows != 6 then return -1 endi if $data00 != 2 then return -1 endi if $data10 != 1 then return -1 endi if $data20 != 1 then return -1 endi if $data30 != 2 then return -1 endi if $data40 != 1 then return -1 endi if $data50 != 1 then return -1 endi sql select count(a.col1) c1 from sta a left semi join sta b on a.ts = b.ts session(a.ts, 1s); if $rows != 1 then return -1 endi if $data00 != 8 then return -1 endi sql select count(a.col1) c1 from sta a left semi join sta b on a.ts = b.ts session(b.ts, 1s); if $rows != 1 then return -1 endi if $data00 != 8 then return -1 endi sql select count(a.col1) c1 from sta a left semi join sta b on a.ts = b.ts state_window(b.col1); #left anti join sql select sum(a.col1) c1 from sta a left anti join sta b on a.ts = b.ts; if $rows != 0 then return -1 endi sql select diff(a.col1) c1 from tba1 a left anti join tba2 b on a.ts = b.ts; if $rows != 1 then return -1 endi if $data00 != 2 then return -1 endi #??????? sql select diff(b.col1) c1 from tba1 a left anti join tba2 b on a.ts = b.ts; sql select csum(b.col1) from sta a left anti join sta b on a.ts = b.ts; if $rows != 0 then return -1 endi sql select csum(b.col1) from tba1 a left anti join tba2 b on a.ts = b.ts; if $rows != 0 then return -1 endi sql select count(a.col1) c1 from sta a left anti join sta b on a.ts = b.ts interval(1s); if $rows != 0 then return -1 endi sql select count(a.col1) c1 from tba1 a left anti join tba2 b on a.ts = b.ts interval(1s); if $rows != 2 then return -1 endi if $data00 != 1 then return -1 endi if $data10 != 1 then return -1 endi sql select count(a.col1) c1 from sta a left anti join sta b on a.ts = b.ts session(a.ts, 1s); if $rows != 0 then return -1 endi sql select count(a.col1) c1 from tba1 a left anti join tba2 b on a.ts = b.ts session(a.ts, 1s); if $rows != 2 then return -1 endi if $data00 != 1 then return -1 endi if $data10 != 1 then return -1 endi sql_error select count(a.col1) c1 from sta a left anti join sta b on a.ts = b.ts session(b.ts, 1s); sql select count(a.col1) c1 from sta a left semi join sta b on a.ts = b.ts state_window(b.col1); #left asof join + join group sql select sum(a.col1) c1 from sta a left asof join sta b on a.ts > b.ts and a.t1 = b.t1; if $rows != 1 then return -1 endi if $data00 != 30 then return -1 endi sql_error select diff(a.col1) c1 from sta a left asof join sta b on a.ts > b.ts and a.t1 = b.t1; sql_error select diff(b.col1) c1 from sta a left asof join sta b on a.ts > b.ts and a.t1 = b.t1; sql_error select csum(a.col1) from sta a left asof join sta b on a.ts > b.ts and a.t1 = b.t1; sql_error select csum(b.col1) from sta a left asof join sta b on a.ts > b.ts and a.t1 = b.t1; sql select count(a.col1) c1 from sta a left asof join sta b on a.ts > b.ts and a.t1 = b.t1 interval(1s); if $rows != 6 then return -1 endi if $data00 != 2 then return -1 endi if $data10 != 1 then return -1 endi if $data20 != 1 then return -1 endi if $data30 != 2 then return -1 endi if $data40 != 1 then return -1 endi if $data50 != 1 then return -1 endi sql_error select count(a.col1) c1 from sta a left asof join sta b on a.ts > b.ts and a.t1 = b.t1 session(a.ts, 1s); sql_error select count(a.col1) c1 from sta a left asof join sta b on a.ts > b.ts and a.t1 = b.t1 session(b.ts, 1s); sql_error select count(a.col1) c1 from sta a left asof join sta b on a.ts > b.ts and a.t1 = b.t1 state_window(b.col1); #left asof join + no join group sql select sum(a.col1) c1 from sta a left asof join sta b on a.ts > b.ts; if $rows != 1 then return -1 endi if $data00 != 30 then return -1 endi sql_error select diff(a.col1) c1 from sta a left asof join sta b on a.ts > b.ts; sql select diff(a.col1) c1 from tba1 a left asof join tba2 b on a.ts > b.ts; if $rows != 3 then return -1 endi if $data00 != 2 then return -1 endi if $data10 != 1 then return -1 endi if $data20 != 1 then return -1 endi sql select diff(b.col1) c1 from tba1 a left asof join tba2 b on a.ts > b.ts; if $rows != 3 then return -1 endi if $data00 != NULL then return -1 endi if $data10 != 0 then return -1 endi if $data20 != 2 then return -1 endi sql select csum(a.col1) from tba1 a left asof join tba2 b on a.ts > b.ts; if $rows != 4 then return -1 endi if $data00 != 1 then return -1 endi if $data10 != 4 then return -1 endi if $data20 != 8 then return -1 endi if $data30 != 13 then return -1 endi sql select csum(b.col1) from tba1 a left asof join tba2 b on a.ts > b.ts; if $rows != 3 then return -1 endi if $data00 != 3 then return -1 endi if $data10 != 6 then return -1 endi if $data20 != 11 then return -1 endi sql select count(a.col1) c1 from tba1 a left asof join tba2 b on a.ts > b.ts interval(1s); if $rows != 4 then return -1 endi if $data00 != 1 then return -1 endi if $data10 != 1 then return -1 endi if $data20 != 1 then return -1 endi if $data30 != 1 then return -1 endi sql select count(a.col1) c1 from tba1 a left asof join tba2 b on a.ts > b.ts session(a.ts, 1s); if $rows != 2 then return -1 endi if $data00 != 1 then return -1 endi if $data10 != 3 then return -1 endi sql_error select count(a.col1) c1 from tba1 a left asof join tba2 b on a.ts > b.ts session(b.ts, 1s); sql select count(a.col1) c1 from tba1 a left asof join tba2 b on a.ts > b.ts state_window(b.col1); #left win join + join group sql select sum(a.col1) c1 from sta a left window join sta b on a.t1 = b.t1 window_offset(-1s, 1s); if $rows != 8 then return -1 endi if $data00 != 4 then return -1 endi if $data10 != 6 then return -1 endi if $data20 != 5 then return -1 endi if $data30 != 7 then return -1 endi if $data40 != 1 then return -1 endi if $data50 != 6 then return -1 endi if $data60 != 12 then return -1 endi if $data70 != 10 then return -1 endi sql_error select diff(a.col1) c1 from sta a left window join sta b on a.t1 = b.t1 window_offset(-1s, 1s); sql_error select csum(a.col1) from sta a left window join sta b on a.t1 = b.t1 window_offset(-1s, 1s); sql_error select count(a.col1) c1 from sta a left window join sta b on a.t1 = b.t1 window_offset(-1s, 1s) interval(1s); sql_error select count(a.col1) c1 from sta a left window join sta b on a.t1 = b.t1 window_offset(-1s, 1s) session(a.ts, 1s); sql_error select count(a.col1) c1 from sta a left window join sta b on a.t1 = b.t1 window_offset(-1s, 1s) session(b.ts, 1s); sql_error select count(a.col1) c1 from sta a left window join sta b on a.t1 = b.t1 window_offset(-1s, 1s) state_window(b.col1); #left win join + no join group sql select sum(a.col1) c1 from sta a left window join sta b window_offset(-1s, 1s) order by c1; if $rows != 8 then return -1 endi if $data00 != 3 then return -1 endi if $data10 != 6 then return -1 endi if $data20 != 12 then return -1 endi if $data30 != 12 then return -1 endi if $data40 != 14 then return -1 endi if $data50 != 16 then return -1 endi if $data60 != 20 then return -1 endi if $data70 != 20 then return -1 endi sql_error select diff(a.col1) c1 from sta a left window join sta b window_offset(-1s, 1s); sql select diff(a.col1) c1 from tba1 a left window join tba2 b window_offset(-1s, 0s); if $rows != 0 then return -1 endi sql select diff(b.col1) c1 from tba1 a left window join tba2 b window_offset(-1s, 0s); if $rows != 0 then return -1 endi sql select diff(b.col1) c1 from sta a left window join tba1 b window_offset(-1s, 1s); if $rows != 7 then return -1 endi if $data00 != 2 then return -1 endi if $data10 != 1 then return -1 endi if $data20 != 1 then return -1 endi if $data30 != 1 then return -1 endi if $data40 != 1 then return -1 endi if $data50 != 1 then return -1 endi if $data60 != 1 then return -1 endi sql_error select csum(a.col1) from sta a left window join sta b window_offset(-1s, 1s); sql_error select csum(a.col1) from tba1 a left window join tba2 b window_offset(-1s, 1s); sql select csum(a.col1) from tba1 a left window join tba2 b window_offset(-1s, 0s); if $rows != 4 then return -1 endi if $data00 != 1 then return -1 endi if $data10 != 3 then return -1 endi if $data20 != 4 then return -1 endi if $data30 != 5 then return -1 endi sql select csum(b.col1) from tba1 a left window join tba2 b window_offset(-1s, 1s); if $rows != 7 then return -1 endi if $data00 != 2 then return -1 endi if $data10 != 5 then return -1 endi if $data20 != 3 then return -1 endi if $data30 != 8 then return -1 endi if $data40 != 5 then return -1 endi if $data50 != 5 then return -1 endi if $data60 != 12 then return -1 endi sql_error select count(a.col1) c1 from sta a left window join sta b window_offset(-1s, 1s) interval(1s); sql_error select count(a.col1) c1 from sta a left window join sta b window_offset(-1s, 1s) session(a.ts, 1s); sql_error select count(a.col1) c1 from sta a left window join sta b window_offset(-1s, 1s) session(b.ts, 1s); sql_error select count(a.col1) c1 from sta a left window join sta b window_offset(-1s, 1s) state_window(b.col1); #full join sql select sum(a.col1) c1 from sta a full join sta b on a.ts = b.ts; if $rows != 1 then return -1 endi if $data00 != 42 then return -1 endi sql_error select diff(a.col1) c1 from tba1 a full join tba2 b on a.ts = b.ts; sql_error select diff(b.col1) c1 from tba1 a full join tba2 b on a.ts = b.ts; sql_error select csum(b.col1) from sta a full join sta b on a.ts = b.ts; sql_error select csum(b.col1) from tba1 a full join tba2 b on a.ts = b.ts; sql_error select count(a.col1) c1 from sta a full join sta b on a.ts = b.ts interval(1s); sql_error select count(a.col1) c1 from sta a full join sta b on a.ts = b.ts session(a.ts, 1s); sql_error select count(a.col1) c1 from sta a full join sta b on a.ts = b.ts session(b.ts, 1s); sql_error select count(a.col1) c1 from sta a full join sta b on a.ts = b.ts state_window(b.col1);