Skip to content

Commit d46ff55

Browse files
committed
Support window functions
1 parent 1871a62 commit d46ff55

File tree

6 files changed

+1613
-479
lines changed

6 files changed

+1613
-479
lines changed

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ OBJS = vops.o
66
EXTENSION = vops
77
DATA = vops--1.0.sql
88
PGFILEDESC = "vops - vectorized operations"
9-
CUSTOM_COPT = -O3
9+
CUSTOM_COPT = -O0 -g
1010

1111
REGRESS = test
1212

expected/test.out

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,79 @@ select count(*) from v where ifnull(x, 0) >= 0;
6464
64
6565
(1 row)
6666

67+
select count(*) from v where coalesce(x, 0.0::float8::vops_float4) >= 0;
68+
count
69+
-------
70+
64
71+
(1 row)
72+
73+
select unnest(t.*) from (select mcount(*) over w,mcount(x) over w,msum(x) over w,mavg(x) over w,mmin(x) over w,mmax(x) over w,x - lag(x) over w from v window w as (rows between unbounded preceding and current row)) t;
74+
unnest
75+
--------------------
76+
(1,1,1,1,1,1,)
77+
(2,2,3,1.5,1,2,1)
78+
(3,2,3,1.5,1,2,)
79+
(4,3,6,2,1,3,)
80+
(5,3,6,2,1,3,)
81+
(6,4,10,2.5,1,4,)
82+
(7,4,10,2.5,1,4,)
83+
(8,4,10,2.5,1,4,)
84+
(9,4,10,2.5,1,4,)
85+
(10,4,10,2.5,1,4,)
86+
(11,4,10,2.5,1,4,)
87+
(12,4,10,2.5,1,4,)
88+
(13,4,10,2.5,1,4,)
89+
(14,4,10,2.5,1,4,)
90+
(15,4,10,2.5,1,4,)
91+
(16,4,10,2.5,1,4,)
92+
(17,4,10,2.5,1,4,)
93+
(18,4,10,2.5,1,4,)
94+
(19,4,10,2.5,1,4,)
95+
(20,4,10,2.5,1,4,)
96+
(21,4,10,2.5,1,4,)
97+
(22,4,10,2.5,1,4,)
98+
(23,4,10,2.5,1,4,)
99+
(24,4,10,2.5,1,4,)
100+
(25,4,10,2.5,1,4,)
101+
(26,4,10,2.5,1,4,)
102+
(27,4,10,2.5,1,4,)
103+
(28,4,10,2.5,1,4,)
104+
(29,4,10,2.5,1,4,)
105+
(30,4,10,2.5,1,4,)
106+
(31,4,10,2.5,1,4,)
107+
(32,4,10,2.5,1,4,)
108+
(33,4,10,2.5,1,4,)
109+
(34,4,10,2.5,1,4,)
110+
(35,4,10,2.5,1,4,)
111+
(36,4,10,2.5,1,4,)
112+
(37,4,10,2.5,1,4,)
113+
(38,4,10,2.5,1,4,)
114+
(39,4,10,2.5,1,4,)
115+
(40,4,10,2.5,1,4,)
116+
(41,4,10,2.5,1,4,)
117+
(42,4,10,2.5,1,4,)
118+
(43,4,10,2.5,1,4,)
119+
(44,4,10,2.5,1,4,)
120+
(45,4,10,2.5,1,4,)
121+
(46,4,10,2.5,1,4,)
122+
(47,4,10,2.5,1,4,)
123+
(48,4,10,2.5,1,4,)
124+
(49,4,10,2.5,1,4,)
125+
(50,4,10,2.5,1,4,)
126+
(51,4,10,2.5,1,4,)
127+
(52,4,10,2.5,1,4,)
128+
(53,4,10,2.5,1,4,)
129+
(54,4,10,2.5,1,4,)
130+
(55,4,10,2.5,1,4,)
131+
(56,4,10,2.5,1,4,)
132+
(57,4,10,2.5,1,4,)
133+
(58,4,10,2.5,1,4,)
134+
(59,4,10,2.5,1,4,)
135+
(60,4,10,2.5,1,4,)
136+
(61,4,10,2.5,1,4,)
137+
(62,4,10,2.5,1,4,)
138+
(63,4,10,2.5,1,4,)
139+
(64,4,10,2.5,1,4,)
140+
(64 rows)
141+
142+

sql/test.sql

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,3 +12,6 @@ select count(*),count(x),sum(x),avg(x),min(x),max(x),variance(x),var_pop(x),var_
1212
select count(*),count(x),sum(x),avg(x),min(x),max(x),variance(x),var_pop(x),var_samp(x),stddev(x),stddev_pop(x),stddev_samp(x) from v where x > 1.0;
1313
select count(*),count(x),sum(x),avg(x),min(x),max(x),variance(x),var_pop(x),var_samp(x),stddev(x),stddev_pop(x),stddev_samp(x) from s where x > 1.0;
1414
select count(*) from v where ifnull(x, 0) >= 0;
15+
select count(*) from v where coalesce(x, 0.0::float8::vops_float4) >= 0;
16+
select unnest(t.*) from (select mcount(*) over w,mcount(x) over w,msum(x) over w,mavg(x) over w,mmin(x) over w,mmax(x) over w,x - lag(x) over w from v window w as (rows between unbounded preceding and current row)) t;
17+

0 commit comments

Comments
 (0)