TDengine/tests/army/query/joinConst/full_outer.today.csv
Pan Wei 0cb0e109a7
enh: add more cases for constant join (#30225)
* fix: add more cases and fix issues

* enh: add more test cases

* enh: add more test cases

* fix: memory leak issue

* enh: add view cases and fix order by issue

* enh: add document description
2025-03-19 16:50:44 +08:00

50 KiB

1taos> use test;
2Database changed.
3taos> select * from a1 a full join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
4 ts | f | g | ts | f | g | 'a' |
5==================================================================================================================
6 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
7 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
8 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
9 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
10 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NU. |
11 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NU. |
12 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NU. |
13taos> select * from a1 a full join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
14 ts | f | g | ts1 | f | g | 'a' |
15==================================================================================================================
16 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 301 | 3011 | a |
17 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 302 | 3012 | a |
18 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 303 | 3013 | a |
19 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | 304 | 3014 | a |
20 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NU. |
21 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NU. |
22 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NU. |
23taos> select a.* from a1 a full join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
24 ts | f | g |
25======================================================
26 __today__ 00:00:00.000 | 101 | 1011 |
27 __today__ 00:00:00.000 | 101 | 1011 |
28 __today__ 00:00:00.000 | 101 | 1011 |
29 __today__ 00:00:00.000 | 101 | 1011 |
30 __today__ 00:00:01.000 | 102 | 1012 |
31 __tomorrow__ 00:00:00.000 | 103 | 1013 |
32 __tomorrow__ 00:00:02.000 | 104 | 1014 |
33taos> select b.* from a1 a full join (select today as ts, f, g, 'a' from b1) b on a.ts = b.ts;
34 ts | f | g | 'a' |
35============================================================
36 __today__ 00:00:00.000 | 301 | 3011 | a |
37 __today__ 00:00:00.000 | 302 | 3012 | a |
38 __today__ 00:00:00.000 | 303 | 3013 | a |
39 __today__ 00:00:00.000 | 304 | 3014 | a |
40 NULL | NULL | NULL | NU. |
41 NULL | NULL | NULL | NU. |
42 NULL | NULL | NULL | NU. |
43taos> select b.* from a1 a full join (select today as ts1, f, g, 'a' from b1) b on a.ts = b.ts1;
44 ts1 | f | g | 'a' |
45============================================================
46 __today__ 00:00:00.000 | 301 | 3011 | a |
47 __today__ 00:00:00.000 | 302 | 3012 | a |
48 __today__ 00:00:00.000 | 303 | 3013 | a |
49 __today__ 00:00:00.000 | 304 | 3014 | a |
50 NULL | NULL | NULL | NU. |
51 NULL | NULL | NULL | NU. |
52 NULL | NULL | NULL | NU. |
53taos> select a.*, b.ts from a1 a full join (select today as ts1,ts, f, g, 'a' from b1) b on a.ts = b.ts1;
54 ts | f | g | ts |
55================================================================================
56 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 |
57 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:01.000 |
58 __today__ 00:00:00.000 | 101 | 1011 | __tomorrow__ 00:00:00.000 |
59 __today__ 00:00:00.000 | 101 | 1011 | __tomorrow__ 00:00:02.000 |
60 __today__ 00:00:01.000 | 102 | 1012 | NULL |
61 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL |
62 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL |
63taos> select b.c from a1 a full join (select today as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
64 c |
65======
66 a |
67 a |
68 a |
69 a |
70 NU. |
71 NU. |
72 NU. |
73taos> select b.ts from a1 a full join (select today as ts, f, g, 'a' c from b1) b on a.ts = b.ts;
74 ts |
75==========================
76 __today__ 00:00:00.000 |
77 __today__ 00:00:00.000 |
78 __today__ 00:00:00.000 |
79 __today__ 00:00:00.000 |
80 NULL |
81 NULL |
82 NULL |
83taos> select * from a1 a full join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
84 ts | f | g | ts1 | ts | f | g | 'a' |
85============================================================================================================================================
86 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
87 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
88 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
89 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
90 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
91 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
92 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
93taos> select a.* from a1 a full join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
94 ts | f | g |
95======================================================
96 __today__ 00:00:00.000 | 101 | 1011 |
97 __today__ 00:00:00.000 | 101 | 1011 |
98 __today__ 00:00:00.000 | 101 | 1011 |
99 __today__ 00:00:00.000 | 101 | 1011 |
100 __today__ 00:00:01.000 | 102 | 1012 |
101 __tomorrow__ 00:00:00.000 | 103 | 1013 |
102 __tomorrow__ 00:00:02.000 | 104 | 1014 |
103taos> select b.* from a1 a full join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts;
104 ts1 | ts | f | g | 'a' |
105======================================================================================
106 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
107 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
108 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
109 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
110 NULL | NULL | NULL | NULL | NU. |
111 NULL | NULL | NULL | NULL | NU. |
112 NULL | NULL | NULL | NULL | NU. |
113taos> select b.c from a1 a full join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts;
114 c |
115======
116 a |
117 a |
118 a |
119 a |
120 NU. |
121 NU. |
122 NU. |
123taos> select * from a1 a full join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
124 ts | f | g | ts1 | ts | f | g | c |
125============================================================================================================================================
126 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
127 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
128 __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
129 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
130taos> select a.* from a1 a full join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
131 ts | f | g |
132======================================================
133 __today__ 00:00:00.000 | 101 | 1011 |
134 __today__ 00:00:01.000 | 102 | 1012 |
135 __tomorrow__ 00:00:00.000 | 103 | 1013 |
136 __tomorrow__ 00:00:02.000 | 104 | 1014 |
137taos> select b.* from a1 a full join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts;
138 ts1 | ts | f | g | c |
139======================================================================================
140 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
141 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
142 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
143 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
144taos> select b.ts1,a.ts from a1 a full join (select today as ts1, f, g, 'a' c from b1) b on b.ts1 = a.ts;
145 ts1 | ts |
146====================================================
147 __today__ 00:00:00.000 | __today__ 00:00:00.000 |
148 __today__ 00:00:00.000 | __today__ 00:00:00.000 |
149 __today__ 00:00:00.000 | __today__ 00:00:00.000 |
150 __today__ 00:00:00.000 | __today__ 00:00:00.000 |
151 NULL | __today__ 00:00:01.000 |
152 NULL | __tomorrow__ 00:00:00.000 |
153 NULL | __tomorrow__ 00:00:02.000 |
154taos> select * from a1 a full join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
155 ts | f | g | ts1 | ts | f | g | 'a' |
156============================================================================================================================================
157 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
158 __today__ 00:00:01.000 | 102 | 1012 | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
159 __tomorrow__ 00:00:00.000 | 103 | 1013 | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
160 __tomorrow__ 00:00:02.000 | 104 | 1014 | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
161taos> select a.* from a1 a full join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
162 ts | f | g |
163======================================================
164 __today__ 00:00:00.000 | 101 | 1011 |
165 __today__ 00:00:01.000 | 102 | 1012 |
166 __tomorrow__ 00:00:00.000 | 103 | 1013 |
167 __tomorrow__ 00:00:02.000 | 104 | 1014 |
168taos> select b.* from a1 a full join (select today as ts1, ts, f, g, 'a' from b1) b on a.ts = b.ts;
169 ts1 | ts | f | g | 'a' |
170======================================================================================
171 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
172 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
173 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
174 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
175taos> select b.c from a1 a full join (select today as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
176 c |
177======
178 a |
179 a |
180 a |
181 a |
182taos> select b.ts from a1 a full join (select today as ts1, ts, f, g, 'a' c from b1) b on a.ts = b.ts;
183 ts |
184==========================
185 __today__ 00:00:00.000 |
186 __today__ 00:00:01.000 |
187 __tomorrow__ 00:00:00.000 |
188 __tomorrow__ 00:00:02.000 |
189taos> select * from a1 a full join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
190 ts | f | g | ts1 | ts | f | g | 'a' |
191============================================================================================================================================
192 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
193 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
194 NULL | NULL | NULL | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
195 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
196 NULL | NULL | NULL | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
197 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
198 NULL | NULL | NULL | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
199taos> select a.* from a1 a full join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
200 ts | f | g |
201======================================================
202 __today__ 00:00:00.000 | 101 | 1011 |
203 __today__ 00:00:01.000 | 102 | 1012 |
204 NULL | NULL | NULL |
205 __tomorrow__ 00:00:00.000 | 103 | 1013 |
206 NULL | NULL | NULL |
207 __tomorrow__ 00:00:02.000 | 104 | 1014 |
208 NULL | NULL | NULL |
209taos> select b.* from a1 a full join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts1 = a.ts and a.ts = b.ts;
210 ts1 | ts | f | g | 'a' |
211======================================================================================
212 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
213 NULL | NULL | NULL | NULL | NU. |
214 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
215 NULL | NULL | NULL | NULL | NU. |
216 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
217 NULL | NULL | NULL | NULL | NU. |
218 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
219taos> select b.c from a1 a full join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
220 c |
221======
222 a |
223 NU. |
224 a |
225 NU. |
226 a |
227 NU. |
228 a |
229taos> select b.ts from a1 a full join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts and a.ts = b.ts;
230 ts |
231==========================
232 __today__ 00:00:00.000 |
233 NULL |
234 __today__ 00:00:01.000 |
235 NULL |
236 __tomorrow__ 00:00:00.000 |
237 NULL |
238 __tomorrow__ 00:00:02.000 |
239taos> select * from a1 a full join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
240 ts | f | g | ts1 | ts | f | g | 'a' |
241============================================================================================================================================
242 __today__ 00:00:00.000 | 101 | 1011 | __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
243 __today__ 00:00:01.000 | 102 | 1012 | NULL | NULL | NULL | NULL | NU. |
244 NULL | NULL | NULL | __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
245 __tomorrow__ 00:00:00.000 | 103 | 1013 | NULL | NULL | NULL | NULL | NU. |
246 NULL | NULL | NULL | __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
247 __tomorrow__ 00:00:02.000 | 104 | 1014 | NULL | NULL | NULL | NULL | NU. |
248 NULL | NULL | NULL | __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
249taos> select a.* from a1 a full join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
250 ts | f | g |
251======================================================
252 __today__ 00:00:00.000 | 101 | 1011 |
253 __today__ 00:00:01.000 | 102 | 1012 |
254 NULL | NULL | NULL |
255 __tomorrow__ 00:00:00.000 | 103 | 1013 |
256 NULL | NULL | NULL |
257 __tomorrow__ 00:00:02.000 | 104 | 1014 |
258 NULL | NULL | NULL |
259taos> select b.* from a1 a full join (select today as ts1, ts, f, g, 'a' from b1) b on b.ts = a.ts and a.ts = b.ts1;
260 ts1 | ts | f | g | 'a' |
261======================================================================================
262 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
263 NULL | NULL | NULL | NULL | NU. |
264 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
265 NULL | NULL | NULL | NULL | NU. |
266 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
267 NULL | NULL | NULL | NULL | NU. |
268 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
269taos> select b.c from a1 a full join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
270 c |
271======
272 a |
273 NU. |
274 a |
275 NU. |
276 a |
277 NU. |
278 a |
279taos> select b.ts from a1 a full join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
280 ts |
281==========================
282 __today__ 00:00:00.000 |
283 NULL |
284 __today__ 00:00:01.000 |
285 NULL |
286 __tomorrow__ 00:00:00.000 |
287 NULL |
288 __tomorrow__ 00:00:02.000 |
289taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a full join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
290 ts |
291==========================
292 __today__ 00:00:00.000 |
293 NULL |
294 __today__ 00:00:01.000 |
295 NULL |
296 __tomorrow__ 00:00:00.000 |
297 NULL |
298 __tomorrow__ 00:00:02.000 |
299taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a full join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
300 ts |
301==========================
302 __today__ 00:00:00.000 |
303 __today__ 00:00:01.000 |
304 __tomorrow__ 00:00:00.000 |
305 __tomorrow__ 00:00:02.000 |
306taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1 order by f) a full join (select today as ts1, ts, f, g, 'a' c from b1) b on b.ts1 = a.ts1 and a.ts = b.ts;
307 ts |
308==========================
309 __today__ 00:00:00.000 |
310 __today__ 00:00:01.000 |
311 __tomorrow__ 00:00:00.000 |
312 __tomorrow__ 00:00:02.000 |
313taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from a1) a full join (select now() as ts1, ts, f, g, 'a' c from b1) b on b.ts = a.ts and a.ts = b.ts1;
314 ts |
315==========================
316 NULL |
317 __today__ 00:00:00.000 |
318 NULL |
319 __today__ 00:00:01.000 |
320 NULL |
321 __tomorrow__ 00:00:00.000 |
322 NULL |
323 __tomorrow__ 00:00:02.000 |
324taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta full join (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb on ta.ts=tb.ts and ta.tg1=tb.tg1;
325 ts | val | tg1 | ts | val | tg1 |
326============================================================================================================
327 NULL | NULL | NULL | __today__ 00:00:00.000 | 404 | 1 |
328 __tomorrow__ 00:00:03.000 | 204 | 1 | NULL | NULL | NULL |
329taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta full join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
330 ts | val | tg2 | ts | val | tg2 |
331============================================================================================================
332 NULL | NULL | NULL | __today__ 00:00:00.000 | 304 | 1 |
333 NULL | NULL | NULL | __today__ 00:00:00.000 | 404 | 2 |
334 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
335 __tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
336taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta full join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 order by ta.ts, ta.val, tb.val;
337 ts | val | tg2 | ts | val | tg2 |
338============================================================================================================
339 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
340 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
341 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
342 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
343 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
344 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
345 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
346 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
347 __today__ 00:00:01.000 | 102 | 1 | NULL | NULL | NULL |
348 __today__ 00:00:01.000 | 202 | 2 | NULL | NULL | NULL |
349 __tomorrow__ 00:00:00.000 | 103 | 1 | NULL | NULL | NULL |
350 __tomorrow__ 00:00:00.000 | 203 | 2 | NULL | NULL | NULL |
351 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
352 __tomorrow__ 00:00:03.000 | 204 | 2 | NULL | NULL | NULL |
353taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta full join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today where tb.ts=today order by tb.val;
354 ts | val | tg2 | ts | val | tg2 |
355============================================================================================================
356 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 301 | 1 |
357 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 302 | 1 |
358 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 303 | 1 |
359 __today__ 00:00:00.000 | 101 | 1 | __today__ 00:00:00.000 | 304 | 1 |
360 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 401 | 2 |
361 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 402 | 2 |
362 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 403 | 2 |
363 __today__ 00:00:00.000 | 201 | 2 | __today__ 00:00:00.000 | 404 | 2 |
364taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta full join (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today where tb.ts>today;
365taos> select * from (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta full join (select today + 1d +3s ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb on ta.ts=tb.ts and ta.tg2=tb.tg2;
366 ts | val | tg2 | ts | val | tg2 |
367============================================================================================================
368 __tomorrow__ 00:00:02.000 | 104 | 1 | NULL | NULL | NULL |
369 __tomorrow__ 00:00:03.000 | 204 | 2 | __tomorrow__ 00:00:03.000 | 404 | 2 |
370 NULL | NULL | NULL | __tomorrow__ 00:00:03.000 | 304 | 1 |
371taos> select * from (select today as ts, f, g, 'a' from b1) b full join a1 a on a.ts = b.ts;
372 ts | f | g | 'a' | ts | f | g |
373==================================================================================================================
374 __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
375 __today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
376 __today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
377 __today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
378 NULL | NULL | NULL | NU. | __today__ 00:00:01.000 | 102 | 1012 |
379 NULL | NULL | NULL | NU. | __tomorrow__ 00:00:00.000 | 103 | 1013 |
380 NULL | NULL | NULL | NU. | __tomorrow__ 00:00:02.000 | 104 | 1014 |
381taos> select * from (select today as ts1, f, g, 'a' from b1) b full join a1 a on a.ts = b.ts1;
382 ts1 | f | g | 'a' | ts | f | g |
383==================================================================================================================
384 __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
385 __today__ 00:00:00.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
386 __today__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
387 __today__ 00:00:00.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
388 NULL | NULL | NULL | NU. | __today__ 00:00:01.000 | 102 | 1012 |
389 NULL | NULL | NULL | NU. | __tomorrow__ 00:00:00.000 | 103 | 1013 |
390 NULL | NULL | NULL | NU. | __tomorrow__ 00:00:02.000 | 104 | 1014 |
391taos> select a.* from (select today as ts, f, g, 'a' from b1) b full join a1 a on a.ts = b.ts;
392 ts | f | g |
393======================================================
394 __today__ 00:00:00.000 | 101 | 1011 |
395 __today__ 00:00:00.000 | 101 | 1011 |
396 __today__ 00:00:00.000 | 101 | 1011 |
397 __today__ 00:00:00.000 | 101 | 1011 |
398 __today__ 00:00:01.000 | 102 | 1012 |
399 __tomorrow__ 00:00:00.000 | 103 | 1013 |
400 __tomorrow__ 00:00:02.000 | 104 | 1014 |
401taos> select b.* from (select today as ts, f, g, 'a' from b1) b full join a1 a on a.ts = b.ts;
402 ts | f | g | 'a' |
403============================================================
404 __today__ 00:00:00.000 | 301 | 3011 | a |
405 __today__ 00:00:00.000 | 302 | 3012 | a |
406 __today__ 00:00:00.000 | 303 | 3013 | a |
407 __today__ 00:00:00.000 | 304 | 3014 | a |
408 NULL | NULL | NULL | NU. |
409 NULL | NULL | NULL | NU. |
410 NULL | NULL | NULL | NU. |
411taos> select b.* from (select today as ts1, f, g, 'a' from b1) b full join a1 a on a.ts = b.ts1;
412 ts1 | f | g | 'a' |
413============================================================
414 __today__ 00:00:00.000 | 301 | 3011 | a |
415 __today__ 00:00:00.000 | 302 | 3012 | a |
416 __today__ 00:00:00.000 | 303 | 3013 | a |
417 __today__ 00:00:00.000 | 304 | 3014 | a |
418 NULL | NULL | NULL | NU. |
419 NULL | NULL | NULL | NU. |
420 NULL | NULL | NULL | NU. |
421taos> select b.c from (select today as ts, f, g, 'a' c from b1) b full join a1 a on a.ts = b.ts;
422 c |
423======
424 a |
425 a |
426 a |
427 a |
428 NU. |
429 NU. |
430 NU. |
431taos> select b.ts from (select today as ts, f, g, 'a' c from b1) b full join a1 a on a.ts = b.ts;
432 ts |
433==========================
434 __today__ 00:00:00.000 |
435 __today__ 00:00:00.000 |
436 __today__ 00:00:00.000 |
437 __today__ 00:00:00.000 |
438 NULL |
439 NULL |
440 NULL |
441taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b full join a1 a on b.ts1 = a.ts;
442 ts1 | ts | f | g | 'a' | ts | f | g |
443============================================================================================================================================
444 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
445 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:00.000 | 101 | 1011 |
446 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __today__ 00:00:00.000 | 101 | 1011 |
447 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __today__ 00:00:00.000 | 101 | 1011 |
448 NULL | NULL | NULL | NULL | NU. | __today__ 00:00:01.000 | 102 | 1012 |
449 NULL | NULL | NULL | NULL | NU. | __tomorrow__ 00:00:00.000 | 103 | 1013 |
450 NULL | NULL | NULL | NULL | NU. | __tomorrow__ 00:00:02.000 | 104 | 1014 |
451taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b full join a1 a on b.ts1 = a.ts;
452 ts | f | g |
453======================================================
454 __today__ 00:00:00.000 | 101 | 1011 |
455 __today__ 00:00:00.000 | 101 | 1011 |
456 __today__ 00:00:00.000 | 101 | 1011 |
457 __today__ 00:00:00.000 | 101 | 1011 |
458 __today__ 00:00:01.000 | 102 | 1012 |
459 __tomorrow__ 00:00:00.000 | 103 | 1013 |
460 __tomorrow__ 00:00:02.000 | 104 | 1014 |
461taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b full join a1 a on b.ts1 = a.ts;
462 ts1 | ts | f | g | 'a' |
463======================================================================================
464 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
465 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
466 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
467 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
468 NULL | NULL | NULL | NULL | NU. |
469 NULL | NULL | NULL | NULL | NU. |
470 NULL | NULL | NULL | NULL | NU. |
471taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b full join a1 a on b.ts1 = a.ts;
472 c |
473======
474 a |
475 a |
476 a |
477 a |
478 NU. |
479 NU. |
480 NU. |
481taos> select b.ts1 from (select today as ts1, f, g, 'a' c from b1) b full join a1 a on b.ts1 = a.ts;
482 ts1 |
483==========================
484 __today__ 00:00:00.000 |
485 __today__ 00:00:00.000 |
486 __today__ 00:00:00.000 |
487 __today__ 00:00:00.000 |
488 NULL |
489 NULL |
490 NULL |
491taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b full join a1 a on a.ts = b.ts;
492 ts1 | ts | f | g | 'a' | ts | f | g |
493============================================================================================================================================
494 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
495 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | __today__ 00:00:01.000 | 102 | 1012 |
496 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | __tomorrow__ 00:00:00.000 | 103 | 1013 |
497 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | __tomorrow__ 00:00:02.000 | 104 | 1014 |
498taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b full join a1 a on a.ts = b.ts;
499 ts | f | g |
500======================================================
501 __today__ 00:00:00.000 | 101 | 1011 |
502 __today__ 00:00:01.000 | 102 | 1012 |
503 __tomorrow__ 00:00:00.000 | 103 | 1013 |
504 __tomorrow__ 00:00:02.000 | 104 | 1014 |
505taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b full join a1 a on a.ts = b.ts;
506 ts1 | ts | f | g | 'a' |
507======================================================================================
508 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
509 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
510 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
511 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
512taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b full join a1 a on a.ts = b.ts;
513 c |
514======
515 a |
516 a |
517 a |
518 a |
519taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b full join a1 a on a.ts = b.ts;
520 ts |
521==========================
522 __today__ 00:00:00.000 |
523 __today__ 00:00:01.000 |
524 __tomorrow__ 00:00:00.000 |
525 __tomorrow__ 00:00:02.000 |
526taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b full join a1 a on b.ts1 = a.ts and a.ts = b.ts;
527 ts1 | ts | f | g | 'a' | ts | f | g |
528============================================================================================================================================
529 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
530 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | NULL | NULL | NULL |
531 NULL | NULL | NULL | NULL | NU. | __today__ 00:00:01.000 | 102 | 1012 |
532 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | NULL | NULL | NULL |
533 NULL | NULL | NULL | NULL | NU. | __tomorrow__ 00:00:00.000 | 103 | 1013 |
534 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | NULL | NULL | NULL |
535 NULL | NULL | NULL | NULL | NU. | __tomorrow__ 00:00:02.000 | 104 | 1014 |
536taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b full join a1 a on b.ts1 = a.ts and a.ts = b.ts;
537 ts | f | g |
538======================================================
539 __today__ 00:00:00.000 | 101 | 1011 |
540 NULL | NULL | NULL |
541 __today__ 00:00:01.000 | 102 | 1012 |
542 NULL | NULL | NULL |
543 __tomorrow__ 00:00:00.000 | 103 | 1013 |
544 NULL | NULL | NULL |
545 __tomorrow__ 00:00:02.000 | 104 | 1014 |
546taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b full join a1 a on b.ts1 = a.ts and a.ts = b.ts;
547 ts1 | ts | f | g | 'a' |
548======================================================================================
549 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
550 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
551 NULL | NULL | NULL | NULL | NU. |
552 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
553 NULL | NULL | NULL | NULL | NU. |
554 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
555 NULL | NULL | NULL | NULL | NU. |
556taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b full join a1 a on b.ts1 = a.ts and a.ts = b.ts;
557 c |
558======
559 a |
560 a |
561 NU. |
562 a |
563 NU. |
564 a |
565 NU. |
566taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b full join a1 a on b.ts1 = a.ts and a.ts = b.ts;
567 ts |
568==========================
569 __today__ 00:00:00.000 |
570 __today__ 00:00:01.000 |
571 NULL |
572 __tomorrow__ 00:00:00.000 |
573 NULL |
574 __tomorrow__ 00:00:02.000 |
575 NULL |
576taos> select * from (select today as ts1, ts, f, g, 'a' from b1) b full join a1 a on b.ts = a.ts and a.ts = b.ts1;
577 ts1 | ts | f | g | 'a' | ts | f | g |
578============================================================================================================================================
579 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a | __today__ 00:00:00.000 | 101 | 1011 |
580 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a | NULL | NULL | NULL |
581 NULL | NULL | NULL | NULL | NU. | __today__ 00:00:01.000 | 102 | 1012 |
582 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a | NULL | NULL | NULL |
583 NULL | NULL | NULL | NULL | NU. | __tomorrow__ 00:00:00.000 | 103 | 1013 |
584 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a | NULL | NULL | NULL |
585 NULL | NULL | NULL | NULL | NU. | __tomorrow__ 00:00:02.000 | 104 | 1014 |
586taos> select a.* from (select today as ts1, ts, f, g, 'a' from b1) b full join a1 a on b.ts = a.ts and a.ts = b.ts1;
587 ts | f | g |
588======================================================
589 __today__ 00:00:00.000 | 101 | 1011 |
590 NULL | NULL | NULL |
591 __today__ 00:00:01.000 | 102 | 1012 |
592 NULL | NULL | NULL |
593 __tomorrow__ 00:00:00.000 | 103 | 1013 |
594 NULL | NULL | NULL |
595 __tomorrow__ 00:00:02.000 | 104 | 1014 |
596taos> select b.* from (select today as ts1, ts, f, g, 'a' from b1) b full join a1 a on b.ts = a.ts and a.ts = b.ts1;
597 ts1 | ts | f | g | 'a' |
598======================================================================================
599 __today__ 00:00:00.000 | __today__ 00:00:00.000 | 301 | 3011 | a |
600 __today__ 00:00:00.000 | __today__ 00:00:01.000 | 302 | 3012 | a |
601 NULL | NULL | NULL | NULL | NU. |
602 __today__ 00:00:00.000 | __tomorrow__ 00:00:00.000 | 303 | 3013 | a |
603 NULL | NULL | NULL | NULL | NU. |
604 __today__ 00:00:00.000 | __tomorrow__ 00:00:02.000 | 304 | 3014 | a |
605 NULL | NULL | NULL | NULL | NU. |
606taos> select b.c from (select today as ts1, ts, f, g, 'a' c from b1) b full join a1 a on b.ts = a.ts and a.ts = b.ts1;
607 c |
608======
609 a |
610 a |
611 NU. |
612 a |
613 NU. |
614 a |
615 NU. |
616taos> select b.ts from (select today as ts1, ts, f, g, 'a' c from b1) b full join a1 a on b.ts = a.ts and a.ts = b.ts1;
617 ts |
618==========================
619 __today__ 00:00:00.000 |
620 __today__ 00:00:01.000 |
621 NULL |
622 __tomorrow__ 00:00:00.000 |
623 NULL |
624 __tomorrow__ 00:00:02.000 |
625 NULL |
626taos> select * from (select today ts, last(f) val, tg1 from stb where tg1 >= 0 partition by tg1 order by ts) tb full join (select last(ts) as `ts`,last(f) as `val`,tg1 from sta where tg1=1 partition by tg1 order by ts) ta on ta.ts=tb.ts and ta.tg1=tb.tg1;
627 ts | val | tg1 | ts | val | tg1 |
628============================================================================================================
629 __today__ 00:00:00.000 | 404 | 1 | NULL | NULL | NULL |
630 NULL | NULL | NULL | __tomorrow__ 00:00:03.000 | 204 | 1 |
631taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 order by ts) tb full join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2;
632 ts | val | tg2 | ts | val | tg2 |
633============================================================================================================
634 __today__ 00:00:00.000 | 304 | 1 | NULL | NULL | NULL |
635 __today__ 00:00:00.000 | 404 | 2 | NULL | NULL | NULL |
636 NULL | NULL | NULL | __tomorrow__ 00:00:02.000 | 104 | 1 |
637 NULL | NULL | NULL | __tomorrow__ 00:00:03.000 | 204 | 2 |
638taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts) tb full join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 order by ta.val, tb.val;
639 ts | val | tg2 | ts | val | tg2 |
640============================================================================================================
641 __today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
642 __today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
643 __today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
644 __today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
645 NULL | NULL | NULL | __today__ 00:00:01.000 | 102 | 1 |
646 NULL | NULL | NULL | __tomorrow__ 00:00:00.000 | 103 | 1 |
647 NULL | NULL | NULL | __tomorrow__ 00:00:02.000 | 104 | 1 |
648 __today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
649 __today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
650 __today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
651 __today__ 00:00:00.000 | 404 | 2 | __today__ 00:00:00.000 | 201 | 2 |
652 NULL | NULL | NULL | __today__ 00:00:01.000 | 202 | 2 |
653 NULL | NULL | NULL | __tomorrow__ 00:00:00.000 | 203 | 2 |
654 NULL | NULL | NULL | __tomorrow__ 00:00:03.000 | 204 | 2 |
655taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb full join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts=today where tb.ts=today order by tb.val;
656 ts | val | tg2 | ts | val | tg2 |
657============================================================================================================
658 __today__ 00:00:00.000 | 301 | 1 | __today__ 00:00:00.000 | 101 | 1 |
659 __today__ 00:00:00.000 | 302 | 1 | __today__ 00:00:00.000 | 101 | 1 |
660 __today__ 00:00:00.000 | 303 | 1 | __today__ 00:00:00.000 | 101 | 1 |
661 __today__ 00:00:00.000 | 304 | 1 | __today__ 00:00:00.000 | 101 | 1 |
662 __today__ 00:00:00.000 | 401 | 2 | __today__ 00:00:00.000 | 201 | 2 |
663 __today__ 00:00:00.000 | 402 | 2 | __today__ 00:00:00.000 | 201 | 2 |
664 __today__ 00:00:00.000 | 403 | 2 | __today__ 00:00:00.000 | 201 | 2 |
665 __today__ 00:00:00.000 | 404 | 2 | __today__ 00:00:00.000 | 201 | 2 |
666taos> select * from (select today ts, last(f) val, tg2 from stb where tg2 >= 0 partition by tg2 interval(1s) order by ts desc) tb full join (select last(ts) as `ts`,last(f) as `val`,tg2 from sta where tg2>0 partition by tg2 interval(1s) order by ts) ta on ta.ts=tb.ts and ta.tg2=tb.tg2 and tb.ts>today where tb.ts>today;