1
1
CREATE EXTENSION clickhouse_fdw;
2
- CREATE EXTENSION istore;
3
2
CREATE SERVER loopback FOREIGN DATA WRAPPER clickhouse_fdw OPTIONS(dbname 'regression');
4
3
CREATE USER MAPPING FOR CURRENT_USER SERVER loopback;
5
4
SELECT clickhousedb_raw_query('drop database if exists regression');
@@ -223,104 +222,6 @@ SELECT a, sum(b) FROM t2 GROUP BY a ORDER BY a;
223
222
9 | 540
224
223
(10 rows)
225
224
226
- /* istore tests */
227
- ALTER TABLE t3_aggr ALTER COLUMN b SET DATA TYPE istore;
228
- SELECT sum(b) FROM t3_aggr;
229
- sum
230
- ----------------------------------------------------------------------------------------------------------------
231
- "1"=>"110", "2"=>"10", "3"=>"10", "4"=>"10", "5"=>"10", "6"=>"10", "7"=>"10", "8"=>"10", "9"=>"10", "10"=>"10"
232
- (1 row)
233
-
234
- EXPLAIN (VERBOSE, COSTS OFF) SELECT sum(b) FROM t3_aggr;
235
- QUERY PLAN
236
- -------------------------------------------------------------
237
- Foreign Scan
238
- Output: (sum(b))
239
- Relations: Aggregate on (t3_aggr)
240
- Remote SQL: SELECT sumMapMerge(b) FROM regression.t3_aggr
241
- (4 rows)
242
-
243
- EXPLAIN (VERBOSE, COSTS OFF) SELECT a, sum(accumulate(b)) FROM t3_aggr GROUP BY a;
244
- QUERY PLAN
245
- -------------------------------------------------------------------------------------------------------------------------------------------------------------
246
- Foreign Scan
247
- Output: a, (sum(accumulate(b)))
248
- Relations: Aggregate on (t3_aggr)
249
- Remote SQL: SELECT a, sumMap((mapFill((finalizeAggregation(b) as _tmp1).1, _tmp1.2) as _tmp3).1, arrayCumSum(_tmp3.2)) FROM regression.t3_aggr GROUP BY a
250
- (4 rows)
251
-
252
- EXPLAIN (VERBOSE, COSTS OFF) SELECT a, sum(sum_up(b)) FROM t3_aggr GROUP BY a;
253
- QUERY PLAN
254
- ---------------------------------------------------------------------------------------------------------------
255
- Foreign Scan
256
- Output: a, (sum(sum_up(b)))
257
- Relations: Aggregate on (t3_aggr)
258
- Remote SQL: SELECT a, sum(arraySum((finalizeAggregation(b) as _tmp1).2)) FROM regression.t3_aggr GROUP BY a
259
- (4 rows)
260
-
261
- SELECT a, sum(sum_up(b)) FROM t3_aggr GROUP BY a;
262
- a | sum
263
- ---+-----
264
- 0 | 20
265
- 4 | 20
266
- 3 | 20
267
- 2 | 20
268
- 5 | 20
269
- 1 | 20
270
- 6 | 20
271
- 7 | 20
272
- 9 | 20
273
- 8 | 20
274
- (10 rows)
275
-
276
- EXPLAIN (VERBOSE, COSTS OFF) SELECT a, sum(sum_up(b, 5)) FROM t3_aggr GROUP BY a;
277
- QUERY PLAN
278
- --------------------------------------------------------------------------------------------------------------------------------------------------------
279
- Foreign Scan
280
- Output: a, (sum(sum_up(b, 5)))
281
- Relations: Aggregate on (t3_aggr)
282
- Remote SQL: SELECT a, sum(arraySum(arrayFilter((v, k) -> k <= (5),(finalizeAggregation(b) as _tmp1).2, _tmp1.1))) FROM regression.t3_aggr GROUP BY a
283
- (4 rows)
284
-
285
- SELECT a, sum(sum_up(b, 5)) FROM t3_aggr GROUP BY a;
286
- a | sum
287
- ---+-----
288
- 0 | 20
289
- 4 | 20
290
- 3 | 20
291
- 2 | 20
292
- 5 | 10
293
- 1 | 20
294
- 6 | 10
295
- 7 | 10
296
- 9 | 10
297
- 8 | 10
298
- (10 rows)
299
-
300
- EXPLAIN (VERBOSE, COSTS OFF) SELECT a, sum(b->1) FROM t3_aggr GROUP BY a;
301
- QUERY PLAN
302
- ---------------------------------------------------------------------------------------------------------------------------------------
303
- Foreign Scan
304
- Output: a, (sum((b -> 1)))
305
- Relations: Aggregate on (t3_aggr)
306
- Remote SQL: SELECT a, sum(((finalizeAggregation(b) as _tmp1).2)[nullif(indexOf(_tmp1.1, 1), 0)]) FROM regression.t3_aggr GROUP BY a
307
- (4 rows)
308
-
309
- SELECT a, sum(b->1) FROM t3_aggr GROUP BY a;
310
- a | sum
311
- ---+-----
312
- 0 | 20
313
- 4 | 10
314
- 3 | 10
315
- 2 | 10
316
- 5 | 10
317
- 1 | 10
318
- 6 | 10
319
- 7 | 10
320
- 9 | 10
321
- 8 | 10
322
- (10 rows)
323
-
324
225
DROP USER MAPPING FOR CURRENT_USER SERVER loopback;
325
226
SELECT clickhousedb_raw_query('DROP DATABASE regression');
326
227
clickhousedb_raw_query
@@ -337,4 +238,3 @@ drop cascades to foreign table t2
337
238
drop cascades to foreign table t3
338
239
drop cascades to foreign table t3_aggr
339
240
drop cascades to foreign table t4
340
- DROP EXTENSION IF EXISTS istore CASCADE;
0 commit comments