aboutsummaryrefslogtreecommitdiffstats
path: root/yql/essentials/tests/postgresql/cases/select_distinct.err
blob: 7bd5c15f0012866800f54d1c9c1dbfd258253cf7 (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
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
Registering pre-existing tables
	tenk1
	tmp
	emp
	student
	stud_emp
<sql-statement>
--
-- SELECT_DISTINCT
--
--
-- awk '{print $3;}' onek.data | sort -n | uniq
--
SELECT DISTINCT two FROM tmp ORDER BY 1;
</sql-statement>
<sql-statement>
--
-- awk '{print $5;}' onek.data | sort -n | uniq
--
SELECT DISTINCT ten FROM tmp ORDER BY 1;
</sql-statement>
<sql-statement>
--
-- awk '{print $16;}' onek.data | sort -d | uniq
--
SELECT DISTINCT string4 FROM tmp ORDER BY 1;
</sql-statement>
<sql-statement>
--
-- awk '{print $3,$16,$5;}' onek.data | sort -d | uniq |
-- sort +0n -1 +1d -2 +2n -3
--
SELECT DISTINCT two, string4, ten
   FROM tmp
   ORDER BY two using <, string4 using <, ten using <;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:7:23: Error: sortby_dir unsupported value: 3
    	   ORDER BY two using <, string4 using <, ten using <;
	                      ^
<sql-statement>
--
-- awk '{print $2;}' person.data |
-- awk '{if(NF!=1){print $2;}else{print;}}' - emp.data |
-- awk '{if(NF!=1){print $2;}else{print;}}' - student.data |
-- awk 'BEGIN{FS="      ";}{if(NF!=1){print $5;}else{print;}}' - stud_emp.data |
-- sort -n -r | uniq
--
SELECT DISTINCT p.age FROM person* p ORDER BY age using >;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:8:57: Error: sortby_dir unsupported value: 3
    	SELECT DISTINCT p.age FROM person* p ORDER BY age using >;
	                                                        ^
<sql-statement>
--
-- Check mentioning same column more than once
--
EXPLAIN (VERBOSE, COSTS OFF)
SELECT count(*) FROM
  (SELECT DISTINCT two, four, two FROM tenk1) ss;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:1: Error: RawStmt: alternative is not implemented yet : 276
    	--
	^
<sql-statement>
SELECT count(*) FROM
  (SELECT DISTINCT two, four, two FROM tenk1) ss;
</sql-statement>
-stdin-:<main>: Error: Type annotation

    -stdin-:<main>:1:1: Error: At function: RemovePrefixMembers, At function: PgSelect, At function: PgSetItem, At function: PgSelect, At function: PgSetItem
    	SELECT count(*) FROM
	^
        -stdin-:<main>:1:1: Error: Duplicated member: two
        	SELECT count(*) FROM
	^
<sql-statement>
--
-- Compare results between plans using sorting and plans using hash
-- aggregation. Force spilling in both cases by setting work_mem low.
--
SET work_mem='64kB';
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:1: Error: VariableSetStmt, not supported name: work_mem
    	--
	^
<sql-statement>
-- Produce results with sorting.
SET enable_hashagg=FALSE;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:1: Error: VariableSetStmt, not supported name: enable_hashagg
    	-- Produce results with sorting.
	^
<sql-statement>
SET jit_above_cost=0;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:1: Error: VariableSetStmt, not supported name: jit_above_cost
    	SET jit_above_cost=0;
	^
<sql-statement>
EXPLAIN (costs off)
SELECT DISTINCT g%1000 FROM generate_series(0,9999) g;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:1: Error: RawStmt: alternative is not implemented yet : 276
    	EXPLAIN (costs off)
	^
<sql-statement>
CREATE TABLE distinct_group_1 AS
SELECT DISTINCT g%1000 FROM generate_series(0,9999) g;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:1: Error: RawStmt: alternative is not implemented yet : 277
    	CREATE TABLE distinct_group_1 AS
	^
<sql-statement>
SET jit_above_cost TO DEFAULT;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:1: Error: VariableSetStmt, not supported kind: 1
    	SET jit_above_cost TO DEFAULT;
	^
<sql-statement>
CREATE TABLE distinct_group_2 AS
SELECT DISTINCT (g%1000)::text FROM generate_series(0,9999) g;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:1: Error: RawStmt: alternative is not implemented yet : 277
    	CREATE TABLE distinct_group_2 AS
	^
<sql-statement>
SET enable_hashagg=TRUE;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:1: Error: VariableSetStmt, not supported name: enable_hashagg
    	SET enable_hashagg=TRUE;
	^
<sql-statement>
-- Produce results with hash aggregation.
SET enable_sort=FALSE;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:1: Error: VariableSetStmt, not supported name: enable_sort
    	-- Produce results with hash aggregation.
	^
<sql-statement>
SET jit_above_cost=0;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:1: Error: VariableSetStmt, not supported name: jit_above_cost
    	SET jit_above_cost=0;
	^
<sql-statement>
EXPLAIN (costs off)
SELECT DISTINCT g%1000 FROM generate_series(0,9999) g;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:1: Error: RawStmt: alternative is not implemented yet : 276
    	EXPLAIN (costs off)
	^
<sql-statement>
CREATE TABLE distinct_hash_1 AS
SELECT DISTINCT g%1000 FROM generate_series(0,9999) g;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:1: Error: RawStmt: alternative is not implemented yet : 277
    	CREATE TABLE distinct_hash_1 AS
	^
<sql-statement>
SET jit_above_cost TO DEFAULT;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:1: Error: VariableSetStmt, not supported kind: 1
    	SET jit_above_cost TO DEFAULT;
	^
<sql-statement>
CREATE TABLE distinct_hash_2 AS
SELECT DISTINCT (g%1000)::text FROM generate_series(0,9999) g;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:1: Error: RawStmt: alternative is not implemented yet : 277
    	CREATE TABLE distinct_hash_2 AS
	^
<sql-statement>
SET enable_sort=TRUE;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:1: Error: VariableSetStmt, not supported name: enable_sort
    	SET enable_sort=TRUE;
	^
<sql-statement>
SET work_mem TO DEFAULT;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:1: Error: VariableSetStmt, not supported kind: 1
    	SET work_mem TO DEFAULT;
	^
<sql-statement>
-- Compare results
(SELECT * FROM distinct_hash_1 EXCEPT SELECT * FROM distinct_group_1)
  UNION ALL
(SELECT * FROM distinct_group_1 EXCEPT SELECT * FROM distinct_hash_1);
</sql-statement>
-stdin-:<main>: Fatal: Table metadata loading

    -stdin-:<main>: Fatal: ydb/library/yql/providers/yt/gateway/file/yql_yt_file_services.cpp:44: Table not found: plato.distinct_group_1
    
<sql-statement>
(SELECT * FROM distinct_hash_1 EXCEPT SELECT * FROM distinct_group_1)
  UNION ALL
(SELECT * FROM distinct_group_1 EXCEPT SELECT * FROM distinct_hash_1);
</sql-statement>
-stdin-:<main>: Fatal: Table metadata loading

    -stdin-:<main>: Fatal: ydb/library/yql/providers/yt/gateway/file/yql_yt_file_services.cpp:44: Table not found: plato.distinct_group_1
    
<sql-statement>
DROP TABLE distinct_hash_1;
</sql-statement>
<sql-statement>
DROP TABLE distinct_hash_2;
</sql-statement>
<sql-statement>
DROP TABLE distinct_group_1;
</sql-statement>
<sql-statement>
DROP TABLE distinct_group_2;
</sql-statement>
<sql-statement>
--
-- Also, some tests of IS DISTINCT FROM, which doesn't quite deserve its
-- very own regression file.
--
CREATE TEMP TABLE disttable (f1 integer);
</sql-statement>
<sql-statement>
INSERT INTO DISTTABLE VALUES(1);
</sql-statement>
-stdin-:<main>: Fatal: Table metadata loading

    -stdin-:<main>: Fatal: ydb/library/yql/providers/yt/gateway/file/yql_yt_file_services.cpp:44: Table not found: plato.DISTTABLE
    
<sql-statement>
INSERT INTO DISTTABLE VALUES(2);
</sql-statement>
-stdin-:<main>: Fatal: Table metadata loading

    -stdin-:<main>: Fatal: ydb/library/yql/providers/yt/gateway/file/yql_yt_file_services.cpp:44: Table not found: plato.DISTTABLE
    
<sql-statement>
INSERT INTO DISTTABLE VALUES(3);
</sql-statement>
-stdin-:<main>: Fatal: Table metadata loading

    -stdin-:<main>: Fatal: ydb/library/yql/providers/yt/gateway/file/yql_yt_file_services.cpp:44: Table not found: plato.DISTTABLE
    
<sql-statement>
INSERT INTO DISTTABLE VALUES(NULL);
</sql-statement>
-stdin-:<main>: Fatal: Table metadata loading

    -stdin-:<main>: Fatal: ydb/library/yql/providers/yt/gateway/file/yql_yt_file_services.cpp:44: Table not found: plato.DISTTABLE
    
<sql-statement>
-- basic cases
SELECT f1, f1 IS DISTINCT FROM 2 as "not 2" FROM disttable;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:2:15: Error: A_Expr_Kind unsupported value: 3
    	SELECT f1, f1 IS DISTINCT FROM 2 as "not 2" FROM disttable;
	              ^
<sql-statement>
SELECT f1, f1 IS DISTINCT FROM NULL as "not null" FROM disttable;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:15: Error: A_Expr_Kind unsupported value: 3
    	SELECT f1, f1 IS DISTINCT FROM NULL as "not null" FROM disttable;
	              ^
<sql-statement>
SELECT f1, f1 IS DISTINCT FROM f1 as "false" FROM disttable;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:15: Error: A_Expr_Kind unsupported value: 3
    	SELECT f1, f1 IS DISTINCT FROM f1 as "false" FROM disttable;
	              ^
<sql-statement>
SELECT f1, f1 IS DISTINCT FROM f1+1 as "not null" FROM disttable;
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:15: Error: A_Expr_Kind unsupported value: 3
    	SELECT f1, f1 IS DISTINCT FROM f1+1 as "not null" FROM disttable;
	              ^
<sql-statement>
-- check that optimizer constant-folds it properly
SELECT 1 IS DISTINCT FROM 2 as "yes";
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:2:10: Error: A_Expr_Kind unsupported value: 3
    	SELECT 1 IS DISTINCT FROM 2 as "yes";
	         ^
<sql-statement>
SELECT 2 IS DISTINCT FROM 2 as "no";
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:10: Error: A_Expr_Kind unsupported value: 3
    	SELECT 2 IS DISTINCT FROM 2 as "no";
	         ^
<sql-statement>
SELECT 2 IS DISTINCT FROM null as "yes";
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:10: Error: A_Expr_Kind unsupported value: 3
    	SELECT 2 IS DISTINCT FROM null as "yes";
	         ^
<sql-statement>
SELECT null IS DISTINCT FROM null as "no";
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:13: Error: A_Expr_Kind unsupported value: 3
    	SELECT null IS DISTINCT FROM null as "no";
	            ^
<sql-statement>
-- negated form
SELECT 1 IS NOT DISTINCT FROM 2 as "no";
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:2:10: Error: A_Expr_Kind unsupported value: 4
    	SELECT 1 IS NOT DISTINCT FROM 2 as "no";
	         ^
<sql-statement>
SELECT 2 IS NOT DISTINCT FROM 2 as "yes";
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:10: Error: A_Expr_Kind unsupported value: 4
    	SELECT 2 IS NOT DISTINCT FROM 2 as "yes";
	         ^
<sql-statement>
SELECT 2 IS NOT DISTINCT FROM null as "no";
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:10: Error: A_Expr_Kind unsupported value: 4
    	SELECT 2 IS NOT DISTINCT FROM null as "no";
	         ^
<sql-statement>
SELECT null IS NOT DISTINCT FROM null as "yes";
</sql-statement>
-stdin-:<main>: Error: Parse Sql

    -stdin-:<main>:1:13: Error: A_Expr_Kind unsupported value: 4
    	SELECT null IS NOT DISTINCT FROM null as "yes";
	            ^