aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/sql/suites/blocks/date_sub_scalar.sql
blob: efe5c86006b9bc2a07b2555f9e34c1a76090d93b (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
USE plato;
pragma yt.DisableOptimizers="OutHorizontalJoin,HorizontalJoin,MultiHorizontalJoin,FuseMultiOutsWithOuterMaps";

SELECT
    Date("2000-01-01") - na,
    Date("2000-01-01") - naz,
    Date("2000-01-01") - nd,
    Date("2000-01-01") - ndz,
    Date("2000-01-01") - nt,
    Date("2000-01-01") - ntz,
    Date("2000-01-01") - wa,
    Date("2000-01-01") - wd,
    Date("2000-01-01") - wt,
    Date("2000-01-01") - waz,
    Date("2000-01-01") - wdz,
    Date("2000-01-01") - wtz,

    TzDate("2000-01-01,Europe/Moscow") - na,
    TzDate("2000-01-01,Europe/Moscow") - naz,
    TzDate("2000-01-01,Europe/Moscow") - nd,
    TzDate("2000-01-01,Europe/Moscow") - ndz,
    TzDate("2000-01-01,Europe/Moscow") - nt,
    TzDate("2000-01-01,Europe/Moscow") - ntz,
    TzDate("2000-01-01,Europe/Moscow") - wa,
    TzDate("2000-01-01,Europe/Moscow") - wd,
    TzDate("2000-01-01,Europe/Moscow") - wt,
    TzDate("2000-01-01,Europe/Moscow") - waz,
    TzDate("2000-01-01,Europe/Moscow") - wdz,
    TzDate("2000-01-01,Europe/Moscow") - wtz,

    Datetime("2000-01-01T03:04:05Z") - na,
    Datetime("2000-01-01T03:04:05Z") - naz,
    Datetime("2000-01-01T03:04:05Z") - nd,
    Datetime("2000-01-01T03:04:05Z") - ndz,
    Datetime("2000-01-01T03:04:05Z") - nt,
    Datetime("2000-01-01T03:04:05Z") - ntz,
    Datetime("2000-01-01T03:04:05Z") - wa,
    Datetime("2000-01-01T03:04:05Z") - wd,
    Datetime("2000-01-01T03:04:05Z") - wt,
    Datetime("2000-01-01T03:04:05Z") - waz,
    Datetime("2000-01-01T03:04:05Z") - wdz,
    Datetime("2000-01-01T03:04:05Z") - wtz,

    TzDatetime("2000-01-01T03:04:05,Europe/Moscow") - na,
    TzDatetime("2000-01-01T03:04:05,Europe/Moscow") - naz,
    TzDatetime("2000-01-01T03:04:05,Europe/Moscow") - nd,
    TzDatetime("2000-01-01T03:04:05,Europe/Moscow") - ndz,
    TzDatetime("2000-01-01T03:04:05,Europe/Moscow") - nt,
    TzDatetime("2000-01-01T03:04:05,Europe/Moscow") - ntz,
    TzDatetime("2000-01-01T03:04:05,Europe/Moscow") - wa,
    TzDatetime("2000-01-01T03:04:05,Europe/Moscow") - wd,
    TzDatetime("2000-01-01T03:04:05,Europe/Moscow") - wt,
    TzDatetime("2000-01-01T03:04:05,Europe/Moscow") - waz,
    TzDatetime("2000-01-01T03:04:05,Europe/Moscow") - wdz,
    TzDatetime("2000-01-01T03:04:05,Europe/Moscow") - wtz,

    Timestamp("2000-01-01T03:04:05.678912Z") - na,
    Timestamp("2000-01-01T03:04:05.678912Z") - naz,
    Timestamp("2000-01-01T03:04:05.678912Z") - nd,
    Timestamp("2000-01-01T03:04:05.678912Z") - ndz,
    Timestamp("2000-01-01T03:04:05.678912Z") - nt,
    Timestamp("2000-01-01T03:04:05.678912Z") - ntz,
    Timestamp("2000-01-01T03:04:05.678912Z") - wa,
    Timestamp("2000-01-01T03:04:05.678912Z") - wd,
    Timestamp("2000-01-01T03:04:05.678912Z") - wt,
    Timestamp("2000-01-01T03:04:05.678912Z") - waz,
    Timestamp("2000-01-01T03:04:05.678912Z") - wdz,
    Timestamp("2000-01-01T03:04:05.678912Z") - wtz,

    TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow") - na,
    TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow") - naz,
    TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow") - nd,
    TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow") - ndz,
    TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow") - nt,
    TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow") - ntz,
    TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow") - wa,
    TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow") - wd,
    TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow") - wt,
    TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow") - waz,
    TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow") - wdz,
    TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow") - wtz,

FROM Dates;

SELECT
    Date32("1900-01-01") - na,
    Date32("1900-01-01") - naz,
    Date32("1900-01-01") - nd,
    Date32("1900-01-01") - ndz,
    Date32("1900-01-01") - nt,
    Date32("1900-01-01") - ntz,
    Date32("1900-01-01") - wa,
    Date32("1900-01-01") - wd,
    Date32("1900-01-01") - wt,
    Date32("1900-01-01") - waz,
    Date32("1900-01-01") - wdz,
    Date32("1900-01-01") - wtz,

    Datetime64("1900-01-01T03:04:05Z") - na,
    Datetime64("1900-01-01T03:04:05Z") - naz,
    Datetime64("1900-01-01T03:04:05Z") - nd,
    Datetime64("1900-01-01T03:04:05Z") - ndz,
    Datetime64("1900-01-01T03:04:05Z") - nt,
    Datetime64("1900-01-01T03:04:05Z") - ntz,
    Datetime64("1900-01-01T03:04:05Z") - wa,
    Datetime64("1900-01-01T03:04:05Z") - wd,
    Datetime64("1900-01-01T03:04:05Z") - wt,
    Datetime64("1900-01-01T03:04:05Z") - waz,
    Datetime64("1900-01-01T03:04:05Z") - wdz,
    Datetime64("1900-01-01T03:04:05Z") - wtz,

    Timestamp64("1900-01-01T03:04:05.678912Z") - na,
    Timestamp64("1900-01-01T03:04:05.678912Z") - naz,
    Timestamp64("1900-01-01T03:04:05.678912Z") - nd,
    Timestamp64("1900-01-01T03:04:05.678912Z") - ndz,
    Timestamp64("1900-01-01T03:04:05.678912Z") - nt,
    Timestamp64("1900-01-01T03:04:05.678912Z") - ntz,
    Timestamp64("1900-01-01T03:04:05.678912Z") - wa,
    Timestamp64("1900-01-01T03:04:05.678912Z") - wd,
    Timestamp64("1900-01-01T03:04:05.678912Z") - wt,
    Timestamp64("1900-01-01T03:04:05.678912Z") - waz,
    Timestamp64("1900-01-01T03:04:05.678912Z") - wdz,
    Timestamp64("1900-01-01T03:04:05.678912Z") - wtz,

    TzDate32("1900-01-01,Europe/Moscow") - na,
    TzDate32("1900-01-01,Europe/Moscow") - naz,
    TzDate32("1900-01-01,Europe/Moscow") - nd,
    TzDate32("1900-01-01,Europe/Moscow") - ndz,
    TzDate32("1900-01-01,Europe/Moscow") - nt,
    TzDate32("1900-01-01,Europe/Moscow") - ntz,
    TzDate32("1900-01-01,Europe/Moscow") - wa,
    TzDate32("1900-01-01,Europe/Moscow") - wd,
    TzDate32("1900-01-01,Europe/Moscow") - wt,
    TzDate32("1900-01-01,Europe/Moscow") - waz,
    TzDate32("1900-01-01,Europe/Moscow") - wdz,
    TzDate32("1900-01-01,Europe/Moscow") - wtz,

    TzDatetime64("1900-01-01T03:04:05,Europe/Moscow") - na,
    TzDatetime64("1900-01-01T03:04:05,Europe/Moscow") - naz,
    TzDatetime64("1900-01-01T03:04:05,Europe/Moscow") - nd,
    TzDatetime64("1900-01-01T03:04:05,Europe/Moscow") - ndz,
    TzDatetime64("1900-01-01T03:04:05,Europe/Moscow") - nt,
    TzDatetime64("1900-01-01T03:04:05,Europe/Moscow") - ntz,
    TzDatetime64("1900-01-01T03:04:05,Europe/Moscow") - wa,
    TzDatetime64("1900-01-01T03:04:05,Europe/Moscow") - wd,
    TzDatetime64("1900-01-01T03:04:05,Europe/Moscow") - wt,
    TzDatetime64("1900-01-01T03:04:05,Europe/Moscow") - waz,
    TzDatetime64("1900-01-01T03:04:05,Europe/Moscow") - wdz,
    TzDatetime64("1900-01-01T03:04:05,Europe/Moscow") - wtz,

    TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow") - na,
    TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow") - naz,
    TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow") - nd,
    TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow") - ndz,
    TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow") - nt,
    TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow") - ntz,
    TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow") - wa,
    TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow") - wd,
    TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow") - wt,
    TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow") - waz,
    TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow") - wdz,
    TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow") - wtz

FROM Dates;

SELECT
    na - Date("2000-01-01"),
    naz - Date("2000-01-01"),
    nd - Date("2000-01-01"),
    ndz - Date("2000-01-01"),
    nt - Date("2000-01-01"),
    ntz - Date("2000-01-01"),
    wa - Date("2000-01-01"),
    wd - Date("2000-01-01"),
    wt - Date("2000-01-01"),
    waz - Date("2000-01-01"),
    wdz - Date("2000-01-01"),
    wtz - Date("2000-01-01"),

    na - TzDate("2000-01-01,Europe/Moscow"),
    naz - TzDate("2000-01-01,Europe/Moscow"),
    nd - TzDate("2000-01-01,Europe/Moscow"),
    ndz - TzDate("2000-01-01,Europe/Moscow"),
    nt - TzDate("2000-01-01,Europe/Moscow"),
    ntz - TzDate("2000-01-01,Europe/Moscow"),
    wa - TzDate("2000-01-01,Europe/Moscow"),
    wd - TzDate("2000-01-01,Europe/Moscow"),
    wt - TzDate("2000-01-01,Europe/Moscow"),
    waz - TzDate("2000-01-01,Europe/Moscow"),
    wdz - TzDate("2000-01-01,Europe/Moscow"),
    wtz - TzDate("2000-01-01,Europe/Moscow"),

    na - Datetime("2000-01-01T03:04:05Z"),
    naz - Datetime("2000-01-01T03:04:05Z"),
    nd - Datetime("2000-01-01T03:04:05Z"),
    ndz - Datetime("2000-01-01T03:04:05Z"),
    nt - Datetime("2000-01-01T03:04:05Z"),
    ntz - Datetime("2000-01-01T03:04:05Z"),
    wa - Datetime("2000-01-01T03:04:05Z"),
    wd - Datetime("2000-01-01T03:04:05Z"),
    wt - Datetime("2000-01-01T03:04:05Z"),
    waz - Datetime("2000-01-01T03:04:05Z"),
    wdz - Datetime("2000-01-01T03:04:05Z"),
    wtz - Datetime("2000-01-01T03:04:05Z"),

    na - TzDatetime("2000-01-01T03:04:05,Europe/Moscow"),
    naz - TzDatetime("2000-01-01T03:04:05,Europe/Moscow"),
    nd - TzDatetime("2000-01-01T03:04:05,Europe/Moscow"),
    ndz - TzDatetime("2000-01-01T03:04:05,Europe/Moscow"),
    nt - TzDatetime("2000-01-01T03:04:05,Europe/Moscow"),
    ntz - TzDatetime("2000-01-01T03:04:05,Europe/Moscow"),
    wa - TzDatetime("2000-01-01T03:04:05,Europe/Moscow"),
    wd - TzDatetime("2000-01-01T03:04:05,Europe/Moscow"),
    wt - TzDatetime("2000-01-01T03:04:05,Europe/Moscow"),
    waz - TzDatetime("2000-01-01T03:04:05,Europe/Moscow"),
    wdz - TzDatetime("2000-01-01T03:04:05,Europe/Moscow"),
    wtz - TzDatetime("2000-01-01T03:04:05,Europe/Moscow"),

    na - Timestamp("2000-01-01T03:04:05.678912Z"),
    naz - Timestamp("2000-01-01T03:04:05.678912Z"),
    nd - Timestamp("2000-01-01T03:04:05.678912Z"),
    ndz - Timestamp("2000-01-01T03:04:05.678912Z"),
    nt - Timestamp("2000-01-01T03:04:05.678912Z"),
    ntz - Timestamp("2000-01-01T03:04:05.678912Z"),
    wa - Timestamp("2000-01-01T03:04:05.678912Z"),
    wd - Timestamp("2000-01-01T03:04:05.678912Z"),
    wt - Timestamp("2000-01-01T03:04:05.678912Z"),
    waz - Timestamp("2000-01-01T03:04:05.678912Z"),
    wdz - Timestamp("2000-01-01T03:04:05.678912Z"),
    wtz - Timestamp("2000-01-01T03:04:05.678912Z"),

    na - TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow"),
    naz - TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow"),
    nd - TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow"),
    ndz - TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow"),
    nt - TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow"),
    ntz - TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow"),
    wa - TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow"),
    wd - TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow"),
    wt - TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow"),
    waz - TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow"),
    wdz - TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow"),
    wtz - TzTimestamp("2000-01-01T03:04:05.678912,Europe/Moscow"),
FROM Dates;

SELECT
    na - Date32("1900-01-01"),
    naz - Date32("1900-01-01"),
    nd - Date32("1900-01-01"),
    ndz - Date32("1900-01-01"),
    nt - Date32("1900-01-01"),
    ntz - Date32("1900-01-01"),
    wa - Date32("1900-01-01"),
    wd - Date32("1900-01-01"),
    wt - Date32("1900-01-01"),
    waz - Date32("1900-01-01"),
    wdz - Date32("1900-01-01"),
    wtz - Date32("1900-01-01"),

    na - Datetime64("1900-01-01T03:04:05Z"),
    naz - Datetime64("1900-01-01T03:04:05Z"),
    nd - Datetime64("1900-01-01T03:04:05Z"),
    ndz - Datetime64("1900-01-01T03:04:05Z"),
    nt - Datetime64("1900-01-01T03:04:05Z"),
    ntz - Datetime64("1900-01-01T03:04:05Z"),
    wa - Datetime64("1900-01-01T03:04:05Z"),
    wd - Datetime64("1900-01-01T03:04:05Z"),
    wt - Datetime64("1900-01-01T03:04:05Z"),
    waz - Datetime64("1900-01-01T03:04:05Z"),
    wdz - Datetime64("1900-01-01T03:04:05Z"),
    wtz - Datetime64("1900-01-01T03:04:05Z"),

    na - Timestamp64("1900-01-01T03:04:05.678912Z"),
    naz - Timestamp64("1900-01-01T03:04:05.678912Z"),
    nd - Timestamp64("1900-01-01T03:04:05.678912Z"),
    ndz - Timestamp64("1900-01-01T03:04:05.678912Z"),
    nt - Timestamp64("1900-01-01T03:04:05.678912Z"),
    ntz - Timestamp64("1900-01-01T03:04:05.678912Z"),
    wa - Timestamp64("1900-01-01T03:04:05.678912Z"),
    wd - Timestamp64("1900-01-01T03:04:05.678912Z"),
    wt - Timestamp64("1900-01-01T03:04:05.678912Z"),
    waz - Timestamp64("1900-01-01T03:04:05.678912Z"),
    wdz - Timestamp64("1900-01-01T03:04:05.678912Z"),
    wtz - Timestamp64("1900-01-01T03:04:05.678912Z"),

    na - TzDate32("1900-01-01,Europe/Moscow"),
    naz - TzDate32("1900-01-01,Europe/Moscow"),
    nd - TzDate32("1900-01-01,Europe/Moscow"),
    ndz - TzDate32("1900-01-01,Europe/Moscow"),
    nt - TzDate32("1900-01-01,Europe/Moscow"),
    ntz - TzDate32("1900-01-01,Europe/Moscow"),
    wa - TzDate32("1900-01-01,Europe/Moscow"),
    wd - TzDate32("1900-01-01,Europe/Moscow"),
    wt - TzDate32("1900-01-01,Europe/Moscow"),
    waz - TzDate32("1900-01-01,Europe/Moscow"),
    wdz - TzDate32("1900-01-01,Europe/Moscow"),
    wtz - TzDate32("1900-01-01,Europe/Moscow"),

    na - TzDatetime64("1900-01-01T03:04:05,Europe/Moscow"),
    naz - TzDatetime64("1900-01-01T03:04:05,Europe/Moscow"),
    nd - TzDatetime64("1900-01-01T03:04:05,Europe/Moscow"),
    ndz - TzDatetime64("1900-01-01T03:04:05,Europe/Moscow"),
    nt - TzDatetime64("1900-01-01T03:04:05,Europe/Moscow"),
    ntz - TzDatetime64("1900-01-01T03:04:05,Europe/Moscow"),
    wa - TzDatetime64("1900-01-01T03:04:05,Europe/Moscow"),
    wd - TzDatetime64("1900-01-01T03:04:05,Europe/Moscow"),
    wt - TzDatetime64("1900-01-01T03:04:05,Europe/Moscow"),
    waz - TzDatetime64("1900-01-01T03:04:05,Europe/Moscow"),
    wdz - TzDatetime64("1900-01-01T03:04:05,Europe/Moscow"),
    wtz - TzDatetime64("1900-01-01T03:04:05,Europe/Moscow"),

    na - TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow"),
    naz - TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow"),
    nd - TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow"),
    ndz - TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow"),
    nt - TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow"),
    ntz - TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow"),
    wa - TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow"),
    wd - TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow"),
    wt - TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow"),
    waz - TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow"),
    wdz - TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow"),
    wtz - TzTimestamp64("1900-01-01T03:04:05.678912,Europe/Moscow")

FROM Dates;