2021-09-12 12:35:27 +00:00
|
|
|
-- Tags: distributed
|
|
|
|
|
2021-04-06 11:57:32 +00:00
|
|
|
-- { echo }
|
2023-10-27 10:36:28 +00:00
|
|
|
select row_number() over (order by dummy) as x from (select * from remote('127.0.0.{1,2}', system, one)) order by x;
|
2021-04-23 10:58:54 +00:00
|
|
|
|
2023-10-27 10:36:28 +00:00
|
|
|
select row_number() over (order by dummy) as x from remote('127.0.0.{1,2}', system, one) order by x;
|
2021-04-23 10:58:54 +00:00
|
|
|
|
2023-10-27 10:36:28 +00:00
|
|
|
select max(identity(dummy + 1)) over () as x from remote('127.0.0.{1,2}', system, one) order by x;
|
2021-04-23 10:58:54 +00:00
|
|
|
|
|
|
|
drop table if exists t_01568;
|
|
|
|
|
2021-05-27 16:05:49 +00:00
|
|
|
create table t_01568 engine Memory as
|
|
|
|
select intDiv(number, 3) p, modulo(number, 3) o, number
|
|
|
|
from numbers(9);
|
2021-04-23 10:58:54 +00:00
|
|
|
|
2023-10-27 10:36:28 +00:00
|
|
|
select sum(number) over w as x, max(number) over w as y from t_01568 window w as (partition by p) order by x, y;
|
2021-04-23 10:58:54 +00:00
|
|
|
|
2023-12-19 12:30:59 +00:00
|
|
|
select sum(number) over w, max(number) over w from t_01568 window w as (partition by p) order by p;
|
|
|
|
|
2023-10-27 10:36:28 +00:00
|
|
|
select sum(number) over w as x, max(number) over w as y from remote('127.0.0.{1,2}', '', t_01568) window w as (partition by p) order by x, y;
|
2021-04-23 10:58:54 +00:00
|
|
|
|
2023-12-19 12:30:59 +00:00
|
|
|
select sum(number) over w as x, max(number) over w as y from remote('127.0.0.{1,2}', '', t_01568) window w as (partition by p) order by x, y SETTINGS max_threads = 1;
|
|
|
|
|
2023-10-27 10:36:28 +00:00
|
|
|
select distinct sum(number) over w as x, max(number) over w as y from remote('127.0.0.{1,2}', '', t_01568) window w as (partition by p) order by x, y;
|
2021-04-23 10:58:54 +00:00
|
|
|
|
2021-04-23 15:21:34 +00:00
|
|
|
-- window functions + aggregation w/shards
|
2023-10-27 10:36:28 +00:00
|
|
|
select groupArray(groupArray(number)) over (rows unbounded preceding) as x from remote('127.0.0.{1,2}', '', t_01568) group by mod(number, 3) order by x;
|
|
|
|
select groupArray(groupArray(number)) over (rows unbounded preceding) as x from remote('127.0.0.{1,2}', '', t_01568) group by mod(number, 3) order by x settings distributed_group_by_no_merge=1;
|
2024-05-30 12:27:25 +00:00
|
|
|
select groupArray(groupArray(number)) over (rows unbounded preceding) as x from remote('127.0.0.{1,2}', '', t_01568) group by mod(number, 3) order by x settings distributed_group_by_no_merge=2; -- { serverError NOT_IMPLEMENTED }
|
2021-04-23 15:21:34 +00:00
|
|
|
|
2021-05-27 16:05:49 +00:00
|
|
|
-- proper ORDER BY w/window functions
|
|
|
|
select p, o, count() over (partition by p)
|
|
|
|
from remote('127.0.0.{1,2}', '', t_01568)
|
|
|
|
order by p, o;
|
|
|
|
|
2021-04-23 10:58:54 +00:00
|
|
|
drop table t_01568;
|